Skip to content

JeetMajumdar2003/Realtime-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ RealTime Chat

A WhatsApp-inspired messaging app built with React & Appwrite

React Vite Appwrite Tailwind

Quick Start β€’ Features β€’ Screenshots β€’ Tech Stack β€’ Contributing


RealTime Chat - Main Interface

Experience seamless real-time messaging with a familiar WhatsApp-like interface, powered by Appwrite's blazing-fast realtime subscriptions.


πŸ“‘ Table of Contents


πŸ–ΌοΈ Screenshots

πŸ’¬ Chat Interface

Real-time messaging with WhatsApp-style bubbles, timestamps, and read receipts

Chat Room

πŸ” Authentication

Login
πŸ”‘ Login Page
Clean, minimal login interface
Register
πŸ“ Register Page
Quick sign-up with validation

✨ Features

πŸ” Secure Authentication Email/password auth via Appwrite with protected routes
πŸ’¬ Real-time Messaging Instant message delivery using Appwrite Realtime subscriptions
πŸŒ— Dark/Light Mode Toggle between themes with persistent preference
πŸ˜„ Emoji Support Full emoji picker for expressive conversations
πŸ” User Search Find and start conversations with any registered user
πŸ—‘οΈ Message Management Delete your own messages with permission-based controls
πŸ“± Responsive Design Seamless experience across desktop, tablet, and mobile
⚑ Lightning Fast Built with Vite for instant HMR and optimized builds

πŸ› οΈ Tech Stack

Category Technologies
Frontend React React Router Tailwind
Build Tool Vite
Backend Appwrite
UI Libraries Lucide emoji-picker-react
Tooling ESLint PostCSS

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           FRONTEND (React)                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  AuthContext  β”‚  PrivateRoutes  β”‚  React Router  β”‚  Tailwind CSS    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        APPWRITE CLOUD                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   πŸ” Accounts   β”‚   πŸ—„οΈ Databases β”‚   πŸ“‘ Realtime   β”‚   πŸ“¦ Storage β”‚
β”‚                 β”‚                 β”‚                 β”‚               β”‚
β”‚  β€’ Auth         β”‚  β€’ users        β”‚  β€’ Message      β”‚  β€’ Media      β”‚
β”‚  β€’ Sessions     β”‚  β€’ conversationsβ”‚    subscriptionsβ”‚    uploads    β”‚
β”‚                 β”‚  β€’ messages     β”‚                 β”‚               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How it works:

  1. Authentication β†’ AuthProvider bootstraps the session via account.get(). Protected routes keep chat behind login.
  2. Data Layer β†’ Three Appwrite collections: users, conversations, and messages.
  3. Realtime β†’ The chat room subscribes to message events and patches the UI instantly.
  4. UI State β†’ React hooks manage search, layout breakpoints, emoji picker, and auto-scroll.

πŸš€ Quick Start

Prerequisites

Requirement Version
Node.js 18+
npm 10+
Appwrite Cloud or Self-hosted

Installation

# Clone the repository
git clone https://github.com/JeetMajumdar2003/Realtime-Chat.git

# Navigate to directory
cd Realtime-Chat

# Install dependencies
npm install

# Start development server
npm run dev

🌐 Open http://localhost:5173 in your browser


βš™οΈ Environment Variables

Create a .env file in the root directory (use .env.sample as reference):

VITE_APPWRITE_ENDPOINT=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your_project_id
VITE_APPWRITE_DATABASE_ID=your_database_id
VITE_APPWRITE_COLLECTION_ID_MESSAGES=your_messages_collection_id
VITE_APPWRITE_COLLECTION_ID_CONVERSATIONS=your_conversations_collection_id
VITE_APPWRITE_COLLECTION_ID_USERS=your_users_collection_id
VITE_APPWRITE_BUCKET_ID=your_bucket_id
πŸ“‹ Variable Reference
Variable Description
VITE_APPWRITE_ENDPOINT Appwrite API endpoint URL
VITE_APPWRITE_PROJECT_ID Your Appwrite project ID
VITE_APPWRITE_DATABASE_ID Database ID for chat data
VITE_APPWRITE_COLLECTION_ID_MESSAGES Collection storing messages
VITE_APPWRITE_COLLECTION_ID_CONVERSATIONS Collection storing conversation metadata
VITE_APPWRITE_COLLECTION_ID_USERS Collection storing user profiles
VITE_APPWRITE_BUCKET_ID Storage bucket for media (optional)

