π¬ FortiComm (MERN + Socket.io)
A full-stack real-time chat application built using the MERN stack β MongoDB, Express, React, Node.js β with Socket.io for instant messaging and TailwindCSS for a clean, modern UI.
π Features
β‘ Real-time messaging (via Socket.io)
π JWT Authentication
πΎ MongoDB database (Mongoose)
π¨ Beautiful UI with TailwindCSS
π Instant message updates without page reloads
π REST APIs using Express
π§© Modular & scalable folder structure
π§ Tech Stack
Layer Technology
Frontend React + Vite + TailwindCSS Backend Node.js + Express Database MongoDB + Mongoose Real-Time Socket.io Authentication JWT Tools Axios, dotenv, nodemon
π Folder Structure
chat-app/ β βββ client/ # Frontend β βββ src/ β β βββ components/ # Chat components β β βββ pages/ # App screens (Login, Chat) β β βββ assets/ β βββ package.json β βββ server/ # Backend β βββ controllers/ # Logic for requests β βββ models/ # Mongoose schemas β βββ routes/ # API routes β βββ socket.js # Socket.io setup β βββ server.js # Main entry point β βββ package.json β βββ .env # Environment variables
β Installation & Setup
1οΈβ£ Clone the Repository
git clone https://github.com/shivansh-0826/chat-app.git cd chat-app
2οΈβ£ Install Dependencies
Backend
cd server npm install
Frontend
cd ../client npm install
3οΈβ£ Setup Environment Variables
Create a .env file inside the server/ folder and add:
PORT=5000 MONGO_URI=your_mongodb_connection_string JWT_SECRET=your_secret_key
4οΈβ£ Run the App
Backend:
npm run server
Frontend:
npm run dev
Then open http://localhost:5173 in your browser.
π How It Works
-
Users log in and connect to the server via Socket.io.
-
When a user sends a message, itβs emitted to the backend.
-
The backend broadcasts it to the receiver in real time.
-
Messages are stored in MongoDB for persistence.
π§° Environment Variables
Variable Description
PORT Server running port MONGO_URI MongoDB connection string JWT_SECRET Secret key for JWT tokens
π¦ Deployment
This app can be deployed easily on Vercel (frontend) and Render / Railway (backend). You can configure environment variables directly on those platforms.