Skip to content

controlcoder/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SnapTalk - Real-Time Messaging Application

Version License Status

πŸ“‹ Table of Contents


🎯 Project Overview

SnapTalk is a modern, real-time messaging application designed to provide seamless, secure, and interactive communication across devices. It allows users to connect with friends, family, or colleagues instantly, offering a blend of personal and professional messaging features.

The application features a robust full-stack architecture with a React-based frontend and Node.js/Express backend, enabling real-time bidirectional communication through WebSockets (Socket.io).

Live Demo: https://chat-app-controlcoder.vercel.app/


✨ Features

  • Real-Time Messaging: Instant message delivery using WebSocket technology
  • User Authentication: Secure JWT-based authentication with bcrypt password hashing
  • User Profiles: View and manage user information with avatar support
  • Friend Management: Add, remove, and manage connections
  • Message History: Persistent message storage with MongoDB
  • Typing Indicators: Real-time typing status notifications
  • Online Status: Track user availability in real-time
  • Media Support: Cloud-based image uploads using Cloudinary
  • Responsive Design: Mobile-friendly UI with Tailwind CSS
  • Toast Notifications: User-friendly feedback with React Hot Toast
  • Secure Communication: CORS-enabled, JWT-protected endpoints

πŸ› οΈ Tech Stack

Frontend

Technology Version Purpose
React 19.2.0 UI Library
Vite 7.3.1 Build Tool & Dev Server
React Router DOM 7.13.1 Client-side Routing
Socket.io Client 4.8.3 Real-time Communication
Tailwind CSS 4.2.1 Utility-first CSS Framework
Axios 1.13.6 HTTP Client
React Hot Toast 2.6.0 Toast Notifications
ESLint 9.39.1 Code Quality

Backend

Technology Version Purpose
Node.js Latest JavaScript Runtime
Express 5.2.1 Web Framework
Socket.io 4.8.3 Real-time Communication
MongoDB/Mongoose 9.3.3 Database & ODM
JWT 9.0.3 Authentication Token
Bcrypt 6.0.0 Password Hashing
CORS 2.8.6 Cross-Origin Resource Sharing
Dotenv 17.3.1 Environment Configuration
Cloudinary 2.9.0 Cloud Image Storage
Cookie Parser 1.4.7 Cookie Parsing

DevOps & Deployment

Technology Purpose
Vercel Frontend Hosting
Concurrently Run multiple dev servers
Nodemon Auto-restart server during development

πŸ”„ Project Workflow

Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    CLIENT (React + Vite)                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ Pages: Auth, Chat, Profile, Dashboard              β”‚   β”‚
β”‚  β”‚ Components: MessageBox, UserList, ChatWindow        β”‚   β”‚
β”‚  β”‚ Context API: User, Chat, Socket State Management    β”‚   β”‚
β”‚  β”‚ Routing: React Router (Login β†’ Chat β†’ Profile)     β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                          ↕ (HTTP + WebSocket)                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚         Socket.io & REST API Communication Layer             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                  SERVER (Node.js + Express)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚ Routes: Auth, Chat, Users, Messages                 β”‚   β”‚
β”‚  β”‚ Controllers: Logic for auth, messaging, user mgmt   β”‚   β”‚
β”‚  β”‚ Models: User, Message, Conversation (MongoDB)      β”‚   β”‚
β”‚  β”‚ Middleware: JWT Verify, CORS, Error Handling       β”‚   β”‚
β”‚  β”‚ Socket Events: message, typing, online status       β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                          ↕ (MongoDB Queries)                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              DATABASE (MongoDB Atlas)                         β”‚
β”‚    Collections: users, messages, conversations, tokens       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

User Flow Diagram

1. AUTHENTICATION FLOW
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   Login    β”‚ β†’ Credentials Sent to Backend
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Server Verification β”‚ β†’ Bcrypt Password Check
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ JWT Generated  β”‚ β†’ Token Stored in Cookies
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ User Redirected  β”‚ β†’ Dashboard/Chat View
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

