This project is an e-commerce API that is based on Domain-Driven Design (DDD) and also implements a CQRS pattern.
In DDD, the different parts of the system are separated into different "domains", each with its own logic and business rules. Each domain is further divided into "subdomains" that focus on a specific task. To handle domain events, we will use RabbitMQ, which allows us to exchange messages asynchronously and scalably. Currently, this project has 3 domains.
- User
- Category
- Product
Note: Please note that I am not an expert in these technologies, methods, and patterns. If you have any advice or feedback, it will be welcome.
Nodejs, Express, Typescript, Typeorm, Inversify, amqplib, Eslint, Prettier, Docker
├── src
│ ├── apps
│ │ ├── mooc
│ │ └── backend
│ │ ├── command
│ │ ├── controller
│ │ ├── dependency-injection
│ │ ├── routes
│ │ ├── bootstrap.ts
│ │ └── server.ts
│ └── contexts
│ ├── category
│ │ ├── infrastructure
│ │ ├── application
│ │ └── domain
│ ├── product
│ │ ├── infrastructure
│ │ ├── application
│ │ └── domain
│ ├── shared
│ │ ├── infrastructure
│ │ ├── application
│ │ └── domain
│ └── user
│ ├── infrastructure
│ ├── application
│ └── domain
└── test
PORT=4000
DB_NAME=ecommerce
MYSQL_USER=root
MYSQL_PASSWORD=example
MYSQL_PORT=3306
RABBIT_USERNAME='example'
RABBIT_PASSWORD='example'
RABBIT_VHOST='/'
RABBIT_SECURE=false
RABBIT_HOSTNAME='localhost'
RABBIT_PORT=5672
EXCHANGE_NAME='domain_events'
MAX_RETRIES=3
MODULE_NAME='mooc'
- Fork this project:
- Clone the repository:
git clone https://github.com/Joeldev1021/ecommerce-api
- Install dependencies:
npm install
npm run docker:up
npm run rabbit:config:command
npm run dev