Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Sociopedia

🌐 Production-Ready Dockerized MERN Application

🐳 Docker β€’ 🌍 Nginx Reverse Proxy β€’ ☁️ MongoDB Atlas β€’ ⚑ Production Architecture

React Redux Material UI NodeJS Express MongoDB Docker Nginx MongoDB Atlas


πŸ“– About Sociopedia

Sociopedia is a production-ready full-stack social media platform built using the MERN stack and containerized with Docker using enterprise deployment practices.

The project demonstrates how modern applications are packaged, secured, networked, and deployed using production-grade Docker techniques.

Instead of running services individually, the complete application is deployed using Docker Compose, Nginx Reverse Proxy, isolated Docker networks, persistent volumes, and MongoDB Atlas integration.


✨ Key Features

πŸ‘₯ Social Media Platform

  • User Authentication
  • JWT Authorization
  • Create Posts
  • Like & Comment
  • Friend System
  • Responsive UI

βš› Frontend

  • React.js
  • Redux Toolkit
  • Material UI
  • Responsive Design
  • Protected Routes
  • API Integration

πŸš€ Backend

  • Node.js
  • Express.js
  • JWT Authentication
  • REST APIs
  • Secure Middleware
  • MongoDB Integration

🐳 Production Docker Features

  • Multi-stage Docker Build
  • Docker Compose
  • Non-root Containers
  • Health Checks
  • Docker Networks
  • Persistent Volumes
  • Environment Variables
  • Reverse Proxy
  • Production Ready Images

🌐 Live Deployment

Frontend

https://sociopedia-app.vercel.app


Backend API

https://urchin-app-v2nci.ondigitalocean.app


πŸ— High Level Architecture

flowchart LR

User["πŸ‘¨β€πŸ’» User"]

Browser["🌐 Browser"]

Nginx["🟒 Nginx Reverse Proxy"]

Frontend["βš› React Frontend"]

Backend["πŸš€ Express API"]

Atlas["☁ MongoDB Atlas"]

Browser --> Nginx

Nginx --> Frontend

Nginx --> Backend

Backend --> Atlas

style User fill:#2563eb,color:#fff
style Browser fill:#0ea5e9,color:#fff
style Nginx fill:#009639,color:#fff
style Frontend fill:#61DAFB,color:#000
style Backend fill:#339933,color:#fff
style Atlas fill:#13AA52,color:#fff
Loading

🏒 Enterprise System Architecture

flowchart TD

Client["πŸ‘¨ User"]

Internet["🌍 Internet"]

Nginx["🟒 Nginx Reverse Proxy"]

React["βš› React Container"]

Express["πŸš€ Node API Container"]

Docker["🐳 Docker Network"]

Mongo["☁ MongoDB Atlas"]

Client --> Internet

Internet --> Nginx

Nginx --> React

Nginx --> Express

React --> Express

Express --> Docker

Docker --> Mongo

style Client fill:#2563eb,color:#fff
style Internet fill:#0891b2,color:#fff
style Nginx fill:#009639,color:#fff
style React fill:#61DAFB,color:#000
style Express fill:#339933,color:#fff
style Docker fill:#2496ED,color:#fff
style Mongo fill:#13AA52,color:#fff
Loading

πŸ”„ Request Flow

flowchart LR

User["πŸ‘¨ User"]

Browser["🌐 Browser"]

Nginx["🟒 Nginx"]

Frontend["βš› React"]

API["πŸš€ Express"]

Database["☁ MongoDB Atlas"]

Response["πŸ“„ JSON Response"]

User --> Browser

Browser --> Nginx

Nginx --> Frontend

Frontend --> API

API --> Database

Database --> Response

Response --> Frontend

Frontend --> User

style User fill:#2563eb,color:#fff
style Browser fill:#0891b2,color:#fff
style Nginx fill:#009639,color:#fff
style Frontend fill:#61DAFB,color:#000
style API fill:#339933,color:#fff
style Database fill:#13AA52,color:#fff
style Response fill:#9333ea,color:#fff
Loading

πŸ“Έ Application Preview

πŸŒ™ Dark Theme UI


πŸ—„ Database Schema



🐳 Docker Architecture

Sociopedia is fully containerized using Docker following production-ready best practices. Each service runs in its own isolated container while communicating through a dedicated Docker network.

πŸš€ Docker Container Architecture

