A full-stack, Project real-time chat application built with React, Express, Socket.IO, and MongoDB β featuring secure authentication, media sharing, and a Dockerized monolith deployment.
β¨ Features
π Authentication & Authorization β Secure sign-up/sign-in via Clerk, with JWT-protected API routes and webhook-synced user data.
β‘ Real-Time Messaging β Bi-directional communication powered by Socket.IO; messages appear instantly without page refresh.
πΌοΈ Media Sharing β Send images and files in conversations via Multer + ImageKit.
π¬ Conversation Sidebar β View all active conversations and online users at a glance.
π¨ Theme Support β Multiple UI themes switchable at runtime via React Context.
πΌοΈ Wallpaper Customization β Personalized chat backgrounds managed through a dedicated WallpaperContext.
ποΈ Read Receipts β Messages show delivery and seen status so users know when their message has been read.
π’ Online Indicators β Real-time presence dots show which users are currently active in the sidebar.
βοΈ Typing Indicators β Live "is typingβ¦" feedback appears while the other user composes a message.
π Auth State Sync β Zustand-powered global auth store that stays in sync with Clerk's session lifecycle.
π Cron Jobs β Automated background tasks (e.g., cleanup) running in production via the cron library.
π SPA + API Monolith β Express serves both the REST API and the Vite-built React frontend from a single server.
π³ Docker Support β Multi-stage Dockerfile for optimized production images (frontend build β backend build β lean runtime).
π Toast Notifications β User-friendly feedback for actions using react-hot-toast.
β€οΈ Health Check Endpoint β /health route for uptime monitoring and container orchestration.
| Technology | Purpose |
|---|---|
| React 19 | UI framework |
| Vite 8 | Build tool & dev server |
| React Router v8 | Client-side routing |
| Clerk React | Authentication UI & session management |
| Zustand | Global state management |
| Socket.IO Client | Real-time WebSocket communication |
| HeroUI + Tailwind CSS v4 | Component library & utility-first styling |
| Axios | HTTP client |
| react-hot-toast | Toast notifications |
| Lucide React | Icon library |
| Technology | Purpose |
|---|---|
| Node.js + Express 5 | HTTP server & REST API |
| Socket.IO | WebSocket server |
| MongoDB + Mongoose | Database & ODM |
| Clerk Express / Backend | Auth middleware & webhook verification |
| Multer | Multipart file upload handling |
| ImageKit | Cloud image storage & CDN |
| Cron | Scheduled background jobs |
| dotenv | Environment variable management |
| CORS | Cross-origin request handling |
| Technology | Purpose |
|---|---|
| Docker (multi-stage) | Containerized build & deployment |
| Nodemon | Development hot-reload |
| ESLint | Code linting |
CYVION-CHATAPP/
βββ backend/
β βββ dist/ # Compiled output (generated by npm run build)
β βββ src/
β β βββ controllers/ # Route handler logic (auth, message)
β β βββ lib/ # db.js, socket.js, cron.js
β β βββ middleware/ # auth.middleware, upload.middleware
β β βββ models/ # Mongoose schemas (user.model)
β β βββ routes/ # auth.route, message.route
β β βββ seeds/ # Database seed scripts
β β βββ webhooks/ # clerk.webhook handler
β β βββ index.js # Express app entry point
β βββ .env
β βββ package.json
β
βββ frontend/
β βββ public/ # Static assets
β βββ src/
β β βββ components/ # Reusable UI components
β β βββ context/ # ThemeContext, WallpaperContext
β β βββ data/ # Static data / constants
β β βββ hooks/ # Custom React hooks
β β βββ lib/ # Utility functions / axios config
β β βββ pages/ # ChatPage, AuthPage
β β βββ store/ # Zustand stores (useAuthStore)
β β βββ styles/ # Global styles
β β βββ App.jsx # Root component with routing
β β βββ index.css # Base CSS
β β βββ main.jsx # React DOM entry point
β βββ .env
β βββ index.html
β βββ eslint.config.js
β βββ vite.config.js
β βββ package.json
β
βββ .dockerignore
βββ .gitignore
βββ Dockerfile # Multi-stage production build
| Method | Route | Description |
|---|---|---|
GET |
/api/auth/check |
Verify authenticated user (protected) |
| Method | Route | Description |
|---|---|---|
GET |
/api/messages/users |
Get all users for sidebar |
GET |
/api/messages/conversations |
Get conversation list for current user |
GET |
/api/messages/:id |
Get message history with a specific user |
POST |
/api/messages/send/:id |
Send a message (supports media upload) |
| Method | Route | Description |
|---|---|---|
GET |
/health |
Health check |
POST |
/api/webhooks/clerk |
Clerk webhook handler |
PORT=3001
MONGODB_URI=your_mongodb_connection_string
FRONTEND_URL=http://localhost:5173
NODE_ENV=development
# Clerk
CLERK_SECRET_KEY=your_clerk_secret_key
CLERK_WEBHOOK_SECRET=your_clerk_webhook_secret
# ImageKit
IMAGEKIT_PUBLIC_KEY=your_imagekit_public_key
IMAGEKIT_PRIVATE_KEY=your_imagekit_private_key
IMAGEKIT_URL_ENDPOINT=your_imagekit_url_endpointVITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
VITE_API_URL=http://localhost:3001- Node.js v22+
- MongoDB (local or Atlas)
- A Clerk account
- An ImageKit account
- Docker (optional, for containerized runs)
1. Clone the repository
git clone https://github.com/Anmol1578/Cyvion-Chat
cd Cyvion-Chat2. Set up the backend
cd backend
cp .env.example .env # fill in your values
npm install
npm run dev3. Set up the frontend
cd frontend
cp .env.example .env # fill in your values
npm install
npm run devFrontend runs at http://localhost:5173 Β· Backend runs at http://localhost:3001
docker build \
--build-arg VITE_CLERK_PUBLISHABLE_KEY=your_key \
-t chatapp .
docker run -p 3001:3001 --env-file backend/.env chatappApp is served at http://localhost:3001
- All message routes are protected by
protectRoutemiddleware (Clerk JWT verification) - Clerk webhooks use raw body parsing + signature verification to prevent spoofing
- CORS is restricted to the configured
FRONTEND_URL - Docker runtime uses a non-root
nodeuser - Production cron jobs only activate when
NODE_ENV=production
This project is licensed under the ISC License.
β If you found this project helpful, consider giving it a star!