CompletedNextJSNodeJSExpressJS+3 more

Webify

Microservices-based web application with user management and real-time chat. Built with Node.js, Express, MongoDB, React, and Nginx as API Gateway. Demonstrates clean microservices architecture with containerized deployment.

Timeline

Role

Status
Completed

Technology Stack

NextJS
NodeJS
ExpressJS
MongoDB
Docker
Nginx

Webify πŸŽΆπŸ’¬

A microservices-based web application with user management and real-time chat, built using Node.js, Express, MongoDB, React, and Nginx as an API Gateway. This project demonstrates a clean microservices architecture with containerized deployment using Docker Compose.


πŸš€ Tech Stack

  • Frontend β†’ React/Next.js
  • Backend Services:
    • User Service β†’ Authentication, user profile (Express + MongoDB)
    • Chat Service β†’ Chat messages & channels (Express + MongoDB + Stream Chat)
  • Gateway β†’ Nginx reverse proxy (routes requests to microservices)
  • Database β†’ MongoDB
  • Containerization β†’ Docker & Docker Compose

πŸ—οΈ Architecture

                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   Client (Browser) β†’  β”‚  Frontend  β”‚
                       β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚  Gateway   β”‚  (Nginx, port 5001)
                      β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚                               β”‚
            β–Ό                               β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ User Service  β”‚                 β”‚ Chat Service  β”‚
   β”‚ (port 3001)   β”‚                 β”‚ (port 3002)   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                 β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                               β”‚
           β–Ό                               β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ MongoDB       β”‚                 β”‚ MongoDB       β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Gateway Routes:

  • /api/user/* β†’ User Service
  • /api/auth/* β†’ User Service
  • /api/chat/* β†’ Chat Service

Gateway exposes a single entrypoint at http://localhost:5001/api/*


πŸ“‚ Folder Structure

webify/
β”œβ”€β”€ frontend/                # React/Next.js frontend
β”œβ”€β”€ gateway/                 # API Gateway (Nginx)
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── nginx.conf
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ user-service/        # User & Auth service
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   └── index.js
β”‚   β”‚   └── package.json
β”‚   β”œβ”€β”€ chat-service/        # Chat service
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   └── index.js
β”‚   β”‚   └── package.json
β”œβ”€β”€ docker-compose.yml       # Orchestrates services locally
β”œβ”€β”€ package.json             # Root package.json (helper scripts)
└── README.md

βš™οΈ Getting Started

1. Clone the repo

git clone https://github.com/your-username/webify.git
cd webify

2. Environment variables

Create .env files for each service based on the .env.example inside their folder:

services/user-service/.env

PORT=3001
MONGO_URL=mongodb://mongo:27017/userdb
JWT_SECRET=supersecret

services/chat-service/.env

PORT=3002
MONGO_URL=mongodb://mongo:27017/chatdb

3. Run with Docker Compose

docker-compose up --build

Endpoints:

4. Shut down

docker-compose down

πŸ“œ NPM Scripts (root)

npm run dev              # Run all services via docker-compose
npm run down             # Stop all services
npm run logs             # Follow logs
npm run frontend:build   # Build frontend manually
npm run frontend:start   # Start frontend locally (without docker)

βœ… Features

  • User authentication (JWT, token blacklist with TTL)
  • Secure login/logout
  • Profile management
  • Real-time chat
  • Microservices architecture with independent scaling
  • API Gateway with Nginx
  • MongoDB for persistence
  • Docker Compose for orchestration

🀝 Contributing

  1. Fork the repo
  2. Create feature branch (git checkout -b feature/new-feature)
  3. Commit changes (git commit -m 'Add new feature')
  4. Push to branch (git push origin feature/new-feature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License.

Developed by Varun Hotani
Β© 2025. All rights reserved.