Skip to content

About

πŸ’¬ Real-time chat app with Socket.IO, Clerk auth, read receipts, typing indicators & media sharing. Built with React, Express & MongoDB.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Cyvion β€” Real-Time Messaging Platform

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.


πŸš€ Live Demo

https://cyvion-chat.onrender.com


πŸ“Έ Screenshots

Screenshot 2026-07-05 213613 Screenshot 2026-07-05 213646 Screenshot 2026-07-05 213713 Screenshot 2026-07-05 213744 Screenshot 2026-07-05 213818 Screenshot 2026-07-05 213853

✨ 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.


πŸ› οΈ Tech Stack

Frontend

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

Backend

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

DevOps

Technology Purpose
Docker (multi-stage) Containerized build & deployment
Nodemon Development hot-reload
ESLint Code linting

πŸ“ Project Structure

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

πŸ”Œ API Endpoints

Auth

Method Route Description
GET /api/auth/check Verify authenticated user (protected)

Messages

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)

System

Method Route Description
GET /health Health check
POST /api/webhooks/clerk Clerk webhook handler

βš™οΈ Environment Variables

Backend (.env)

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_endpoint

Frontend (.env)

VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
VITE_API_URL=http://localhost:3001

πŸƒ Getting Started

Prerequisites

  • Node.js v22+
  • MongoDB (local or Atlas)
  • A Clerk account
  • An ImageKit account
  • Docker (optional, for containerized runs)

Local Development

1. Clone the repository

git clone https://github.com/Anmol1578/Cyvion-Chat
cd Cyvion-Chat

2. Set up the backend

cd backend
cp .env.example .env   # fill in your values
npm install
npm run dev

3. Set up the frontend

cd frontend
cp .env.example .env   # fill in your values
npm install
npm run dev

Frontend runs at http://localhost:5173 Β· Backend runs at http://localhost:3001


🐳 Docker (Production)

docker build \
  --build-arg VITE_CLERK_PUBLISHABLE_KEY=your_key \
  -t chatapp .

docker run -p 3001:3001 --env-file backend/.env chatapp

App is served at http://localhost:3001


πŸ”’ Security Highlights

  • All message routes are protected by protectRoute middleware (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 node user
  • Production cron jobs only activate when NODE_ENV=production

πŸ“„ License

This project is licensed under the ISC License.


⭐ If you found this project helpful, consider giving it a star!

About

πŸ’¬ Real-time chat app with Socket.IO, Clerk auth, read receipts, typing indicators & media sharing. Built with React, Express & MongoDB.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages