https://github.com/mubashir15700/microsphere
Node.js microservices with TypeScript, Docker, MongoDB, MySQL, Redis, RabbitMQ, and a Next.js frontend β featuring API Gateway, auth, task, user, and notification services.
https://github.com/mubashir15700/microsphere
api-gateway backend docker frontend husky jest microservices mongodb nextjs nodejs rabbitmq redis swagger typescript
Last synced: 3 months ago
JSON representation
Node.js microservices with TypeScript, Docker, MongoDB, MySQL, Redis, RabbitMQ, and a Next.js frontend β featuring API Gateway, auth, task, user, and notification services.
- Host: GitHub
- URL: https://github.com/mubashir15700/microsphere
- Owner: Mubashir15700
- Created: 2025-08-28T06:11:57.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-10-05T03:42:00.000Z (9 months ago)
- Last Synced: 2025-10-05T05:36:59.697Z (9 months ago)
- Topics: api-gateway, backend, docker, frontend, husky, jest, microservices, mongodb, nextjs, nodejs, rabbitmq, redis, swagger, typescript
- Language: TypeScript
- Homepage:
- Size: 375 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π§© MicroSphere β Node.js Microservices Architecture (TypeScript + Docker)
This project demonstrates a complete Node.js microservices architecture using TypeScript, Docker, MongoDB, MySQL, Prisma ORM, Redis, RabbitMQ, and Socket.IO, along with a Next.js frontend. It follows clean service boundaries with Auth, User, Task, Notification, and an API Gateway.
Services communicate through REST APIs, asynchronous messaging (RabbitMQ), and real-time WebSocket events (Socket.IO).
The frontend, built with Next.js + TypeScript and Zustand for state management, is located in the /client folder and is currently under active development.
---
## π§ Architecture Overview
- **API Gateway** β Entry point for all requests, handles routing and JWT authentication.
- **Auth Service** β Manages user registration and login, returns signed JWT tokens.
- **User Service** β Manages user data in MongoDB, with Redis caching implemented in the "Get All Users" API.
- **Task Service** β Manages tasks in MongoDB, and sends messages to RabbitMQ. Redis caching is used in the "Get All Tasks" API.
- **Notification Service** β Subscribes to RabbitMQ, stores notifications via Prisma (MySQL), and sends real-time notifications to the client using Socket.IO. Redis caching is used in the βGet All Notificationsβ API.
- **Client (Next.js)** β React-based frontend using Zustand for global state management and Socket.IO client for real-time notifications.
- **MongoDB** β Stores persistent data for users and tasks.
- **Prisma ORM with MySQL** β For notifications persistence.
- **Redis** β Caching layer for User, Task and Notification services to improve read performance.
- **RabbitMQ** β Message broker for asynchronous, event-driven communication between services.
- **Swagger** β API documentation available for backend services.
- **Husky** β Git hooks for enforcing code quality and pre-commit checks.
---
## π¦ Tech Stack
### π§° Backend
- **Node.js** with **Express**
- **TypeScript**
- **MongoDB**
- **MySQL** (for Prisma ORM)
- **Redis** (used in User, Task and Notification services)
- **RabbitMQ**
- **Socket.IO** (real-time communication between Notification Service and client)
- **JWT Authentication**
- **Docker & Docker Compose**
- **http-proxy-middleware** for API Gateway
- **Swagger** for REST API documentation
- **ts-node-dev** for dev mode hot-reload
### π₯οΈ Frontend
- **Next.js** (React + TypeScript)
- **Zustand** β Lightweight state management
- **Axios** β For API requests
- **Socket.IO Client** β For receiving real-time notifications
- **Tailwind CSS**
- **shadcn/ui** β Accessible, customizable UI components (built on Radix UI & Tailwind)
- **Swagger UI** β For API documentation
### π§ͺ Dev Tooling
- **Husky** β Git hooks for code linting, pre-commit checks, etc.
- **ESLint + Prettier** β Code quality and formatting (assumed, can be mentioned if true)
---
## π Project Structure
```
βββ .github/ # π GitHub Actions/CI workflows
βββ .husky/ # βοΈ Git hooks for pre-commit, pre-push
βββ api-gateway/ # πͺ Centralized routing & auth handling
βββ auth-service/ # π Handles registration, login, and JWT
βββ client/ # π₯οΈ Next.js frontend (Zustand + Socket.IO)
βββ notification-service/ # π£ Notification management (Prisma + RabbitMQ + Socket.IO)
βββ task-service/ # β
Task management (MongoDB + Redis)
βββ user-service/ # π€ User data (MongoDB + Redis)
βββ .gitignore # π« Git ignore rules
βββ docker-compose.yml # π³ Docker orchestration
βββ package-lock.json # π Lock file for dependency versions
βββ package.json # π¦ Project dependencies & Husky configurations
βββ README.md # π Project overview
```
---
## π Getting Started
### π§ Prerequisites
- [Docker](https://www.docker.com/products/docker-desktop)
- [Docker Compose](https://docs.docker.com/compose/install/)
---
### βΆοΈ Run the Project
1. **Clone the Repository**
```bash
git clone https://github.com/Mubashir15700/MicroSphere.git
cd MicroSphere
```
2. **Start All Services**
`docker-compose up --build`
This will:
- π§ Build Docker images for all services
- π³ Start MongoDB, MySQL, Redis, and RabbitMQ containers
- π Launch all backend services with hot-reload enabled via ts-node-dev
- π Expose APIs through the API Gateway
- β‘ Enable real-time notification streaming via Socket.IO
---
## π Swagger API Documentation
Each backend service exposes Swagger UI for exploring and testing APIs.
βΉοΈ Swagger docs are available once all services are running via docker-compose up.
Service Swagger URL:
- **Auth Service** - http://localhost:3000/auth/api-docs
- **User Service** - http://localhost:3000/users/api-docs
- **Task Service** - http://localhost:3000/tasks/api-docs
- **Notification Service** - http://localhost:3000/notifications/api-docs