Skip to content

AbdolHamidDev/HooksDream

Repository files navigation

HooksDream Logo

HooksDream

Production-grade social media platform built with microservices architecture. Real-time communication, AI automation, and modern UX.

Live Demo β€’ Documentation β€’ Report Bug β€’ Request Feature


Table of Contents


Overview

HooksDream is a full-stack social media platform demonstrating production-grade software engineering practices. Built with a microservices architecture separating concerns across Node.js (core API), React (frontend), and Python (AI/automation) services.

Key Characteristics:

  • Microservices architecture with clear service boundaries
  • Real-time bidirectional communication via WebSockets
  • JWT-based authentication with OTP verification
  • Media processing pipeline with Cloudinary + Sharp
  • AI-powered automation layer (Python/FastAPI)
  • PWA-enabled with offline support
  • Internationalization (i18n) ready
  • Comprehensive error handling and rate limiting

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Client Layer                         β”‚
β”‚  React 18 + TypeScript + Vite + Tailwind CSS + PWA         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚               β”‚               β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
   β”‚  REST   β”‚    β”‚ WebSocketβ”‚   β”‚  Push   β”‚
   β”‚   API   β”‚    β”‚  Socket  β”‚   β”‚Notify   β”‚
   β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚              β”‚
   β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”
   β”‚   API Gateway Layer    β”‚
   β”‚  (Rate Limit + Auth)   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”
       β”‚               β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Node.js β”‚    β”‚  Python       β”‚
  β”‚ Backend │◄──►│  Backend      β”‚
  β”‚ Express β”‚    β”‚  FastAPI      β”‚
  β”‚ + MongoDBβ”‚   β”‚  (AI/Bot)     β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
  β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ Cloudinary  β”‚
  β”‚ (Media CDN) β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Design Principles:

  • Separation of Concerns: Each service handles a specific domain
  • Stateless Services: Horizontal scaling ready
  • Event-Driven: Real-time updates via Socket.IO
  • Async Processing: Background jobs for media and notifications

Tech Stack

Frontend

Technology Purpose Version
React UI Framework 18.x
TypeScript Type Safety 5.8
Vite Build Tool Latest
Tailwind CSS Styling Latest
shadcn/ui Component Library Latest
TanStack Query Data Fetching & Cache Latest
Zustand State Management Latest
Socket.IO Client Real-time Communication Latest
React Hook Form + Zod Form Management & Validation Latest
i18next Internationalization Latest
Framer Motion Animations Latest
Vite PWA Plugin Progressive Web App Latest

Backend (Node.js)

Technology Purpose Version
Express.js Web Framework 4.x
MongoDB + Mongoose Database & ODM Latest
Socket.IO Real-time Communication Latest
JWT (jsonwebtoken) Authentication Latest
Cloudinary + Multer + Sharp Media Upload & Processing Latest
Node-cron Scheduled Tasks Latest
Web Push Push Notifications Latest
Express Rate Limit API Protection Latest
Cheerio Web Scraping Latest

Backend (Python)

Technology Purpose Version
FastAPI API Framework Latest
AsyncIO Async Task Scheduling Latest
Unsplash API Image Sourcing -
Bot Service Social Media Automation -

Infrastructure

Technology Purpose
Docker Containerization
MongoDB Atlas Managed Database
Render Backend Hosting
Vercel Frontend Hosting
Cloudinary Media CDN & Processing

Project Structure