2. MESSAGE SENDING FLOW
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ User Types   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Client Emits Socket Event  β”‚ β†’ "message:send"
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Server Receives Message      β”‚ β†’ Validates JWT
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€οΏ½οΏ½β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Saves to MongoDB               β”‚ β†’ Message Stored
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Broadcasts to Recipient           β”‚ β†’ Real-time Delivery
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         ↓
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Updates UI Dynamically           β”‚ β†’ Message Appears
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

3. REAL-TIME UPDATES
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Typing Indicator    β”‚ β†’ Socket Event Emission
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Online Status Update β”‚ β†’ Connection Events
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ Message Seen Status  β”‚ β†’ Acknowledgment Events
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Folder Structure

chat-app/
β”‚
β”œβ”€β”€ client/                           # Frontend Application (React + Vite)
β”‚   β”œβ”€β”€ public/                       # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/                   # Images, icons, media files
β”‚   β”‚   β”œβ”€β”€ components/               # Reusable React components
β”‚   β”‚   β”‚   β”œβ”€β”€ MessageBox.jsx        # Message rendering component
β”‚   β”‚   β”‚   β”œβ”€β”€ UserList.jsx          # User list display
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatWindow.jsx        # Main chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ Header.jsx            # Navigation header
β”‚   β”‚   β”‚   └── ...                   # Other UI components
β”‚   β”‚   β”œβ”€β”€ pages/                    # Page-level components (Routes)
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx             # Authentication page
β”‚   β”‚   β”‚   β”œβ”€β”€ Signup.jsx            # Registration page
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat.jsx              # Main chat interface
β”‚   β”‚   β”‚   β”œβ”€β”€ Profile.jsx           # User profile page
β”‚   β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx         # Dashboard/Home page
β”‚   β”‚   β”‚   └── ...                   # Other page components
β”‚   β”‚   β”œβ”€β”€ context/                  # Context API for state management
β”‚   β”‚   β”‚   β”œβ”€β”€ UserContext.jsx       # User authentication state
β”‚   β”‚   β”‚   β”œβ”€β”€ ChatContext.jsx       # Chat messages state
β”‚   β”‚   β”‚   β”œβ”€β”€ SocketContext.jsx     # WebSocket connection state
β”‚   β”‚   β”‚   └── ...                   # Other contexts
β”‚   β”‚   β”œβ”€β”€ config/                   # Configuration files
β”‚   β”‚   β”‚   β”œβ”€β”€ api.js                # API base configuration
β”‚   β”‚   β”‚   β”œβ”€β”€ socket.js             # Socket.io configuration
β”‚   β”‚   β”‚   └── constants.js          # Constants and settings
β”‚   β”‚   β”œβ”€β”€ lib/                      # Utility functions and helpers
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js               # Authentication utilities
β”‚   β”‚   β”‚   β”œβ”€β”€ validators.js         # Form validation functions
β”‚   β”‚   β”‚   β”œβ”€β”€ formatters.js         # Data formatting utilities
β”‚   β”‚   β”‚   └── ...                   # Other helpers
β”‚   β”‚   β”œβ”€β”€ App.jsx                   # Root component with routing
β”‚   β”‚   β”œβ”€β”€ App.css                   # Global styles
β”‚   β”‚   β”œβ”€β”€ main.jsx                  # React entry point
β”‚   β”‚   └── index.css                 # Global CSS/Tailwind imports
β”‚   β”œβ”€β”€ .gitignore                    # Git ignore rules
β”‚   β”œβ”€β”€ eslint.config.js              # ESLint configuration
β”‚   β”œβ”€β”€ vite.config.js                # Vite configuration
β”‚   β”œβ”€β”€ vercel.json                   # Vercel deployment config
β”‚   β”œβ”€β”€ package.json                  # Frontend dependencies
β”‚   β”œβ”€β”€ package-lock.json             # Locked dependency versions
β”‚   β”œβ”€β”€ index.html                    # HTML entry point
β”‚   └── README.md                     # Frontend documentation
β”‚
β”œβ”€β”€ server/                           # Backend Application (Node.js + Express)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/                   # Configuration files
β”‚   β”‚   β”‚   β”œβ”€β”€ database.js           # MongoDB connection
β”‚   β”‚   β”‚   β”œβ”€β”€ cloudinary.js         # Cloudinary setup
β”‚   β”‚   β”‚   └── constants.js          # Backend constants
β”‚   β”‚   β”œβ”€β”€ controllers/              # Business logic layer
β”‚   β”‚   β”‚   β”œβ”€β”€ authController.js     # Login, signup, logout logic
β”‚   β”‚   β”‚   β”œβ”€β”€ chatController.js     # Message handling
β”‚   β”‚   β”‚   β”œβ”€β”€ userController.js     # User operations
β”‚   β”‚   β”‚   └── ...                   # Other controllers
β”‚   β”‚   β”œβ”€β”€ middleware/               # Express middleware
β”‚   β”‚   β”‚   β”œβ”€β”€ authMiddleware.js     # JWT verification
β”‚   β”‚   β”‚   β”œβ”€β”€ errorHandler.js       # Error handling
β”‚   β”‚   β”‚   β”œβ”€β”€ validation.js         # Input validation
β”‚   β”‚   β”‚   └── ...                   # Other middleware
β”‚   β”‚   β”œβ”€β”€ models/                   # MongoDB Schemas (Mongoose)
β”‚   β”‚   β”‚   β”œβ”€β”€ User.js               # User schema
β”‚   β”‚   β”‚   β”œβ”€β”€ Message.js            # Message schema
β”‚   β”‚   β”‚   β”œβ”€β”€ Conversation.js       # Conversation schema
β”‚   β”‚   β”‚   └── ...                   # Other models
β”‚   β”‚   β”œβ”€β”€ routes/                   # API route definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ authRoutes.js         # Auth endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ chatRoutes.js         # Chat endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ userRoutes.js         # User endpoints
β”‚   β”‚   β”‚   └── ...                   # Other routes
β”‚   β”‚   └── app.js                    # Express app setup
β”‚   β”œβ”€β”€ server.js                     # Server entry point
β”‚   β”œβ”€β”€ seeds/                        # Database seeding scripts
β”‚   β”‚   └── seedData.js               # Sample data for testing
β”‚   β”œβ”€β”€ .env                          # Environment variables (local)
β”‚   β”œβ”€β”€ .env.example                  # Environment variables template
β”‚   β”œβ”€β”€ .gitignore                    # Git ignore rules
β”‚   β”œβ”€β”€ package.json                  # Backend dependencies
β”‚   β”œβ”€β”€ package-lock.json             # Locked dependency versions
β”‚   └── README.md                     # Backend documentation
β”‚
β”œβ”€β”€ package.json                      # Root package.json (monorepo setup)
β”œβ”€β”€ package-lock.json                 # Root dependencies lock
β”œβ”€β”€ .gitignore                        # Root git ignore
└── README.md                         # This file