☁️ Appwrite Setup

πŸ“– Click to expand setup instructions

1️⃣ Create Database

Create a new database in your Appwrite console (e.g., chat-db).

2️⃣ Create Collections

users Collection

Attribute Type Required
username String βœ…
email String βœ…

⚠️ Document ID must match the Appwrite Account $id

conversations Collection

Attribute Type Required
participants String[] βœ…
last_message_body String ❌
last_message_at DateTime ❌

messages Collection

Attribute Type Required
conversation_id String βœ…
user_id String βœ…
username String βœ…
body String βœ…

3️⃣ Create Indexes

  • conversations: Array index on participants
  • messages: Composite index on conversation_id + $createdAt (ASC)

4️⃣ Configure Permissions

Enable authenticated users to create/read documents. The app uses document-level permissions for message deletion.


πŸ“œ Available Scripts

Command Description
npm run dev πŸš€ Start development server with HMR
npm run build πŸ“¦ Build for production
npm run preview πŸ‘οΈ Preview production build locally
npm run lint πŸ” Run ESLint checks

πŸ“ Project Structure

src/
β”œβ”€β”€ πŸ“„ App.jsx                 # Router + layout shell
β”œβ”€β”€ πŸ“„ appwriteConfig.js       # Appwrite client setup
β”œβ”€β”€ πŸ“„ main.jsx                # App entry point
β”œβ”€β”€ πŸ“„ index.css               # Tailwind imports
β”‚
β”œβ”€β”€ πŸ“ assets/                 # Static images
β”‚   β”œβ”€β”€ chat1.png
β”‚   β”œβ”€β”€ chat2.png
β”‚   β”œβ”€β”€ login.png
β”‚   └── register.png
β”‚
β”œβ”€β”€ πŸ“ components/
β”‚   β”œβ”€β”€ Header.jsx             # Auth-aware navigation
β”‚   β”œβ”€β”€ FilePreview.jsx        # File preview component
β”‚   └── FileUploadPopup.jsx    # Upload modal
β”‚
β”œβ”€β”€ πŸ“ pages/
β”‚   β”œβ”€β”€ Home.jsx               # Conversation sidebar
β”‚   β”œβ”€β”€ Room.jsx               # Chat room with realtime
β”‚   β”œβ”€β”€ LoginPage.jsx          # Login form
β”‚   └── RegisterPage.jsx       # Registration form
β”‚
└── πŸ“ utils/
    β”œβ”€β”€ AuthContext.jsx        # Auth state management
    └── PrivateRoutes.jsx      # Route protection

🌐 Deployment

Appwrite Sites

# Build and deploy
npm run build
npx appwrite deploy sites create --projectId=your_project_id --siteId=your_site_id --path=./dist --entrypoint=index.html

Important Notes

  1. Update homepage in package.json if forking
  2. Add your deployed domain to Appwrite Project Settings β†’ Platforms

πŸ—ΊοΈ Roadmap

  • πŸ‘₯ Group chats & read receipts
  • πŸ“Ž File & voice note uploads
  • πŸ”” Push notifications via Appwrite Functions
  • 😍 Message reactions & typing indicators
  • ✨ Onboarding animations

🀝 Contributing

Contributions are welcome! Here's how you can help:

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

πŸ“„ License

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


⭐ Star this repo if you found it helpful!

Made with ❀️ by Jeet Majumdar

About

Resources

License

Stars

Watchers

Forks

Languages