flowchart LR

Developer["πŸ‘¨β€πŸ’» Developer"]

Dockerfile["πŸ“„ Dockerfile"]

Build["πŸ”¨ Docker Build"]

Frontend["βš› React Image"]

Backend["πŸš€ Node Image"]

Compose["🐳 Docker Compose"]

Network["🌐 Docker Network"]

Containers["πŸ“¦ Running Containers"]

Developer --> Dockerfile

Dockerfile --> Build

Build --> Frontend

Build --> Backend

Frontend --> Compose

Backend --> Compose

Compose --> Network

Network --> Containers

style Developer fill:#2563eb,color:#fff
style Dockerfile fill:#16a34a,color:#fff
style Build fill:#9333ea,color:#fff
style Frontend fill:#61DAFB,color:#000
style Backend fill:#339933,color:#fff
style Compose fill:#2496ED,color:#fff
style Network fill:#0891b2,color:#fff
style Containers fill:#f97316,color:#fff
Loading

πŸ— Multi-Stage Docker Build

The frontend is built using a multi-stage Docker build to reduce image size and improve production performance.

flowchart LR

Source["πŸ“ Source Code"]

Node["βš™ Node Builder"]

Install["πŸ“¦ npm install"]

Build["πŸ”¨ npm run build"]

Nginx["🟒 Nginx Image"]

Production["πŸš€ Production Container"]

Source --> Node

Node --> Install

Install --> Build

Build --> Nginx

Nginx --> Production

style Source fill:#2563eb,color:#fff
style Node fill:#339933,color:#fff
style Install fill:#16a34a,color:#fff
style Build fill:#9333ea,color:#fff
style Nginx fill:#009639,color:#fff
style Production fill:#2496ED,color:#fff
Loading

🌍 Docker Compose Architecture

Docker Compose orchestrates all application services using a single configuration file.

flowchart TD

Compose["🐳 Docker Compose"]

Frontend["βš› React"]

Backend["πŸš€ Express"]

Nginx["🟒 Nginx"]

Mongo["☁ MongoDB Atlas"]

Compose --> Frontend

Compose --> Backend

Compose --> Nginx

Backend --> Mongo

Nginx --> Frontend

Nginx --> Backend

style Compose fill:#2496ED,color:#fff
style Frontend fill:#61DAFB,color:#000
style Backend fill:#339933,color:#fff
style Nginx fill:#009639,color:#fff
style Mongo fill:#13AA52,color:#fff
Loading

🌐 Nginx Reverse Proxy

Nginx acts as the entry point for every incoming request and intelligently routes traffic to the appropriate service.

Request Routing

flowchart LR

User["πŸ‘¨ User"]

Nginx["🟒 Nginx"]

React["βš› React"]

API["πŸš€ Express API"]

Atlas["☁ MongoDB Atlas"]

User --> Nginx

Nginx -->|"/"| React

Nginx -->|"/api"| API

API --> Atlas

style User fill:#2563eb,color:#fff
style Nginx fill:#009639,color:#fff
style React fill:#61DAFB,color:#000
style API fill:#339933,color:#fff
style Atlas fill:#13AA52,color:#fff
Loading

πŸ”’ Container Security

Production containers follow Docker security best practices.

flowchart TB

Docker["🐳 Docker"]

User["πŸ‘€ Non-root User"]

Health["❀️ Health Check"]

Env["πŸ” Environment Variables"]

Network["🌐 Private Network"]

Docker --> User

Docker --> Health

Docker --> Env

Docker --> Network

style Docker fill:#2496ED,color:#fff
style User fill:#16a34a,color:#fff
style Health fill:#dc2626,color:#fff
style Env fill:#9333ea,color:#fff
style Network fill:#0891b2,color:#fff
Loading

Security Features

  • βœ… Non-root containers
  • βœ… Environment variables
  • βœ… Health check endpoint
  • βœ… Docker network isolation
  • βœ… Production images
  • βœ… Lightweight containers

🌐 Docker Networking

All services communicate through a dedicated isolated Docker bridge network.

flowchart LR

Client["πŸ‘¨ User"]

Bridge["🌐 Docker Bridge Network"]

Nginx["🟒 Nginx"]

Frontend["βš› React"]

Backend["πŸš€ Express"]

Mongo["☁ MongoDB Atlas"]

Client --> Bridge

