{"id":21680263,"url":"https://github.com/rifqi142/assignment5_muhrifqis","last_synced_at":"2026-04-08T16:02:16.292Z","repository":{"id":262232985,"uuid":"886615870","full_name":"rifqi142/assignment5_muhrifqis","owner":"rifqi142","description":"This project is a backend RESTful API built with Node.js and Express.js, utilizing Sequelize ORM to interact with a PostgreSQL database. The API manages user-related data, including Customers, their Addresses, Contacts, and Orders. The database schema consists of four main tables: customers, addresses, contacts, and orders.","archived":false,"fork":false,"pushed_at":"2024-11-21T04:45:34.000Z","size":137,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-06T02:50:29.751Z","etag":null,"topics":["expressjs","postgresql","sequelize-orm","swagger-docs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rifqi142.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-11T09:48:04.000Z","updated_at":"2024-12-04T07:14:29.000Z","dependencies_parsed_at":"2024-11-11T10:39:10.710Z","dependency_job_id":"06c5ad63-b5ca-49a8-8546-7486f5c588cc","html_url":"https://github.com/rifqi142/assignment5_muhrifqis","commit_stats":null,"previous_names":["rifqi142/assignment5_muhrifqis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rifqi142/assignment5_muhrifqis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rifqi142%2Fassignment5_muhrifqis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rifqi142%2Fassignment5_muhrifqis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rifqi142%2Fassignment5_muhrifqis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rifqi142%2Fassignment5_muhrifqis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rifqi142","download_url":"https://codeload.github.com/rifqi142/assignment5_muhrifqis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rifqi142%2Fassignment5_muhrifqis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31562697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","postgresql","sequelize-orm","swagger-docs"],"created_at":"2024-11-25T15:15:34.627Z","updated_at":"2026-04-08T16:02:16.278Z","avatar_url":"https://github.com/rifqi142.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛠️ User Management Backend API\n\nThis project is a backend RESTful API built with Node.js and Express.js, utilizing Sequelize ORM to interact with a PostgreSQL database. The API manages user-related data, including Customers, their Addresses, Contacts, and Orders. The database schema consists of four main tables: `customers`, `addresses`, `contacts`, and `orders`, each with specific relationships and fields.\n\n## 📜 Preview of the API Documentation\n\n![Preview](./assets/img-api-docs.png)\n\n## 📋 Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Environment Variables](#environment-variables)\n- [Usage](#usage)\n- [API Endpoints](#api-endpoints)\n- [Dependencies](#dependencies)\n\n---\n\n## ✨ Features\n\n- **CRUD operations** for Customers, Addresses, Contacts, and Orders.\n- **Associations** between tables to allow for efficient relational data handling.\n- **Validation** with Joi for request data integrity.\n- **API Documentation** with Swagger UI.\n- **Support for CORS** to allow cross-origin requests.\n- **Error Handling** middleware to catch and log errors.\n- **Environment Variables** for configuration and security.\n- **Database Migrations** with Sequelize CLI.\n- **Database Seeding** with Faker.js for testing purposes.\n\n---\n\n## 🛠 Installation\n\n1. **Clone the repository**:\n   ```bash\n   git clone https://github.com/rifqi142/assignment5_muhrifqis\n   cd assignment5_muhrifqis\n   ```\n2. **Install the dependencies**:\n   ```bash\n    npm install\n   ```\n3. **Set up the environment variables**:\n   - Create a `.env` file in the root directory.\n   - Copy the contents of `.env.example` into `.env`.\n   - Modify the environment variables as needed.\n   ```bash\n   DB_HOST=your_db_host\n   DB_PORT=your_db_port\n   DB_NAME=your_db_name\n   DB_USER=your_db_user\n   DB_PASSWORD=your_db_password\n   ```\n4. **Run the migrations, and seeders for data**:\n   ```bash\n   npm run migration:up\n   npm run seed:all\n   ```\n5. **Start the server**:\n   ```bash\n    npm start\n   ```\n6. **Access the API**:\n   - Open your browser and navigate to `http://localhost:8080/api-docs` to view the Swagger UI documentation.\n\n---\n\n## 🌐 Environment Variables\n\nThis project uses the following environment variables:\n\n- DB_HOST: Database host (e.g., localhost).\n- DB_PORT: Database port (e.g., 5432).\n- DB_NAME: Name of the database.\n- DB_USER: Database username.\n- DB_PASSWORD: Database password.\n\n---\n\n## 🚀 Usage\n\nUse an API client like Postman or curl to test the API. Example requests and sample data are described below.\n\n### ✏️ API Endpoints\n\n#### 🧑 Customers\n\n| Method | Endpoint       | Description           |\n| ------ | -------------- | --------------------- |\n| GET    | /customers     | Get all customers     |\n| GET    | /customers/:id | Get customer by ID    |\n| POST   | /customers     | Create a new customer |\n| PUT    | /customers/:id | Update customer by ID |\n| DELETE | /customers/:id | Delete customer by ID |\n\n#### 📍 Addresses\n\n| Method | Endpoint                     | Description                         |\n| ------ | ---------------------------- | ----------------------------------- |\n| GET    | /customers/:id/addresses     | Get all addresses for a customer    |\n| GET    | /customers/:id/addresses/:id | Get address by ID for a customer    |\n| POST   | /customers/:id/addresses     | Create a new address for a customer |\n| PUT    | /addresses/:id               | Update address by ID                |\n| DELETE | /addresses/:id               | Delete address by ID                |\n\n#### 📞 Contacts\n\n| Method | Endpoint                    | Description                         |\n| ------ | --------------------------- | ----------------------------------- |\n| GET    | /customers/:id/contacts     | Get all contacts for a customer     |\n| GET    | /customers/:id/contacts/:id | Get contact by ID for a customer    |\n| POST   | /customers/:id/contacts     | Create a new contact for a customer |\n| PUT    | /contacts/:id               | Update contact by ID                |\n| DELETE | /contacts/:id               | Delete contact by ID                |\n\n#### 📦 Orders\n\n| Method | Endpoint                  | Description                       |\n| ------ | ------------------------- | --------------------------------- |\n| GET    | /customers/:id/orders     | Get all orders for a customer     |\n| GET    | /customers/:id/orders/:id | Get order by ID for a customer    |\n| POST   | /customers/:id/orders     | Create a new order for a customer |\n| PUT    | /orders/:id               | Update order by ID                |\n| DELETE | /orders/:id               | Delete order by ID                |\n\n---\n\n## 📘 API Documentation\n\nThe API is documented with Swagger. You can access the documentation at /api-docs when the server is running.\n\n---\n\n## 📦 Dependencies\n\nThis project utilizes the following dependencies:\n\n- Express - Fast, unopinionated, minimalist web framework for Node.js.\n- Sequelize - Promise-based ORM for Node.js and PostgreSQL.\n- @sequelize/postgres - PostgreSQL dialect for Sequelize.\n- Joi - Data validation library for JavaScript.\n- Swagger - Tools for documenting APIs.\n- CORS - Middleware to enable CORS with various options.\n- dotenv - Loads environment variables from .env file.\n- Nodemon - Utility to automatically restart the server for changes.\n\n## 🧑🏻‍💻 Author\n\n- [@Muhammad Rifqi Setiawan](https://github.com/rifqi142)\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frifqi142%2Fassignment5_muhrifqis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frifqi142%2Fassignment5_muhrifqis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frifqi142%2Fassignment5_muhrifqis/lists"}