HooksDream/
β”œβ”€β”€ backend/                    # Node.js API Service
β”‚   β”œβ”€β”€ server.js              # Entry point, server initialization
β”‚   β”œβ”€β”€ routes/                # REST API routes
β”‚   β”‚   β”œβ”€β”€ auth.js            # Authentication (register, login, OTP)
β”‚   β”‚   β”œβ”€β”€ users.js           # User management
β”‚   β”‚   β”œβ”€β”€ posts.js           # Post CRUD operations
β”‚   β”‚   β”œβ”€β”€ comments.js        # Comment system
β”‚   β”‚   β”œβ”€β”€ follow.js          # Follow/unfollow logic
β”‚   β”‚   β”œβ”€β”€ chat.js            # Messaging endpoints
β”‚   β”‚   β”œβ”€β”€ notifications.js   # Notification system
β”‚   β”‚   β”œβ”€β”€ search.js          # Search functionality
β”‚   β”‚   β”œβ”€β”€ storyRoutes.js     # Stories (ephemeral content)
β”‚   β”‚   β”œβ”€β”€ friendDiscovery.js # Friend recommendations
β”‚   β”‚   └── botRoutes.js       # Bot integration
β”‚   β”œβ”€β”€ controllers/           # Business logic layer
β”‚   β”œβ”€β”€ models/                # Mongoose schemas
β”‚   β”œβ”€β”€ middleware/            # Auth, validation, rate limiting
β”‚   β”œβ”€β”€ services/              # Background services
β”‚   β”œβ”€β”€ socket/                # Socket.IO handlers
β”‚   └── utils/                 # Helper functions
β”‚
β”œβ”€β”€ frontend/                   # React Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/             # Route-level components
β”‚   β”‚   β”‚   β”œβ”€β”€ FeedPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ CreatePostPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ PostDetailPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProfilePage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ EditProfilePage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ StoriesPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MessagesPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ NotificationsPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ SearchPage.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ FriendPageRQ.tsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MobileFriendPage.tsx
β”‚   β”‚   β”‚   └── TermsOfUse.tsx
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/          # Login, Register, OTP
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/          # Chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ comment/       # Comments
β”‚   β”‚   β”‚   β”œβ”€β”€ createpost/    # Post creation
β”‚   β”‚   β”‚   β”œβ”€β”€ feed/          # Feed components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/        # Layout shell
β”‚   β”‚   β”‚   β”œβ”€β”€ modals/        # Modal dialogs
β”‚   β”‚   β”‚   β”œβ”€β”€ navigation/    # Navigation bar
β”‚   β”‚   β”‚   β”œβ”€β”€ notifications/ # Notification components
β”‚   β”‚   β”‚   β”œβ”€β”€ posts/         # Post components
β”‚   β”‚   β”‚   β”œβ”€β”€ profile/       # Profile components
β”‚   β”‚   β”‚   β”œβ”€β”€ search/        # Search components
β”‚   β”‚   β”‚   β”œβ”€β”€ story/         # Story components
β”‚   β”‚   β”‚   └── ui/            # shadcn/ui primitives
β”‚   β”‚   β”œβ”€β”€ contexts/          # React Context providers
β”‚   β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”œβ”€β”€ store/             # Zustand stores
β”‚   β”‚   β”œβ”€β”€ locales/           # i18n translations
β”‚   β”‚   └── utils/             # Utility functions
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.ts
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   └── tsconfig.json
β”‚
β”œβ”€β”€ pyBackend/                  # Python AI/Automation Service
β”‚   β”œβ”€β”€ main.py                # FastAPI application entry
β”‚   β”œβ”€β”€ config.py              # Configuration management
β”‚   β”œβ”€β”€ requirements.txt       # Python dependencies
β”‚   β”œβ”€β”€ Dockerfile             # Container config
β”‚   β”œβ”€β”€ docker-compose.yml     # Service orchestration
β”‚   β”œβ”€β”€ routers/
β”‚   β”‚   └── bot_router.py      # Bot API endpoints
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ unsplash_service.py # Unsplash API integration
β”‚   β”‚   └── bot_service.py      # Marcin bot automation
β”‚   └── data/                  # Data storage
β”‚
β”œβ”€β”€ docs/                      # Documentation
β”‚   β”œβ”€β”€ CONTRIBUTING.md
β”‚   β”œβ”€β”€ DEPLOYMENT.md
β”‚   └── SECURITY.md
β”‚
β”œβ”€β”€ Screenshots/               # UI screenshots
β”œβ”€β”€ docker-compose.yml         # Multi-service orchestration
β”œβ”€β”€ LICENSE                    # MIT License
└── README.md                  # This file

Core Features

Social Media Core

  • Authentication & Authorization β€” JWT-based auth with OTP verification flow
  • Posts β€” Full CRUD with likes, comments, and sharing
  • Stories β€” Ephemeral content (24h TTL) with auto-archiving
  • User Profiles β€” Editable profiles with avatar and cover images
  • Social Graph β€” Follow system with friend request workflow
  • Real-time Chat β€” Instant messaging via Socket.IO with typing indicators
  • Notifications β€” Real-time alerts for engagement events
  • Search β€” Full-text search across users and posts
  • Discovery β€” Algorithmic friend suggestions

Advanced Features

  • Media Pipeline β€” Image/video upload with Cloudinary CDN + Sharp processing
  • Push Notifications β€” Web Push API integration
  • Internationalization β€” Multi-language support via i18next
  • PWA β€” Installable with offline capabilities
  • Responsive Design β€” Mobile-first, optimized for all viewports
  • Rate Limiting β€” API protection against abuse
  • Real-time Updates β€” Live feed updates via WebSockets

AI & Automation (Python Backend)

  • Marcin Bot β€” Automated social interactions (likes, follows, comments)
  • Unsplash Integration β€” Curated high-quality image sourcing
  • Scheduled Tasks β€” Automated posting and interactions
  • Keep-alive Service β€” Prevents cold starts on Render

Getting Started

Prerequisites

  • Node.js >= 20.x
  • Python >= 3.9
  • MongoDB (local or Atlas)
  • Cloudinary account
  • Unsplash API key (optional)

Installation

1. Clone the repository

git clone https://github.com/AbdolHamidDev/HooksDream.git
cd HooksDream

2. Start with Docker (Recommended) πŸš€

# Start all services (MongoDB + Backend + Frontend)
docker compose up -d

# View logs
docker compose logs -f

# Access the app
# Frontend: http://localhost:5173
# Backend: http://localhost:5000
# MongoDB: mongodb://localhost:27017

See DOCKER_DEV.md for detailed Docker setup and troubleshooting.

3. Or run locally with npm:

