Production-ready NestJS backend for QuckApp - a real-time chat application with audio/video calling capabilities.
- β JWT Authentication - Secure authentication with refresh tokens
- β Real-time Messaging - Socket.io for instant messaging
- β WebRTC Signaling - Audio and video calling support
- β End-to-End Encryption - AES encryption for messages
- β File Upload - Images, videos, audio, and files
- β Push Notifications - Firebase Cloud Messaging integration
- β Message Features - Reactions, read receipts, typing indicators
- β Group Chat - Create and manage group conversations
- β MongoDB - Scalable NoSQL database with Mongoose
- β Docker Support - Easy deployment with Docker Compose
- Node.js 18+ or 20+
- MongoDB 5+ or 7+
- npm or yarn
- Clone the repository
git clone https://github.com/QuckApp/quckapp-backend.git
cd quckapp-backend- Install dependencies
npm install- Configure environment variables
cp .env.example .envEdit .env file with your configuration:
MONGODB_URI=mongodb://localhost:27017/quckapp
JWT_SECRET=your-super-secret-jwt-key
JWT_REFRESH_SECRET=your-refresh-secret-key
ENCRYPTION_KEY=your-32-character-encryption-key- Start MongoDB
# Using Docker
docker-compose up -d mongodb
# Or use local MongoDB installation- Run the application
# Development
npm run start:dev
# Production
npm run build
npm run start:prodThe server will start at http://localhost:3000
# Start both MongoDB and backend
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose downPOST /api/v1/auth/register- Register new userPOST /api/v1/auth/login- LoginPOST /api/v1/auth/refresh- Refresh access token
GET /api/v1/users/me- Get current user profilePUT /api/v1/users/me- Update profileGET /api/v1/users/search?q=query- Search users
GET /api/v1/conversations- Get user conversationsPOST /api/v1/conversations/single- Create single conversationPOST /api/v1/conversations/group- Create group conversation
GET /api/v1/messages/conversation/:id- Get conversation messagesPUT /api/v1/messages/:id- Edit messageDELETE /api/v1/messages/:id- Delete message
POST /api/v1/upload/image- Upload imagePOST /api/v1/upload/video- Upload videoPOST /api/v1/upload/audio- Upload audioPOST /api/v1/upload/file- Upload file
Client β Server:
message:send- Send messagemessage:edit- Edit messagemessage:delete- Delete messagemessage:reaction:add- Add reactiontyping:start- Start typingtyping:stop- Stop typingmessage:read- Mark message as read
Server β Client:
message:new- New message receivedmessage:edited- Message editedmessage:deleted- Message deletedtyping:start- User started typinguser:online- User came onlineuser:offline- User went offline
Client β Server:
call:initiate- Start a callcall:answer- Answer incoming callcall:reject- Reject incoming callcall:end- End active callwebrtc:offer- Send WebRTC offerwebrtc:answer- Send WebRTC answerwebrtc:ice-candidate- Send ICE candidate
Server β Client:
call:incoming- Incoming call notificationcall:participant:joined- Participant joined callcall:ended- Call endedwebrtc:offer- Receive WebRTC offerwebrtc:answer- Receive WebRTC answer
src/
βββ common/
β βββ logger/ # Winston logger service
βββ gateways/
β βββ chat.gateway.ts # Real-time messaging
β βββ webrtc.gateway.ts # WebRTC signaling
βββ modules/
β βββ auth/ # Authentication module
β βββ users/ # Users module
β βββ conversations/ # Conversations module
β βββ messages/ # Messages module
β βββ upload/ # File upload module
β βββ notifications/ # Push notifications module
βββ app.module.ts
βββ main.ts
- JWT authentication with refresh tokens
- Password hashing with bcrypt
- Message encryption (AES)
- Input validation with class-validator
- Rate limiting
- CORS protection
- Helmet security headers
See .env.example for all configuration options:
NODE_ENV- Environment (development/production)PORT- Server port (default: 3000)MONGODB_URI- MongoDB connection stringJWT_SECRET- JWT secret keyJWT_REFRESH_SECRET- Refresh token secretENCRYPTION_KEY- Message encryption keyFIREBASE_*- Firebase credentials for push notificationsTURN_SERVER_URL- TURN server for WebRTCSTUN_SERVER_URL- STUN server for WebRTC
This backend works with our React Native mobile app: π QuckApp Mobile
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covMIT
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please open an issue on GitHub.
Built with β€οΈ using NestJS, Socket.io, and WebRTC