Key Directories Explained

Frontend (client/)

  • pages/: Route-level components for different views (login, chat, profile)
  • components/: Reusable UI components used across pages
  • context/: Global state management using React Context API
  • config/: Configuration for API endpoints and Socket.io
  • lib/: Utility functions and helper methods
  • assets/: Static files like images and icons

Backend (server/)

  • controllers/: Contains all business logic separated by feature
  • models/: MongoDB schema definitions using Mongoose
  • routes/: API endpoint definitions with HTTP methods
  • middleware/: Functions that process requests (auth, validation)
  • config/: Database and service configurations
  • seeds/: Test data for development

πŸš€ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn
  • MongoDB Atlas account (or local MongoDB)
  • Cloudinary account (for image uploads)
  • Git

Step 1: Clone the Repository

git clone https://github.com/controlcoder/chat-app.git
cd chat-app

Step 2: Install Root Dependencies

npm install

Step 3: Setup Backend

cd server
npm install

Create a .env file in the server directory:

PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
CLOUDINARY_NAME=your_cloudinary_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
NODE_ENV=development

Step 4: Setup Frontend

cd ../client
npm install

Create a .env.local file in the client directory:

VITE_API_URL=http://localhost:5000
VITE_SOCKET_URL=http://localhost:5000

▢️ Running the Application

