Skip to content

karemsaeed20020/Chat-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

31 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’¬ Chat Application

A modern and features rich real-time chat application that enables seamless communication with instant messaging, multimedia sharing.

Project Mind Map

Image

Project Endpoints

Authentication

Image

Account

Image

User

Image

Message

Image Image

Room

Image Image

✨ Features

Core Functionality

  • πŸ” User Authentication - Secure sign up, login, and logout
  • πŸ’¬ Real-time Messaging - Instant message delivery using WebSocket technology
  • πŸ‘₯ Private Chat - One-on-one conversations with other users
  • πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦ Group Chat - Create and manage group conversations
  • πŸ“Ž Media Sharing - Send and receive images, videos, and files
  • πŸ” User Search - Find and connect with other users

Advanced Features

  • βœ… Message Read Receipts - See when messages are delivered and read
  • βœ… Typing Indicators - Know when someone is typing
  • βœ… Profile Customization - Update profile picture and status
  • βœ… Message Management - Edit and delete your messages
  • βœ… Online Status - See who's currently online
  • βœ… Real-Time Messaging : SignalR WebSockets
  • βœ… Private & Group Chats : Complete
  • βœ… File/Image/Video Upload : Atomic with message (no separate endpoint)
  • βœ… Message Pinning : One per room
  • βœ… Read Receipts : Double check
  • βœ… Profile Avatar & Status : Upload + live sync
  • βœ… User Search : Instant results
  • βœ… Block User : Privacy control
  • βœ… JWT Authentication : ASP.NET Identity
  • βœ… Pagination : Infinite scroll ready
  • βœ… Error Handling with Result Pattern :Employed a result pattern for structured error handling, providing clear and actionable feedback to users. βœ… Exception Handling :Integrated centralized exception handling to manage errors gracefully, significantly enhancing the user experience.
  • βœ… CORS (Cross-Origin Resource Sharing) :a security feature implemented by web browsers to prevent web pages from making requests to a different domain than the one that served the web page.
  • βœ… Background Jobs : Used Hangfire for managing background tasks like sending confirmation emails and processing password resets seamlessly.
  • βœ… Audit Logging :Implemented audit logging to track changes on resources, ensuring transparency and accountability in user actions.
  • βœ… Fluent Validation :Ensured data integrity by effectively validating inputs, leading to user-friendly error messages.

πŸ› οΈ Technologies Used

  • Backend : ASP.NET Core 10
  • Real-Time : SignalR
  • ORM : Entity Framework Core
  • Database : SQL Server
  • Auth : JWT + Identity
  • Validation : FluentValidation
  • Mapping : Manual using extension method
  • Architecture : Monolithic
  • File Storage : wwwroot/uploads
  • GUIDs : Version 7 (sequential & fast)

πŸ“ Project Structure

Chat--Application/
β”‚   β”œβ”€β”€ public/            # Static files
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/        # Images, etc.
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ Chat/
β”‚   β”‚   β”‚   β”œβ”€β”€ Auth/
β”‚   β”‚   β”‚   β”œβ”€β”€ Profile/
β”‚   β”‚   β”‚   └── Common/
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ context/       # Context API
β”‚   β”‚   β”œβ”€β”€ services/      # API services
β”‚   └── .env
β”‚
β”œβ”€β”€ server/                # Backend application
β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”œβ”€β”€ controllers/       # Route controllers
β”‚   β”œβ”€β”€ models/            # Database models
β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”œβ”€β”€ socket/            # Socket.io handlers
β”‚   └── .env
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
└── README.md

πŸ“š API Documentation

Some Ex Auth Endpoints (/api/auth)

Method Endpoint Description Auth Required
POST /api/auth/login Login user ❌
POST /api/auth/register Register new user ❌
POST /api/auth/refresh Refresh JWT token ❌
PUT /api/auth/revoke-refresh-token Revoke refresh token βœ…
POST /api/auth/confirm-email Confirm email address ❌
POST /api/auth/forget-password Initiate password reset ❌
POST /api/auth/reset-password Complete password reset ❌

Some Ex User Endpoints (/api/users)

Method Endpoint Description Auth Required
GET /api/users/profile Get current user profile βœ…
PUT /api/users/profile Update user profile βœ…
POST /api/users/avatar Upload profile avatar βœ…
GET /api/users/search Search users by name/email βœ…
GET /api/users/:id Get user by ID βœ…
GET /api/users/online Get all online users βœ…

Socket.io Events

Client β†’ Server (Emit)

Event Name Payload Description
join_room { messageId: string } Join a chat room
leave_room { messageId: string } Leave a chat room
send_message { messageId, content, type, attachments } Send a new message
typing_start { messageId: string, userId: string } User started typing
typing_stop { messageId: string, userId: string } User stopped typing
message_read { messageId: string, chatId: string } Mark message as read
user_online { userId: string } User came online
user_offline { userId: string } User went offline

Server β†’ Client (Listen)

Event Name Payload Description
message_received { message: Object, chatId: string } New message received
message_updated { messageId: string, content: string } Message was edited
message_deleted { messageId: string, chatId: string } Message was deleted
user_typing { chatId: string, user: Object } Someone is typing
user_stopped_typing { chatId: string, userId: string } Someone stopped typing
user_online_status { userId: string, status: boolean } User online status changed
message_read_receipt { messageId: string, readBy: string } Message read by user
chat_updated { chatId: string, updates: Object } Chat details updated
error { message: string, code: string } Error occurred

About

A modern and features rich real-time chat application that enables seamless communication with instant messaging, multimedia sharing.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors