The frontend is built using React, TypeScript, and Vite for fast development and performance. It provides a responsive user interface for chat functionalities, file uploads, and user management.
Frontend/
├── public/ # Static assets
├── src/
│ ├── components/ # React components (e.g., ChatContainer, HomePage)
│ ├── store/ # Zustand stores for state management
│ ├── App.tsx # Main application component
│ ├── main.tsx # Entry point
│ ├── firebase.ts # Firebase configuration
│ ├── index.css # Global styles
├── vite.config.ts # Vite configuration
├── package.json # Dependencies and scripts
The backend is built using Node.js and Express. It handles real-time communication, file uploads, and database interactions. The backend is designed to be scalable and efficient using technologies like Redis, Kafka, and MySQL.
Backend/
├── src/
│ ├── app.js # Express app setup
│ ├── index.js # Entry point
│ ├── controllers/ # API controllers
│ ├── db/ # Database and Redis setup
│ ├── middlewares/ # Middleware functions
│ ├── models/ # Sequelize models
│ ├── routes/ # API routes
│ ├── services/ # Kafka producer/consumer
│ ├── socket/ # Socket.IO setup and Redis subscriber
│ ├── utils/ # Utility functions (e.g., S3 upload)
├── package.json # Dependencies and scripts
users
: Stores user details like id
, username
, email
, and status
.messages
: Stores chat messages with fields like sender_id
, receiver_id
, message
, message_type
, and timestamps.file
: Stores metadata for uploaded files, such as file_name
, file_url
, and file_type
.friends
: Tracks friendships between users.MESSAGES
topic.MESSAGES
topic and saves them to the database.userId
to socketId
for message delivery.receive_message
and receive_notification
.useChatStore
: Manages chat-related state (e.g., messages, notifications).useAuthStore
: Manages authentication state.useUserSearchStore
: Manages user search state.firebase.ts
.User Authentication:
Real-Time Messaging:
File Sharing:
Search Functionality:
git clone <repository-url>
cd ChatBlizz
cd Backend
npm install
Create a .env
file in the Backend directory with the following:
PORT=8000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=chatblizz
DB_PORT=3306
AWS_BUCKET_NAME=your-bucket-name
AWS_BUCKET_REGION=your-region
ACCESS_KEY_AWS=your-access-key
SECRET_KEY_AWS=your-secret-key
Ensure Redis is running:
redis-server
Start Zookeeper and Kafka:
zookeeper-server-start.sh config/zookeeper.properties
kafka-server-start.sh config/server.properties
npm start
cd Frontend
npm install
Create a .env
file in the Frontend directory with the following:
VITE_FIREBASE_API_KEY=your-firebase-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-firebase-auth-domain
VITE_FIREBASE_PROJECT_ID=your-firebase-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-firebase-storage-bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your-firebase-messaging-sender-id
VITE_FIREBASE_APP_ID=your-firebase-app-id
npm run dev
http://localhost:5173
in your browser.http://localhost:8000
.This setup ensures a robust and scalable chat application with real-time capabilities.