A modern, scalable social media platform built with microservices architecture.
┌─────────────────┐
│ React Client │
└─────────┬───────┘
│
┌─────────▼─────────┐
│ API Gateway │
│ Port: 3000 │
└─────────┬─────────┘
│
┌─────┼─────┐
│ │ │
┌───▼─┐ ┌─▼──┐ ┌▼───┐
│User │ │Post│ │Media│
│3001 │ │3002│ │3003 │
└─────┘ └────┘ └─────┘
Services:
- API Gateway: Central routing, authentication, rate limiting
- User Service: Authentication, user management, profiles
- Post Service: Content creation, CRUD operations, social features
- Media Service: File upload, Cloudinary integration, media optimization
Frontend: React 18, TypeScript, Vite, Tailwind CSS, Framer Motion
Backend: Node.js, Express.js, JWT Authentication
Database: MongoDB Atlas, Redis (Caching)
Storage: Cloudinary (Media)
DevOps: Docker, GitHub Actions
- 🔐 JWT Authentication with refresh tokens
- 👥 User registration, login, and profile management
- 📱 Create, read, update, delete posts
- 🖼️ Media upload with Cloudinary optimization
- 🔍 Post search functionality
- ⚡ Redis caching for performance
- 🔄 Event-driven architecture with RabbitMQ
- 📊 Real-time updates and interactions
- Node.js 18+
- MongoDB
- Redis
- Cloudinary account
# Clone repository
git clone https://github.com/Baladitya123/socialhub.git
cd socialhub
# Install frontend dependencies
cd frontend && npm install
# Install backend dependencies
cd ../backend
for service in api-gateway user-service post-service media-service search-service; do
cd $service && npm install && cd ..
doneCreate .env files in each backend service:
# Database
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/socialhub
# Authentication
JWT_SECRET=your-secret-key
JWT_REFRESH_SECRET=your-refresh-secret
# Redis & RabbitMQ
REDIS_URL=redis://localhost:6379
RABBITMQ_URL=amqp://localhost:5672
# Cloudinary (media-service only)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Service URLs
USER_SERVICE_URL=http://localhost:3001
POST_SERVICE_URL=http://localhost:3002
MEDIA_SERVICE_URL=http://localhost:3003
SEARCH_SERVICE_URL=http://localhost:3004Frontend .env:
VITE_API_BASE_URL=http://localhost:3000# Terminal 1: API Gateway
cd backend/api-gateway && npm start
# Terminal 2: User Service
cd backend/user-service && npm start
# Terminal 3: Post Service
cd backend/post-service && npm start
# Terminal 4: Media Service
cd backend/media-service && npm start
# Terminal 5: Search Service
cd backend/search-service && npm start
# Terminal 6: Frontend
cd frontend && npm run devAccess: http://localhost:5173
POST /v1/auth/register- User registrationPOST /v1/auth/login- User loginGET /v1/auth/me- Get current user
GET /v1/posts/get-posts- Get all posts (paginated)POST /v1/posts/create-post- Create new postDELETE /v1/posts/:id- Delete post
POST /v1/media/upload- Upload media fileGET /v1/media/:id- Get media by ID
GET /v1/search/posts?query=- Search posts
cd backend
docker-compose up -d- Frontend: Deploy to Vercel/Netlify
- Backend: Deploy to Heroku/Railway
- Database: MongoDB Atlas
- Cache: Redis Cloud
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ by Baladitya123
⭐ Star this repository if you found it helpful!