A robust, scalable real-time chat application built with a modern microservices architecture. This project demonstrates advanced backend skills, including distributed systems, polyglot persistence, and event-driven communication.
This application is designed to handle real-time messaging with a focus on scalability and decoupling. It uses a monorepo structure managed by pnpm workspaces to organize distinct services.
- Microservices Architecture: Functionally decomposed services for Auth and User management.
- Event-Driven Communication: Asynchronous messaging between services using RabbitMQ to ensure loose coupling and reliability.
- Polyglot Persistence: Usage of the right database for the right job — MySQL for authentication/transactional data and PostgreSQL for user profiles.
- Type Safety: End-to-end type safety with TypeScript shared across services.
- Containerization: Fully containerized environment using Docker and Docker Compose for consistent development and deployment.
- Language: TypeScript (Node.js)
- Framework: Express.js
- Package Manager: pnpm (Monorepo Workspaces)
- Auth Service: Handles registration, login, and JWT issuance.
- Database: MySQL
- ORM: Sequelize
- Validation: Zod
- Security: Bcrypt, Helmet
- User Service: Manages user profiles and discovery.
- Database: PostgreSQL
- ORM: Sequelize
- Message Broker: RabbitMQ (amqplib)
- Containerization: Docker, Docker Compose
├── packages
│ └── common # Shared libraries, types, and utilities
├── services
│ ├── auth-service # Authentication & Authorization (MySQL)
│ ├── user-service # User Profile Management (PostgreSQL)
│ └── gateway-service # API Gateway (planned/in-progress)
├── docker-compose.yaml # Orchestration for DBs and Broker
├── package.json # Root workspace config
└── pnpm-workspace.yaml # Workspace definitions
- Node.js (v18+)
- pnpm (
npm install -g pnpm) - Docker & Docker Compose
-
Clone the repository
git clone <repository-url> cd chat-app
-
Install dependencies
pnpm install
-
Start Infrastructure Spin up the databases (MySQL, Postgres) and RabbitMQ.
docker-compose up -d
-
Run Services (Development) You can run services individually or all together depending on the script setup.
# Run all services in dev mode (if script exists) pnpm run dev # OR run specific service pnpm --filter @chat-app/auth-service run dev pnpm --filter @chat-app/user-service run dev
Each service has its own .env configuration (mapped from docker-compose.yaml or .env files).
Common Variables:
PORT: Service portRABBITMQ_URL: AMQP connection stringDB_HOST,DB_USER,DB_PASS,DB_NAME: Database credentials
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request