Development Mode (Concurrent)

From the root directory:

npm run dev

This runs both server and client simultaneously using concurrently.

Run Individual Services

# Terminal 1: Run backend
npm run server

# Terminal 2: Run frontend
npm run client

Production Build

# Build frontend
cd client
npm run build

# Run production server
cd ../server
npm run dev

πŸ“‘ API Endpoints

Authentication Endpoints

POST   /api/auth/signup          - Register new user
POST   /api/auth/login           - User login
POST   /api/auth/logout          - User logout
POST   /api/auth/refresh         - Refresh JWT token
GET    /api/auth/verify          - Verify token validity

User Endpoints

GET    /api/users/profile        - Get user profile
PUT    /api/users/profile        - Update user profile
GET    /api/users/search         - Search users
GET    /api/users/:id            - Get user by ID
DELETE /api/users/:id            - Delete user account

Chat Endpoints

GET    /api/chats                - Get all conversations
GET    /api/chats/:id            - Get conversation details
POST   /api/chats/send           - Send message
GET    /api/chats/:id/messages   - Get conversation messages
DELETE /api/chats/:id/messages   - Delete message

Socket.io Events

Client β†’ Server:
  - connect           : Establish connection
  - message:send      : Send a message
  - typing:start      : User started typing
  - typing:stop       : User stopped typing
  - user:online       : User came online
  - user:offline      : User went offline

Server β†’ Client:
  - message:received  : New message received
  - typing:start      : Someone typing
  - typing:stop       : Someone stopped typing
  - users:online      : Updated online users list

πŸ” Environment Variables

Backend (.env)

Variable Description Example
PORT Server port 5000
MONGODB_URI MongoDB connection string mongodb+srv://user:pass@cluster.mongodb.net/dbname
JWT_SECRET Secret key for JWT signing your_super_secret_key_123
JWT_EXPIRE JWT expiration time 7d
CLOUDINARY_NAME Cloudinary account name your_cloudinary_name
CLOUDINARY_API_KEY Cloudinary API key your_api_key
CLOUDINARY_API_SECRET Cloudinary API secret your_api_secret
NODE_ENV Environment type development/production
CORS_ORIGIN Allowed CORS origins http://localhost:3000

Frontend (.env.local)

Variable Description Example
VITE_API_URL Backend API URL http://localhost:5000
VITE_SOCKET_URL Socket.io server URL http://localhost:5000
VITE_APP_NAME Application name SnapTalk

πŸ”’ Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Hashing: Bcrypt for secure password storage
  • CORS Protection: Configured CORS for controlled access
  • Environment Variables: Sensitive data in .env files
  • Cookie Parsing: Secure HTTP-only cookies for tokens
  • Input Validation: Middleware for request validation
  • Error Handling: Centralized error management

πŸ“¦ Project Commands

# Root level
npm run dev              # Run both server and client
npm run server           # Run backend only
npm run client           # Run frontend only

# Frontend commands (from client/)
npm run dev              # Start Vite dev server
npm run build            # Build for production
npm run preview          # Preview production build
npm run lint             # Run ESLint

# Backend commands (from server/)
npm run dev              # Start with nodemon

🀝 Contributing

Contributions are welcome! Follow these steps:

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

πŸ“ License

This project is licensed under the MIT License - see LICENSE file for details.


πŸ‘¨β€πŸ’» Author

controlcoder


πŸ†˜ Support

For issues and questions:

  • Create an issue on GitHub
  • Check existing documentation
  • Review the codebase comments

πŸŽ‰ Acknowledgments

  • React & Vite for modern frontend development
  • Express.js & Node.js for robust backend
  • MongoDB for flexible data storage
  • Socket.io for real-time communication
  • Tailwind CSS for styling
  • All open-source contributors

Last Updated: June 6, 2026
Repository: controlcoder/chat-app

About

SnapTalk is a real-time messaging application designed to provide seamless, secure, and interactive communication across devices. It allows users to connect with friends, family, or colleagues instantly, offering a blend of personal and professional messaging features.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages