A real-time chat application built with NestJS, GraphQL, TypeORM, PostgreSQL, WebSockets (Socket.io), and React (Next.js). This project allows users to authenticate, join chat rooms, send messages, and track unread messages in real-time.
📌 Live Demo:
- Server (GraphQL & WebSockets): https://chatnest-wj2w.onrender.com
- Web App (Next.js UI): https://chatnest-webapp.vercel.app
- Authentication with JWT (Login & Token-based WebSocket authentication)
- GraphQL API for fetching chat rooms, messages, and users
- WebSockets for real-time chat functionality
- TypeORM & PostgreSQL for database management
- Unread message tracking per user
- Message read receipts (per-user tracking)
- Automatic reconnection handling for WebSockets
- Authentication (JWT-based login)
- Chat room selection with unread message count
- Real-time messaging via WebSockets
- Read receipts & message tracking
- Responsive UI similar to modern chat applications
- Optimized state management with RxJS & Apollo Client
- NestJS (Framework)
- GraphQL (API)
- TypeORM (ORM)
- PostgreSQL (Database)
- WebSockets (Socket.io) (Real-time messaging)
- JWT Authentication (Token-based security)
- React (Next.js 14) (Client-side UI)
- Apollo Client (GraphQL state management)
- Socket.io-client (WebSocket communication)
- RxJS (Reactive state management)
- Tailwind CSS (Styling)
git clone https://github.com/ore-codes/chatnest.git
cd chatnest
Create a .env
file inside the server
directory:
PORT=2457
JWT_SECRET=your-secret-key
DB_HOST=localhost
DB_PORT=5432
DB_USER=your-db-user
DB_PASS=your-db-password
DB_NAME=chatnest
Create a .env.local
file inside the webapp
directory:
NEXT_PUBLIC_SERVER_URL=http://localhost:2457
npm install
npm run dev
The server and webapp will run in dev mode simultaneously.
The app will run at http://localhost:2456
.
- Sign in with a valid username and password.
- Join a chat room (or create a new one).
- Send messages in real-time (WebSockets).
- Unread messages are tracked per user.
- Messages are marked as read when a user views the chat.
- Automatic WebSocket reconnection ensures seamless chat experience.
- Hosted on Render: https://chatnest-wj2w.onrender.com
- Database: PostgreSQL on Render
- Hosted on Vercel: https://chatnest-webapp.vercel.app