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.
- Host: GitHub
- URL: https://github.com/bengisusaahin/ecommerce-app
- Owner: bengisusaahin
- License: mit
- Created: 2025-04-23T09:59:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-12T22:23:42.000Z (about 1 year ago)
- Last Synced: 2025-06-15T18:26:25.860Z (about 1 year ago)
- Topics: docker, javascript, nestjs, nodejs, postgresql-database, postman, typescript
- Language: TypeScript
- Homepage:
- Size: 7.08 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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:


### ποΈ Databases & Infrastructure
- PostgreSQL β Orders Microservice

- Redis Cache

- MongoDB β Cart and Shipping


- pgAdmin Interface

- Zookeeper & Kafka Services


### π§© Microservices
- API Gateway

- Auth Service

- Cart Service

- Notifications Service

- Orders Service

- Products Service

- Shipping Service

- Stock Service

- Users Service

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

## 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