A microservices-based sales management system built with Node.js, Express, and MongoDB.
- User Management with JWT Authentication
- Customer Management
- Sales Tracking with Pipeline
- API Gateway for Service Communication
- Swagger Documentation
- Docker Support
- Workspace-based Monorepo Structure
- Node.js (v18 or higher)
- MongoDB
- Docker and Docker Compose (optional)
The system consists of four microservices:
- API Gateway (Port 3000) - Entry point for all client requests
- User Service (Port 3001) - Handles authentication and user management
- Customer Service (Port 3002) - Manages customer data and relationships
- Sales Service (Port 3003) - Tracks sales pipeline and opportunities
- Backend: Node.js & Express
- Database: MongoDB
- Authentication: JWT
- Documentation: Swagger
- Containerization: Docker
- Project Structure: Monorepo with npm workspaces
.
├── services/
│ ├── user-service/ # User management service
│ ├── customer-service/ # Customer management service
│ ├── sales-service/ # Sales tracking service
│ └── api-gateway/ # API Gateway
├── shared/ # Shared modules and utilities
├── node_modules/ # Root level dependencies
├── package.json # Workspace configuration
└── docker-compose.yml # Docker Compose configuration
- Clone the repository:
git clone <repository-url>
cd sales-management-system- Install dependencies using workspace-based installation:
npm install-
Create .env files in each service directory (see .env.example files)
-
Start MongoDB:
mongod- Start all services in development mode:
npm run devAlternatively, you can start individual services from their respective directories:
cd services/<service-name> && npm run dev- Build and start all services:
docker-compose up --build- Stop all services:
docker-compose downEach service provides Swagger documentation at:
- API Gateway: http://localhost:3000/api-docs
- User Service: http://localhost:3001/api-docs
- Customer Service: http://localhost:3002/api-docs
- Sales Service: http://localhost:3003/api-docs
Run tests for all services:
npm testTo run tests for a specific service:
cd services/<service-name> && npm testEach service requires its own .env file. See the .env.example files in each service directory for required variables.