Live At : https://p2p-chat-x.onrender.com/ (Enjoy With #er)
A secure, private, and minimalist Peer-to-Peer (P2P) chat application built for confidentiality and performance.
- End-to-End Privacy: Uses WebRTC for direct P2P data transfer. Video and Chat data flows directly between users, not the server.
- Secure Authentication: Full login system backed by SQLite and bcrypt. No anonymous lurking.
- Room-Based Architecture: Users are dynamically paired in private isolated rooms (
socket.iorooms). No broadcasting to the public lobby. - Data Minimization: The server only acts as a signaling relay. Chat history is not persisted on the server.
- Theme: Clean Black & White. High-contrast, professional aesthetics using TailwindCSS v4.
- Responsive: Mobile-first design.
- Status Indicators: Visual cues for connection state (π΄ Offline, π‘ Waiting, π’ Paired).
- Smart Features:
- Reply System: Click any user name or double-click a message to quote and reply.
- Rich Notifications: Random fun sound effects on new messages.
- Containerized: Fully Dockerized with
Dockerfileanddocker-compose.yml. - Tested: Integrated Jest testing suite for authentication logic.
- Configurable: Environment variables managed via
.env.
- Node.js (v18+)
- npm
-
Clone the repository
git clone https://github.com/Priyanshu-x/p2p-chat.git cd p2p-chat -
Install Dependencies
npm install
-
Setup Environment Create a
.envfile in the root directory:PORT=3000 SESSION_SECRET=your_super_secret_key_here NODE_ENV=development
-
Build Styles (Compiles TailwindCSS)
npm run build:css
Development Mode:
npm startVisit http://localhost:3000.
Run Tests:
npm testFor a consistent production environment, run with Docker:
docker compose up --buildThe app will be available at http://localhost:3000.
- Frontend: HTML5, Vanilla JS, TailwindCSS v4
- Backend: Node.js, Express
- Real-time: Socket.io, WebRTC (STUN/TURN ready)
- Database: SQLite (via
connect-sqlite3) - Security: Helmet, Rate-Limit, CSURF protection ready
- DevOps: Docker, Jest
This application uses WebSockets (Socket.io).
- DO NOT DEPLOY TO VERCEL (Serverless functions kill WebSocket connections).
- Recommended Platforms: Render, Railway, Heroku, or any VPS (DigitalOcean/AWS EC2).
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request