This project is a scalable realtime chat application built using SockeIO, Redis, TypeScript, Express, Nextjs, and Prisma.
It leverages socket.io
for real-time communication and prisma
for database interactions and Redis for horizontal scaling.
https://chat-io-cl.vercel.app/
- Socket.IO: Socket.IO is a library that enables real-time, bidirectional, and event-based communication between the browser and the server.
- Redis: Used Redis as adapter for socket.io to enable horizontal scaling.
- Prisma: Prisma is a modern database access toolkit that enables developers to easily access databases using type-safe queries.
- TypeScript: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
- Express: Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- Next.js: Next.js is a React framework that enables functionality such as server-side rendering and generating static websites for React based web applications.
- NeonDB: NeonDB is a cloud-based database service that provides a fully managed, scalable, and secure database solution for modern applications.
- Zod: Zod is a TypeScript-first schema declaration and validation library.
-
Clone the repository:
git clone https://github.com/ankkitsharma/chat-io.git cd chat-io
-
Install dependencies:
cd server npm install
cd client npm install
-
Set up environment variables:
- Create a
.env
file in the root directory. - Use the env.example file to set up the environment variables.
- Create a
-
Run the development server:
For server:
npm run build npm start
For client:
npm run dev
POST /auth/login
: Log in a user.GET /chat-group
: Fetch all chat groups.GET /chat-group/:id
: Fetch a specific chat group by ID.POST /chat-group
: Create a new chat group.PUT /chat-group/:id
: Update a chat group.DELETE /chat-group/:id
: Delete a chat group.GET /chat-group-users?group_id=:id
: Fetch users of a specific chat group.POST /chat-group-users
: Add a user to a chat group./chats/:groupId
: Fetch chat messages for a specific group.
- Add profile page for user
- Add images for users in chat
- Add support for emojis and file sharing