A microservice shop backend
An e-commerce backend split into an API gateway and four NestJS services that talk over TCP for requests and Kafka for events.
- Problem
- A shop backend should be able to scale its catalog, carts, orders and users independently, without every service sharing one database or one deployment.
- Contribution
- Sole developer: service boundaries, inter-service contracts, data models, messaging, local infrastructure and tests.
- Approach
- An API gateway handles authentication and routes requests to user, product, cart and order services, using NestJS's TCP transport for synchronous calls. State changes such as a placed order are published to Kafka so other services can react without being called directly. Each service owns its own Prisma schema over PostgreSQL, and Redis provides caching. Shared libraries hold auth, database, messaging and common code.
- Outcome
- The gateway and four services are defined with written request/response and event contracts. Docker Compose brings up PostgreSQL, Redis and Kafka. There are gateway end-to-end tests, Testcontainers for integration tests and Pact for consumer contracts.