An open API service indexing awesome lists of open source software.

https://github.com/bengisusaahin/ecommerce-app

Built a scalable backend e-commerce system using NestJS (Node.js), TypeScript, MongoDB, and Kafka in a microservices architecture. Implemented user, product, order, cart, and shipping services with authentication, pagination, and asynchronous event handling.
https://github.com/bengisusaahin/ecommerce-app

docker javascript nestjs nodejs postgresql-database postman typescript

Last synced: 10 months ago
JSON representation

Built a scalable backend e-commerce system using NestJS (Node.js), TypeScript, MongoDB, and Kafka in a microservices architecture. Implemented user, product, order, cart, and shipping services with authentication, pagination, and asynchronous event handling.

Awesome Lists containing this project

README

          

# Ecommerce-app

This project is final case of the **NewMindAi Bootcamp**. It was built using **NestJS**, follows **modular, clean code principles**, and adopts a **microservice architecture** with **Kafka**, **PostgreSQL**, **MongoDB**, **Redis**, and **Docker**. The application is fully containerized and includes services such as **Users**, **Products**, **Orders**, **Cart**, **Shipping**, **Stock**, **Notifications**, **Authentication**, and **API Gateway**.

## πŸš€ Features

- Built with **NestJS** and **TypeScript**
- Microservices Architecture with **Kafka** as message broker
- CRUD operations for **Users**, **Products**, **Orders**, **Cart**
- **MongoDB** for Cart and Shipping services, **PostgreSQL** for others
- **Redis Cache** integration for performance optimization
- **DTO validation** with `class-validator`
- **Guards** for Admin and Super Admin role access
- **Pipes** for data validation and transformation
- **Global Exception Filter** for standardizing error responses
- **Interceptors** for consistent success response structure
- **Swagger Documentation**
- Implements **Atomic Commits** with **Semantic Commit Messages**

## πŸ”§ Installation

```bash
# Install dependencies
npm install

# Run full system with Docker
docker-compose up --build
```

> Make sure you have Docker, Docker Compose and Node.js installed.

## πŸ”— Sample Endpoints
- **Users Service:** `/users` β†’ List of users

- **Products Service:** `/products` β†’ List of products

- **Products Service:** `/products/:id` β†’ Get a specific product by ID

- **Users Service:** `/users/:id` β†’ Get a specific user by ID

- **Users Service:** `/users` β†’ Create a new user

- **Products Service:** `/products` β†’ Add a new product

- **Users Service:** `/users/:id` β†’ Update user details (including role update, Super Admin only)

## πŸ“† Shared Library

This project uses a **Shared Library (`libs`)** to centralize and reuse common logic, types, and patterns across all microservices. This promotes **DRY principles**, consistency, and maintainability.

### πŸ“‚ What’s included?
- `DTO` classes shared across services (e.g., `CreateUserDto`, `CreateProductDto`)
- `Types` and interfaces (e.g., `PaginationParams`, `SortOrder`)
- Kafka `Event Patterns` used in inter-service communication
- Shared enums and utility types

### πŸ”— Example Usage
```ts
// In any microservice
import { CreateUserDto, USER_PATTERNS } from '@ecommerce/types';
```

### πŸ”§ Benefits
- Centralized schema validation
- Improved type safety and reusability
- Clean versioning and atomic updates
- Decouples logic across microservices

## πŸ“Έ Screenshots

## 🐳 Docker Containers Overview

The system runs all services and dependencies in isolated containers using Docker Compose:

![](./assets/screenshots/containers.png)

![](./assets/screenshots/containers2.png)

### πŸ—„οΈ Databases & Infrastructure

- PostgreSQL – Orders Microservice
![](./assets/screenshots/orders-pg-db.png)
- Redis Cache
![](./assets/screenshots/redis.png)
- MongoDB – Cart and Shipping
![](./assets/screenshots/cart-mongo-db.png)
![](./assets/screenshots/shipping-mongo-db.png)
- pgAdmin Interface
![](./assets/screenshots/pgadmin.png)
- Zookeeper & Kafka Services
![](./assets/screenshots/zookeeper.png)
![](./assets/screenshots/kafka.png)

### 🧩 Microservices

- API Gateway
![](./assets/screenshots/api-gateway.png)
- Auth Service
![](./assets/screenshots/auth-microservice.png)
- Cart Service
![](./assets/screenshots/cart-microservice.png)
- Notifications Service
![](./assets/screenshots/notifications-microservice.png)
- Orders Service
![](./assets/screenshots/orders-microservice.png)
- Products Service
![](./assets/screenshots/products-microservice.png)
- Shipping Service
![](./assets/screenshots/shipping-microservice.png)
- Stock Service
![](./assets/screenshots/stock-microservice.png)
- Users Service
![](./assets/screenshots/users-microservice.png)

> Full visual overview available in: [Screenshots.pdf](./assets/screenshots/Screenshots.pdf)

## πŸ“˜ Swagger UI
![Swagger UI](./assets/screenshots/swagger-ui.png)

## Commit Strategy

This project follows:

- **Atomic Commits**
Each commit introduces a single, meaningful change.

- **Semantic Commit Messages**
Examples:
- `feat: add /oldestEmployee API endpoint`
- `refactor: modularize API route handling`
- `fix: handle invalid JSON gracefully`

> This strategy improves collaboration, code review, and readability of the project history.
## Contact


Bengisu Şahin - bengisusaahin@gmail.com


linkedin