# Install all dependencies
npm run install:all

# Start both backend and frontend
npm run dev

4. Or manual setup:

Backend (Node.js)

cd backend
npm install

# Configure environment
cp .env.example .env
# Edit .env with your MongoDB URI, JWT secret, and Cloudinary credentials

# Start development server
npm run dev

Frontend (React)

cd frontend
npm install

# Configure environment
cp .env.example .env
# Set VITE_API_URL and VITE_SOCKET_URL

# Start development server
npm run dev

Python Backend

cd pyBackend
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

pip install -r requirements.txt

# Configure environment
cp .env.example .env

# Start server
python run.py
# or
uvicorn main:app --reload

API Reference

Authentication

Method Endpoint Description
POST /api/auth/register User registration
POST /api/auth/login User login
POST /api/auth/verify-otp OTP verification
GET /api/auth/me Get current user

Users

Method Endpoint Description
GET /api/users/:id Get user profile
PUT /api/users/:id Update user profile
GET /api/users/:id/posts Get user posts

Posts

Method Endpoint Description
GET /api/posts Get feed
POST /api/posts Create post
PUT /api/posts/:id Update post
DELETE /api/posts/:id Delete post
POST /api/posts/:id/like Like/unlike post

Comments

Method Endpoint Description
GET /api/comments/:postId Get comments
POST /api/comments Add comment
DELETE /api/comments/:id Delete comment

Chat

Method Endpoint Description
GET /api/chat/conversations Get conversations
GET /api/chat/messages/:userId Get messages
POST /api/chat/send Send message

Stories

Method Endpoint Description
GET /api/stories Get active stories
POST /api/stories Create story
DELETE /api/stories/:id Delete story

Notifications

Method Endpoint Description
GET /api/notifications Get notifications
PUT /api/notifications/:id/read Mark as read

Search

Method Endpoint Description
GET /api/search/users Search users
GET /api/search/posts Search posts

Bot (Python Backend)

Method Endpoint Description
POST /api/bot/automate Run automation
GET /api/bot/status Bot status
POST /api/bot/schedule Schedule task

Socket.IO Events

Client β†’ Server

  • join β€” Join chat room
  • sendMessage β€” Send message
  • typing β€” Typing indicator
  • markAsRead β€” Mark messages as read

Server β†’ Client

  • newMessage β€” New message received
  • userTyping β€” User typing status
  • newNotification β€” New notification
  • onlineUsers β€” Online users list

Development

Scripts

Backend:

npm start          # Production server
npm run dev        # Development with nodemon
npm test           # Run test suite

Frontend:

npm run dev        # Development server (Vite)
npm run build      # Production build
npm run preview    # Preview production build
npm run lint       # ESLint check

Python Backend:

python run.py      # Production server
uvicorn main:app --reload  # Development with auto-reload

Environment Variables

Backend

Variable Description Required
MONGODB_URI MongoDB connection string Yes
JWT_SECRET JWT signing secret Yes
CLOUDINARY_URL Cloudinary configuration Yes
PORT Server port No (default: 5000)
NODE_ENV Environment No

Frontend

Variable Description Required
VITE_API_URL Backend API URL Yes
VITE_SOCKET_URL Socket.IO server URL Yes

Python Backend

Variable Description Required
NODE_BACKEND_URL Node.js backend URL Yes
UNSPLASH_ACCESS_KEY Unsplash API key No
BOT_ENABLED Enable/disable bot No
ENVIRONMENT Environment No

Deployment

Render (Backend Services)

  • Node.js Backend: Deploy from backend/ directory
  • Python Backend: Deploy from pyBackend/ directory
  • Use provided Dockerfile or Render Nixpacks

Vercel (Frontend)

  • Build command: npm run build
  • Output directory: dist
  • Configure environment variables for production API URLs

MongoDB Atlas

  • Create cluster and update MONGODB_URI in backend environment
  • Enable IP whitelist for production

Contributing

Contributions are welcome. Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'feat: add feature')
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

Guidelines:

  • Follow existing code style and conventions
  • Write clear, descriptive commit messages (Conventional Commits)
  • Update documentation for new features
  • Add tests for critical functionality
  • Ensure all checks pass before submitting

See CONTRIBUTING.md for detailed guidelines.


Roadmap

  • Core social media features (posts, comments, likes)
  • Real-time chat and notifications
  • Stories functionality with auto-archive
  • Python backend for AI automation
  • PWA support
  • Docker containerization
  • Dark mode
  • Video calls (WebRTC)
  • Group chat
  • Post scheduling
  • Advanced analytics dashboard
  • Content moderation AI
  • Mobile apps (React Native)
  • GraphQL API layer
  • Comprehensive test coverage

License

This project is licensed under the MIT License. See LICENSE for details.


Support

If you find this project useful, please consider:

  • ⭐ Starring the repository
  • 🍴 Forking and contributing
  • πŸ› Reporting bugs via Issues
  • πŸ’¬ Sharing with the community

Built with ❀️ by AbdolHamidDev

GitHub β€’ Live Demo β€’ β˜• Buy Me a Coffee