{"id":49549093,"url":"https://github.com/faizkhairi/microservices-demo","last_synced_at":"2026-05-02T21:04:07.591Z","repository":{"id":338650953,"uuid":"1158592440","full_name":"faizkhairi/microservices-demo","owner":"faizkhairi","description":"Production-grade microservices platform with Nuxt 4 + NestJS — 7 services demonstrating enterprise architecture patterns","archived":false,"fork":false,"pushed_at":"2026-03-30T13:47:36.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-07T21:39:00.620Z","etag":null,"topics":["api-gateway","bullmq","docker","docker-compose","enterprise","enterprise-architecture","event-driven","message-queue","microservices","nestjs","nuxt","postgresql","prisma","redis","typescript"],"latest_commit_sha":null,"homepage":"https://github.com/faizkhairi/microservices-demo","language":"TypeScript","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/faizkhairi.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-15T16:18:58.000Z","updated_at":"2026-03-30T13:47:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/faizkhairi/microservices-demo","commit_stats":null,"previous_names":["faizkhairi/microservices-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/faizkhairi/microservices-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizkhairi%2Fmicroservices-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizkhairi%2Fmicroservices-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizkhairi%2Fmicroservices-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizkhairi%2Fmicroservices-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faizkhairi","download_url":"https://codeload.github.com/faizkhairi/microservices-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faizkhairi%2Fmicroservices-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32549388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T19:18:06.202Z","status":"ssl_error","status_checked_at":"2026-05-02T19:16:21.335Z","response_time":132,"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":["api-gateway","bullmq","docker","docker-compose","enterprise","enterprise-architecture","event-driven","message-queue","microservices","nestjs","nuxt","postgresql","prisma","redis","typescript"],"created_at":"2026-05-02T21:04:02.046Z","updated_at":"2026-05-02T21:04:02.819Z","avatar_url":"https://github.com/faizkhairi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microservices Demo\n\n![CI](https://github.com/faizkhairi/microservices-demo/actions/workflows/ci.yml/badge.svg)\n\n**Production-grade microservices platform** demonstrating enterprise architecture patterns with **Nuxt 4 + NestJS**.\n\nBuilt by [Faiz Khairi](https://github.com/faizkhairi) to showcase scalable system design, message-driven architecture, and modern DevOps practices.\n\n---\n\n## 🏗️ Architecture\n\n**7-Service Microservices Platform:**\n\n```\nFrontend (Nuxt 4)\n       ↓\nAPI Gateway (NestJS) — Routing, Auth, Rate Limiting\n       ↓\n    ┌──┴──┬──────┬──────────┬──────────┐\n    ↓     ↓      ↓          ↓          ↓\n  Auth  User   Task   Notification  Queue Worker\n  :4001 :4002  :4003     :4004      (Background)\n    ↓     ↓      ↓          ↓\n  Auth  User   Task   Notification\n   DB    DB     DB         DB\n```\n\n### Services\n\n| Service | Port | Responsibility |\n|---------|------|----------------|\n| **Frontend** | 3000 | Nuxt 4 web app with Shadcn-vue |\n| **API Gateway** | 4000 | Single entry point, JWT validation, rate limiting |\n| **Auth Service** | 4001 | JWT authentication, refresh tokens, bcrypt password hashing |\n| **User Service** | 4002 | User profiles and account management |\n| **Task Service** | 4003 | Task CRUD + BullMQ job publishing |\n| **Notification Service** | 4004 | Email + in-app notifications |\n| **Queue Worker** | — | Background job processing with BullMQ |\n\n### Infrastructure\n\n- **4 PostgreSQL databases** (one per service — microservices pattern)\n- **Redis** for message queue (BullMQ)\n- **Mailpit** for email testing (dev)\n- **Docker Compose** orchestrating 12 containers\n\n---\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- [Docker](https://www.docker.com/get-started) 20.10+\n- [Docker Compose](https://docs.docker.com/compose/install/) 2.0+\n- [Node.js](https://nodejs.org/) 20+ (for local development)\n- [pnpm](https://pnpm.io/) 8+ (optional)\n\n### Run the Full Stack\n\n```bash\n# Clone the repository\ngit clone https://github.com/faizkhairi/microservices-demo.git\ncd microservices-demo\n\n# Copy environment variables\ncp .env.example .env\n\n# Start all services with Docker Compose\ndocker compose up --build\n\n# Services will be available at:\n# - Frontend: http://localhost:3000\n# - API Gateway: http://localhost:4000\n# - Mailpit UI: http://localhost:8025 (email testing)\n```\n\n**First-time setup:** Docker will build all 7 services + databases. This takes ~5-10 minutes.\n\n---\n\n## 📦 Tech Stack\n\n### Frontend\n- **Nuxt 4** — Vue 3 SSR framework\n- **Shadcn-vue** — Copy-paste UI components\n- **Tailwind CSS** — Utility-first styling\n- **Pinia** — State management\n- **Axios** — HTTP client with JWT interceptor\n\n### Backend\n- **NestJS** — Enterprise Node.js framework\n- **Prisma ORM** — Type-safe database client\n- **PostgreSQL 16** — Production-grade relational DB\n- **Passport + JWT** — Authentication strategy\n- **BullMQ + Redis** — Job queue for async processing\n- **Nodemailer** — SMTP email sending\n\n### DevOps\n- **Docker** — Containerization\n- **Docker Compose** — Multi-container orchestration\n- **GitHub Actions** — CI/CD pipeline\n- **Mailpit** — Email testing (catches all emails in dev)\n\n---\n\n## 🛠️ Development\n\n### Run Services Individually\n\nEach service can be run independently for development:\n\n```bash\n# Auth Service\ncd services/auth-service\nnpm install\nnpm run dev  # Runs on port 4001\n\n# User Service\ncd services/user-service\nnpm install\nnpm run dev  # Runs on port 4002\n\n# Frontend\ncd frontend\nnpm install\nnpm run dev  # Runs on port 3000\n```\n\n### Database Migrations\n\n```bash\n# Auth Service migrations\ncd services/auth-service\nnpx prisma migrate dev --name init\nnpx prisma generate\n\n# User Service migrations\ncd services/user-service\nnpx prisma migrate dev --name init\nnpx prisma generate\n\n# Task Service migrations\ncd services/task-service\nnpx prisma migrate dev --name init\nnpx prisma generate\n\n# Notification Service migrations\ncd services/notification-service\nnpx prisma migrate dev --name init\nnpx prisma generate\n```\n\n---\n\n## 🧪 Testing\n\n```bash\n# Run all tests\nnpm test\n\n# Run tests for specific service\ncd services/auth-service\nnpm test\n\n# E2E tests (Playwright)\ncd frontend\nnpm run test:e2e\n```\n\n---\n\n## 📖 Documentation\n\n- [Architecture Design](./ARCHITECTURE.md) — Detailed system design\n- [API Gateway](./services/api-gateway/README.md) — Routing and authentication\n- [Auth Service](./services/auth-service/README.md) — JWT authentication\n- [User Service](./services/user-service/README.md) — Profile management\n- [Task Service](./services/task-service/README.md) — Task CRUD + queue\n- [Notification Service](./services/notification-service/README.md) — Email + in-app notifications\n- [Queue Worker](./services/queue-worker/README.md) — Background jobs\n\n---\n\n## 🔑 Key Features\n\n### Microservices Architecture\n- ✅ **Database per service** — Each service owns its data (no shared DB)\n- ✅ **API Gateway pattern** — Centralized routing, auth, rate limiting\n- ✅ **Service decomposition** — Clear domain boundaries (auth, users, tasks, notifications)\n\n### Message-Driven Architecture\n- ✅ **BullMQ + Redis** — Async job processing\n- ✅ **Event-driven** — Task creation triggers notification job\n- ✅ **Decoupled services** — Task Service doesn't directly call Notification Service\n\n### Security\n- ✅ **JWT authentication** — Stateless auth with 15-minute access tokens\n- ✅ **Refresh tokens** — 7-day expiration for secure re-authentication\n- ✅ **Bcrypt password hashing** — Industry-standard (salt rounds: 10)\n- ✅ **Rate limiting** — 100 req/min per IP at API Gateway\n- ✅ **Owner-only access** — Users can only access their own data\n\n### DevOps\n- ✅ **Docker Compose** — One-command local environment\n- ✅ **Health checks** — Every service has `/health` endpoint\n- ✅ **Structured logging** — Winston/Pino with correlation IDs\n- ✅ **CI/CD pipeline** — GitHub Actions builds all services\n\n---\n\n## 🌐 Deployment\n\n### Local Development\n```bash\ndocker compose up\n```\n\n### Staging/Production\n\n**Option 1: Docker Compose on VPS**\n```bash\n# On server (Ubuntu/Debian)\ndocker compose -f docker-compose.prod.yml up -d\n\n# Services use production environment variables\n# PostgreSQL, Redis, and services run in containers\n```\n\n**Option 2: Kubernetes (EKS/GKE/AKS)**\n```bash\n# Deploy to Kubernetes\nkubectl apply -f k8s/\n\n# Each service runs as a separate deployment\n# RDS for PostgreSQL, ElastiCache for Redis\n```\n\n**Frontend Deployment:**\n- Netlify (recommended) — Nuxt SSR with Nitro\n- Vercel — Alternative for Next.js-like SSR\n- Self-hosted with Nginx\n\n---\n\n## 📊 Data Flow Examples\n\n### User Registration\n```\n1. User submits form (frontend)\n   ↓\n2. POST /auth/register → API Gateway\n   ↓\n3. API Gateway → Auth Service\n   ↓\n4. Auth Service creates user in auth_db\n   ↓\n5. Returns success → frontend redirects to login\n```\n\n### Create Task (with async notification)\n```\n1. User creates task (frontend)\n   ↓\n2. POST /tasks → API Gateway (validates JWT)\n   ↓\n3. API Gateway → Task Service\n   ↓\n4. Task Service:\n   - Saves task to task_db\n   - Publishes \"task.created\" job to BullMQ\n   ↓\n5. Queue Worker (background):\n   - Picks up job from Redis\n   - Calls Notification Service\n   ↓\n6. Notification Service:\n   - Saves notification to notification_db\n   - Sends email via Mailpit\n```\n\n---\n\n## 🧰 Why This Stack?\n\n| Technology | Reason |\n|-----------|--------|\n| **Nuxt 4** | SSR + Vue 3, production-ready, matches boilerplate |\n| **NestJS** | Enterprise-grade, TypeScript-first, modular architecture |\n| **PostgreSQL** | ACID compliance, production-grade, one DB per service |\n| **Prisma** | Type-safe ORM, auto-migrations, excellent DX |\n| **BullMQ** | Industry-standard Node.js job queue, Redis-backed |\n| **Docker** | Consistent environments, easy orchestration |\n\n---\n\n## 🎯 What This Demonstrates\n\n✅ **Microservices expertise** — Service decomposition, API Gateway, database per service\n✅ **Message-driven architecture** — BullMQ job queues for async processing\n✅ **Modern stack mastery** — Nuxt 4, NestJS, Prisma, PostgreSQL, Redis\n✅ **DevOps capabilities** — Docker multi-container orchestration\n✅ **Enterprise patterns** — JWT auth, rate limiting, structured logging\n✅ **Scalability** — Each service can scale independently\n\n---\n\n## 📝 License\n\nMIT License — See [LICENSE](./LICENSE) for details.\n\n---\n\n## 👤 Author\n\n**Faiz Khairi**\n- GitHub: [@faizkhairi](https://github.com/faizkhairi)\n- LinkedIn: [linkedin.com/in/faizkhairi](https://www.linkedin.com/in/faizkhairi/)\n- Website: [faizkhairi.github.io](https://faizkhairi.github.io)\n\n---\n\n## ⭐ Support\n\nIf you find this project helpful, please give it a star! ⭐\n\nBuilt with ❤️ to showcase production-grade microservices architecture.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizkhairi%2Fmicroservices-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaizkhairi%2Fmicroservices-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaizkhairi%2Fmicroservices-demo/lists"}