How aelassas/microservices works
Project type and purpose
• Full-stack microservices e-commerce “store” solution built on ASP.NET Core
• Three independent backend microservices (Catalog, Cart, Identity), two API gateways (FrontendGateway, BackendGateway), two client UIs (frontend store, admin backend), shared middleware library, MongoDB per service, Docker-compose deployment, CI/CD pipelines.
File-structure highlights
• src/microservices: three self-contained services, each with Controllers, Models, Repositories, Startup, Dockerfile, appsettings.
• src/gateways: Ocelot-based ASP.NET Core projects for frontend and backend APIs, include JWT, CORS, HealthChecks.
• src/middlewares: common JWT builder, encryptor, request/response logging, health-check helpers.
• src/uis: two static‐HTML + vanilla JS apps served by ASP.NET Core, Dockerfiles for containerization.
• docker-compose.yml: orchestrates MongoDB, microservices, gateways, UIs.
• .github/workflows: build/test pipelines.
Key README insights
• Database-per-service pattern (isolated MongoDB for each microservice).
• API Gateway pattern with Ocelot (two gateways).
• JWT authentication propagated from Identity microservice, enforced by middleware.
• Health checks and centralized HealthChecksUI.
• CI via GitHub Actions, containerized deployment via Docker Compose.
– Users (Frontend User, Admin User)
– UI apps: Frontend UI, Backend UI
– API Gateways: FrontendGateway, BackendGateway
– Microservices: CatalogMS, CartMS, IdentityMS
– Databases: Mongo-Catalog, Mongo-Cart, Mongo-Identity
– Shared Middleware library (JWT, logging, encryption)
– External: GitHub Actions, Docker Registry (optional)
1. Users → UI apps (HTTP)
2. UI apps → FrontendGateway/BackendGateway (HTTP, JWT in header)
3. Gateways → respective microservices (route via Ocelot)
4. Microservices ↔ their MongoDB instance (CRUD operations)
5. IdentityMS → JWTBuilder → Gateways + other MS for auth
6. HealthChecks endpoints → HealthChecksUI
7. CI/CD: GitHub Actions → build → Docker images → Docker Registry → docker-compose
c. Architectural patterns & principles
• Microservices (single responsibility, independently deployable)
• API Gateway (Ocelot) for request routing, JWT enforcement, logging, health checks
• Database-per-service pattern for data isolation
• Stateless services + JWT auth
• Containerization (Docker multi-stage builds, docker-compose)
• CI/CD pipelines for build/test
d. Technologies & frameworks
• ASP.NET Core (microservices, gateways, UIs)
• Ocelot (API gateway)
• MongoDB (.NET driver, HealthChecks.MongoDb)
• JWT (System.IdentityModel.Tokens, custom JwtBuilder)
• Serilog (logging in gateways)
• xUnit + Moq (unit tests)
• Docker & Docker Compose
• GitHub Actions (build.yml, test.yml)