A full-stack real-time chat application built with:
- Next.js (Frontend & Backend)
- TypeScript (Type Safety)
- PostgreSQL (Relational Database)
- Socket.IO (WebSockets for live communication)
- Redis (Caching / Pub-Sub)
- User Authentication (JWT / OAuth)
- Real-time 1:1 and group messaging
- Message delivery acknowledgments
- Redis pub/sub for event propagation
- Persistent chat storage via PostgreSQL
- Scalable and production-ready architecture
| Layer | Tech Used |
|---|---|
| Frontend | Next.js, Tailwind CSS, Socket.IO Client |
| Backend | Next.js API Routes, Express (optional), Socket.IO Server |
| Database | PostgreSQL + Prisma ORM |
| Caching | Redis (for sessions, pub/sub) |
| Auth | NextAuth.js and JWT |
| Dev Tools | Docker, ESLint, Prettier |
Prerequisites:
Node.js 21+
PostgreSQL
Redis
npm
prisma CLI (globally or via npx)
- Clone the repo
git clone https://github.com/your-username/chat-rooms.git
cd chat-rooms- Configure Environment
Create .env files in both frontend and server (use variable names from .env.example)
- Install dependencies
cd frontend
npm install
cd ../server
npm install- Setup Database
cd server
npx prisma generate
npx prisma migrate dev --name init- Setup Postgresql
Either use local setup or you can use a supabase or firebase instance.
- Setup Redis
Make sure docker is installed in your system. Pull redis-stack image from dockerhub
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 -e redis/redis-stack:latest- Clone the repo
git clone https://github.com/your-username/chat-rooms.git
cd chat-rooms-
Setup .env files (same as manual setup)
-
Start with Docker Compose
docker-compose up --build