Bridge --> Nginx

Nginx --> Frontend

Nginx --> Backend

Backend --> Mongo

style Client fill:#2563eb,color:#fff
style Bridge fill:#0891b2,color:#fff
style Nginx fill:#009639,color:#fff
style Frontend fill:#61DAFB,color:#000
style Backend fill:#339933,color:#fff
style Mongo fill:#13AA52,color:#fff
Loading

πŸ’Ύ Persistent Storage

Application data remains safe using Docker volumes.

flowchart LR

Container["πŸ“¦ Containers"]

Volume["πŸ’Ύ Docker Volume"]

Database["πŸ—„ Local MongoDB"]

Container --> Volume

Volume --> Database

style Container fill:#2496ED,color:#fff
style Volume fill:#9333ea,color:#fff
style Database fill:#13AA52,color:#fff
Loading

☁ MongoDB Atlas Integration

The backend securely communicates with MongoDB Atlas using encrypted cloud connections.

flowchart LR

Express["πŸš€ Express API"]

TLS["πŸ”’ Secure TLS"]

Atlas["☁ MongoDB Atlas"]

Collections["πŸ“‚ Collections"]

Express --> TLS

TLS --> Atlas

Atlas --> Collections

style Express fill:#339933,color:#fff
style TLS fill:#dc2626,color:#fff
style Atlas fill:#13AA52,color:#fff
style Collections fill:#9333ea,color:#fff
Loading

πŸ“‚ Project Structure

docker-project/
β”‚
β”œβ”€β”€ client/
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── package.json
β”‚
β”œβ”€β”€ nginx/
β”‚   β”œβ”€β”€ nginx.conf
β”‚   └── Dockerfile
β”‚
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ .env
β”œβ”€β”€ README.md
└── dark_theme_ss.png

πŸ›  Technology Stack

Frontend

  • React.js
  • Redux Toolkit
  • Material UI

Backend

  • Node.js
  • Express.js
  • MongoDB
  • Mongoose

DevOps

  • Docker
  • Docker Compose
  • Nginx
  • Multi-Stage Docker Build
  • Docker Networks
  • Docker Volumes

Cloud

  • MongoDB Atlas
  • DigitalOcean
  • Vercel


πŸš€ Future Enhancements

The following features can be added in future versions:

  • πŸ”„ GitHub Actions for automated CI/CD
  • ☸️ Kubernetes container orchestration
  • πŸ“Š Prometheus & Grafana monitoring
  • πŸ”’ HTTPS with Let's Encrypt
  • 🌍 Multi-container production deployment
  • πŸ“¦ Image optimization and caching
  • πŸ“ˆ Application performance monitoring
  • πŸ” OAuth Authentication (Google/GitHub)
  • πŸ“± Progressive Web App (PWA) support

🎯 Key Learning Outcomes

Through this project, I gained practical experience in:

  • 🐳 Building production-ready Docker images
  • πŸ“¦ Multi-stage Docker builds
  • 🌐 Configuring Nginx as a reverse proxy
  • πŸ” Running containers as a non-root user
  • ❀️ Implementing container health checks
  • 🌍 Managing Docker networks
  • πŸ’Ύ Using Docker volumes for persistent storage
  • ☁️ Connecting applications to MongoDB Atlas
  • βš™οΈ Managing multi-container applications with Docker Compose
  • πŸ“ Organizing production-ready project structures

πŸ‘¨β€πŸ’» Author

Saurav Kumar

B.Tech Computer Science Engineering

πŸš€ Full Stack Developer | DevOps Enthusiast

Connect with Me


🀝 Contributing

Contributions, issues, and feature requests are welcome.

If you'd like to improve this project:

  1. Fork the repository
  2. Create a new feature branch
  3. Commit your changes
  4. Push your branch
  5. Open a Pull Request

⭐ Support

If you found this project helpful, please consider giving it a ⭐ Star on GitHub.

Your support motivates me to build more production-ready open-source projects.


πŸ“œ License

This project is licensed under the MIT License.


πŸš€ Thanks for Visiting!

Built with ❀️ using React, Node.js, Express, MongoDB, Docker & Nginx

⭐ Don't forget to Star this repository if you found it useful!

About

Production-ready Dockerized MERN social media application with Nginx reverse proxy, Docker Compose, MongoDB Atlas, health checks, and multi-stage builds.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages