{"id":28936024,"url":"https://github.com/maruf-pfc/users-crud-api","last_synced_at":"2025-08-12T14:36:13.338Z","repository":{"id":298391314,"uuid":"999227332","full_name":"maruf-pfc/users-crud-api","owner":"maruf-pfc","description":"Users CRUD API with Nodejs, Express js, PostgreSQL, Docker and Joi","archived":false,"fork":false,"pushed_at":"2025-06-11T01:14:04.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-22T20:07:22.654Z","etag":null,"topics":["crud-api","docker","pnpm","swagger-docs","unittest"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maruf-pfc.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,"zenodo":null}},"created_at":"2025-06-10T00:04:05.000Z","updated_at":"2025-06-11T01:18:18.000Z","dependencies_parsed_at":"2025-06-10T22:27:26.263Z","dependency_job_id":"c1eea29d-47c4-409c-9c69-0ab64c5faabd","html_url":"https://github.com/maruf-pfc/users-crud-api","commit_stats":null,"previous_names":["maruf-pfc/users-crud-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maruf-pfc/users-crud-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maruf-pfc%2Fusers-crud-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maruf-pfc%2Fusers-crud-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maruf-pfc%2Fusers-crud-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maruf-pfc%2Fusers-crud-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maruf-pfc","download_url":"https://codeload.github.com/maruf-pfc/users-crud-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maruf-pfc%2Fusers-crud-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270077158,"owners_count":24523077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["crud-api","docker","pnpm","swagger-docs","unittest"],"created_at":"2025-06-22T20:07:21.469Z","updated_at":"2025-08-12T14:36:13.330Z","avatar_url":"https://github.com/maruf-pfc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧑‍💻 Users CRUD API\n\nA full-featured Users CRUD REST API built with **Node.js**, **Express**, and **PostgreSQL**. Includes:\n\n- Docker support\n- Swagger API documentation\n- Centralized error handling\n- Postgres integration with both Docker and local **pgAdmin**\n- Auto table creation on server start\n\n## 🚀 Features\n\n- ✅ RESTful API for user resource (CRUD)\n- ✅ PostgreSQL database with Docker container\n- ✅ Local database management using pgAdmin\n- ✅ Swagger UI for API docs (`/api/v1/api-docs`)\n- ✅ Modular structure (routes, controllers, models, middleware)\n- ✅ Centralized error handler\n- ✅ Auto-create tables on startup\n- ✅ Environment variable support via `.env`\n\n## 🧱 Tech Stack\n\n- Node.js\n- Express.js\n- PostgreSQL\n- Docker \u0026 Docker Compose\n- pgAdmin\n- Swagger (OpenAPI)\n- ESLint (optional)\n\n## 📁 Folder Structure\n\n```txt\n📦users-crud-api\n ┣ 📂.vscode\n ┃ ┗ 📜settings.json\n ┣ 📂public\n ┃ ┗ 📜vite.svg\n ┣ 📂src\n ┃ ┣ 📂configs\n ┃ ┃ ┣ 📜db.js\n ┃ ┃ ┗ 📜swagger.js\n ┃ ┣ 📂controllers\n ┃ ┃ ┗ 📜userController.js\n ┃ ┣ 📂database\n ┃ ┃ ┣ 📜createUserTable.js\n ┃ ┃ ┗ 📜db.sql\n ┃ ┣ 📂middlewares\n ┃ ┃ ┣ 📜errorHandler.js\n ┃ ┃ ┗ 📜validate.js\n ┃ ┣ 📂models\n ┃ ┃ ┗ 📜userModel.js\n ┃ ┣ 📂routes\n ┃ ┃ ┗ 📜userRoutes.js\n ┃ ┣ 📂utils\n ┃ ┃ ┗ 📜logger.js\n ┃ ┣ 📂validations\n ┃ ┃ ┗ 📜userValidation.js\n ┃ ┣ 📜app.js\n ┃ ┗ 📜server.js\n ┣ 📜.dockerignore\n ┣ 📜.env\n ┣ 📜.env.example\n ┣ 📜.gitignore\n ┣ 📜.prettierignore\n ┣ 📜.prettierrc\n ┣ 📜Dockerfile\n ┣ 📜LICENSE\n ┣ 📜README.md\n ┣ 📜docker-compose.yaml\n ┣ 📜index.html\n ┣ 📜package.json\n ┣ 📜pnpm-lock.yaml\n ┣ 📜users-crud-api.json\n ┗ 📜vite.config.js\n```\n\n## ⚙️ Environment Variables\n\nCreate a `.env` file at the root:\n\n```env\nPORT=5000\nDB_HOST=db\nDB_PORT=5432\nDB_USER=postgres\nDB_NAME=users_db\nDB_PASSWORD=your_password\n```\n\n## 🐳 Docker Setup\n\n### Start containers\n\n```bash\ndocker-compose up --build\n```\n\nThis sets up:\n\n- PostgreSQL database\n- pgAdmin (on port `5432`)\n- Your Node.js app (on `http://localhost:5000/api/v1/`)\n\n## 📦 API Endpoints\n\nBase URL: `http://localhost:5000/api/v1`\n\n| Method | Endpoint    | Description          |\n| ------ | ----------- | -------------------- |\n| GET    | `/users`    | Get all users        |\n| GET    | `/users/:id` | Get user by ID       |\n| POST   | `/users`     | Create new user      |\n| PUT    | `/users/:id` | Update existing user |\n| DELETE | `/users/:id` | Delete a user        |\n\n## 🧪 Swagger Docs\n\nAccess at: `http://localhost:5000/api/v1/api-docs`\n\n```js\n// Swagger setup path in app.js\napp.use('/api/v1/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));\n```\n\n## 🛠️ Scripts\n\n```bash\n# Start server\nnpm run dev\n\n# Build \u0026 run Docker containers\ndocker-compose up --build\n```\n\n## ✅ To Do\n\n- [x] Write unit tests\n- [ ] Write integration tests\n- [x] Add CI/CD with GitHub Actions\n\n## 🤝 Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## 📄 License\n\n[Apache License](LICENSE)\n\n## 👨‍💻 Author\n\n**Md. Maruf Sarker**\nCommunity Manager | Software Engineer | Content Creator\n🔗 [GitHub](https://github.com/maruf-pfc) | 🌐 [LinkedIn](https://linkedin.com/in/mdmarufsarker)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaruf-pfc%2Fusers-crud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaruf-pfc%2Fusers-crud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaruf-pfc%2Fusers-crud-api/lists"}