{"id":28816747,"url":"https://github.com/jawherkl/nodejs-microservices","last_synced_at":"2026-03-10T16:02:15.940Z","repository":{"id":299595760,"uuid":"1003042601","full_name":"JawherKl/nodejs-microservices","owner":"JawherKl","description":"Scalable and modular microservices system ready for production built with Node.js, PostgreSQL, MongoDB, RabbitMQ and Docker.","archived":false,"fork":false,"pushed_at":"2026-01-16T16:30:03.000Z","size":1110,"stargazers_count":41,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-17T05:22:40.278Z","etag":null,"topics":["expressjs","mongodb","nestjs","nodejs","postgresql","rabbitmq","swagger-ui"],"latest_commit_sha":null,"homepage":"https://medium.com/@jawherkl/nodejs-microservices-product-order-inventory-system-3fc868ab3417","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JawherKl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-16T14:31:07.000Z","updated_at":"2026-01-16T16:30:08.000Z","dependencies_parsed_at":"2025-06-17T10:45:24.453Z","dependency_job_id":"d2af1201-b8f3-469b-a4b0-5b1714832fa5","html_url":"https://github.com/JawherKl/nodejs-microservices","commit_stats":null,"previous_names":["jawherkl/nodejs-microservices"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JawherKl/nodejs-microservices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fnodejs-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fnodejs-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fnodejs-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fnodejs-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JawherKl","download_url":"https://codeload.github.com/JawherKl/nodejs-microservices/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JawherKl%2Fnodejs-microservices/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30341628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"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","mongodb","nestjs","nodejs","postgresql","rabbitmq","swagger-ui"],"created_at":"2025-06-18T17:06:46.585Z","updated_at":"2026-03-10T16:02:15.920Z","avatar_url":"https://github.com/JawherKl.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛒 NodeJS Microservices: Order \u0026 Inventory System\n\n![Repository Size](https://img.shields.io/github/repo-size/JawherKl/nodejs-microservices)\n![Last Commit](https://img.shields.io/github/last-commit/JawherKl/nodejs-microservices)\n![Issues](https://img.shields.io/github/issues-raw/JawherKl/nodejs-microservices)\n![Forks](https://img.shields.io/github/forks/JawherKl/nodejs-microservices)\n![Stars](https://img.shields.io/github/stars/JawherKl/nodejs-microservices)\n\nScalable and modular microservices architecture built with Node.js (NestJS \u0026 ExpressJS), PostgreSQL, MongoDB and Docker. It leverages RabbitMQ for event-driven communication, ideal for modern e-commerce and real-time systems.\n\n![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge\u0026logo=node.js\u0026logoColor=white)\n![NestJS](https://img.shields.io/badge/nestjs-E0234E?style=for-the-badge\u0026logo=nestjs\u0026logoColor=white)\n![ExpressJS](https://img.shields.io/badge/express.js-000000?style=for-the-badge\u0026logo=express\u0026logoColor=white)\n![PostgreSQL](https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white)\n![MongoDB](https://img.shields.io/badge/mongodb-4EA94B?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white)\n![RabbitMQ](https://img.shields.io/badge/rabbitmq-FF6600?style=for-the-badge\u0026logo=rabbitmq\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/docker-2496ED?style=for-the-badge\u0026logo=docker\u0026logoColor=white)\n\n---\n\n\u003cimg width=\"520\" alt=\"nodejs-microservice\" src=\"https://github.com/user-attachments/assets/8ae30270-d510-495d-b69e-5911c6142ec1\" /\u003e\n\n## ✨ Overview\n\nThis project demonstrates a modern microservices architecture for an Order \u0026 Inventory System, suitable for real-world companies. Each service is designed with a single responsibility, clear separation, and scalable technologies.\n\n- **Tech Focus:** TypeScript-first, RESTful APIs, event-driven messaging, containerised infrastructure\n- **Monorepo:** All services managed together for easy orchestration and development\n- **Best Practices:** Security, scalability, and maintainability in mind\n\n---\n\n## 🏗️ Architecture\n\n```mermaid\ngraph TB\n    %% Application Layer\n    subgraph \"Application Layer\"\n        agw[API Gateway]\n        us[User Service\u003cbr/\u003eNestJS]\n        ps[Product Service\u003cbr/\u003eExpressJS]\n        os[Order Service\u003cbr/\u003eNestJS]\n        isvc[Inventory Service\u003cbr/\u003eExpressJS]\n        ns[Notification Service\u003cbr/\u003eExpressJS]\n    end\n\n    %% Database Layer\n    subgraph \"Database Layer\"\n        pg[(PostgreSQL)]\n        mongo[(MongoDB)]\n    end\n\n    %% Messaging Layer\n    subgraph \"Messaging\"\n        rmq[[RabbitMQ\u003cbr/\u003eMessage Broker]]\n    end\n\n    %% Dependencies and Connections\n    agw --\u003e|REST| us\n    agw --\u003e|REST| ps\n    agw --\u003e|REST| os\n    agw --\u003e|REST| isvc\n    agw --\u003e|REST| ns\n\n    us -- \"DATABASE_URL\" --\u003e pg\n    os -- \"DATABASE_URL\" --\u003e pg\n    ps -- \"mongodb://...\" --\u003e mongo\n    isvc -- \"mongodb://...\" --\u003e mongo\n    ns -- \"mongodb://...\" --\u003e mongo\n\n    us -- \"RABBITMQ_URL\" --\u003e rmq\n    os -- \"RABBITMQ_URL\" --\u003e rmq\n    isvc -- \"RABBITMQ_URL\" --\u003e rmq\n    ns -- \"RABBITMQ_URL\" --\u003e rmq\n\n    %% Messaging Events\n    rmq -- \"Events\" --\u003e os\n    rmq -- \"Events\" --\u003e isvc\n    rmq -- \"Events\" --\u003e ns\n\n    %% External Ports Exposure\n    agw --\u003e|\":3000\"| extgw[External Access]\n    us --\u003e|\":3001\"| extus[External Access]\n    ps --\u003e|\":3002\"| extps[External Access]\n    os --\u003e|\":3003\"| extos[External Access]\n    isvc --\u003e|\":3004\"| extis[External Access]\n    ns --\u003e|\":3005\"| extns[External Access]\n    pg --\u003e|\":9091\"| extpg[External Access]\n    mongo --\u003e|\":9092\"| extmongo[External Access]\n    rmq --\u003e|\":9093/9094\"| extrmq[External Access]\n\n    %% Class Styling\n    classDef app fill:#2ecc71,stroke:#27ae60,color:white\n    classDef db fill:#3498db,stroke:#2980b9,color:white\n    classDef msg fill:#e67e22,stroke:#d35400,color:white\n    classDef ext fill:#95a5a6,stroke:#7f8c8d,color:white\n\n    class agw,us,ps,os,isvc,ns app\n    class pg,mongo db\n    class rmq msg\n    class extgw,extus,extps,extos,extis,extns,extpg,extmongo,extrmq ext\n```\n\n| Microservice             | Tech Stack       | DB         | Responsibility                                  |\n| ------------------------ | ---------------- | ---------- | ----------------------------------------------- |\n| **User Service**         | NestJS           | PostgreSQL | User registration, login, authentication, roles |\n| **Product Service**      | ExpressJS        | MongoDB    | Product CRUD (create, update, list, delete)     |\n| **Order Service**        | NestJS           | PostgreSQL | Order creation, validation, and processing      |\n| **Inventory Service**    | ExpressJS        | MongoDB    | Stock tracking, update on orders                |\n| **Notification Service** | ExpressJS        | MongoDB    | Email/log notifications on events               |\n| **API Gateway**          | ExpressJS/NestJS | -          | Unified API entry, routing, token verification  |\n| **Message Broker**       | RabbitMQ    | -          | Inter-service event bus                         |\n\n---\n\n## 📁 Project Structure\n\n```bash\nnodejs-microservices/\n├── api-gateway/              # API Gateway (routing, auth)\n├── user-service/             # User microservice\n├── product-service/          # Product microservice\n├── order-service/            # Order microservice\n├── inventory-service/        # Inventory microservice\n├── notification-service/     # Notification microservice\n├── docker-compose.yml        # Infrastructure orchestration\n├── docs/                     # Architecture diagrams, docs\n├── README.md\n```\n\n---\n\n## 🔗 Communication\n\n* **API Gateway ⇄ Services:** REST (HTTP)\n* **Between Services:** Messaging (RabbitMQ)\n\n  * `OrderService` emits `order_created`\n  * `InventoryService` listens and adjusts stock\n  * `NotificationService` listens and sends notification\n\n---\n\n## 🚀 Features\n\n### 👤 User Service\n\n* Secure sign up \u0026 login\n* JWT authentication\n* Role-based access (admin/user)\n\n### 🛍️ Product Service\n\n* Create/list/delete products\n* Fetch by product ID\n* Simple MongoDB schema\n\n### 🛒 Order Service\n\n* Place new orders\n* Validate users \u0026 product stock\n* Emits `order_created` event\n\n### 🏬 Inventory Service\n\n* Listens to `order_created`\n* Decreases stock or rejects if insufficient\n\n### 📢 Notification Service\n\n* Listens to events (`order_created`, etc)\n* Sends notification (email/log)\n\n### 🌍 API Gateway\n\n* One entry point for frontend\n* Reverse proxy, JWT verification\n* Routes `/products`, `/orders`, `/users` to services\n\n---\n\n## 🐳 Dockerized Infrastructure\n\nPowered by `docker-compose.yml`:\n\n* All microservices (with build contexts)\n* MongoDB, PostgreSQL databases\n* RabbitMQ for messaging\n* Optional admin UIs: pgAdmin, Mongo Express, RabbitMQ dashboard\n\n### 🧪 Docker Network \u0026 Setup\n\nBefore starting the app, **create the Docker network**:\n\n```bash\ndocker network create \\\n  --driver=bridge \\\n  --subnet=172.21.0.0/24 \\\n  nodejs_network\n```\n\nThen run the entire system:\n\n```bash\nsudo docker-compose up --build -d\n```\n\nAll services will be available on their respective internal IP addresses and ports, or via the API Gateway.\n\n---\n\n## 🛣️ Roadmap\n\n* [ ] Add OpenAPI/Swagger docs for each service\n* [ ] Service discovery and dynamic routing\n* [ ] Production-ready monitoring \u0026 logging\n* [ ] Integration with frontend (React/Angular)\n* [ ] Advanced notification channels (SMS, Push)\n* [ ] Create CI/CD Pipeline with GitHub Actions\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions, ideas, and feedback.\nFeel free to open issues or submit pull requests.\n\n---\n\n## 📜 License\n\nMIT License. See [LICENSE](LICENSE) for details.\n\n---\n\n## 👨‍💻 Author\n\n**Jawher Kallel**\n[GitHub @JawherKl](https://github.com/JawherKl)\n\n---\n\nMade with ❤️ for scalable, real-world systems.\n\n## 🌟 Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/JawherKl/nodejs-microservices.svg?variant=adaptive)](https://starchart.cc/JawherKl/nodejs-microservices)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fnodejs-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjawherkl%2Fnodejs-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjawherkl%2Fnodejs-microservices/lists"}