A real-time video chat application built with React, Go, and WebRTC technology. PolyChat enables users to create and join video meetings with multiple participants, featuring peer-to-peer video/audio streaming, real-time chat, and seamless WebSocket signaling.
- π₯ Real-time Video & Audio - WebRTC-based peer-to-peer communication
- π₯ Multi-user Meetings - Support for multiple participants in a single room
- π¬ Live Chat - Text messaging during video calls
- π Shareable Meeting Links - UUID-based meeting rooms
- π Secure Authentication - JWT-based user authentication with bcrypt password hashing
- π WebSocket Signaling - Real-time signaling for WebRTC connections
- π± Responsive Design - Built with Tailwind CSS and Radix UI components
- π¬ Graceful Fallbacks - Automatic fallback when camera/microphone unavailable
- π Auto-reconnection - WebSocket reconnection on connection loss
Frontend:
- βοΈ React 19 with Vite
- π¨ Tailwind CSS 4 for styling
- π§© Radix UI components
- π Zustand for state management
- π WebRTC for video/audio streaming
- π WebSocket client for signaling
Backend:
- πΉ Go 1.25 with Chi router
- ποΈ MongoDB Atlas for data persistence
- π JWT authentication (golang-jwt/jwt)
- π Bcrypt password hashing
- π Gorilla WebSocket for signaling server
- π UUID for unique meeting identifiers
βββββββββββββββββββ ββββββββββββββββββββ
β β β β
β React Client ββββββββββΊβ Go Server β
β (Frontend) β HTTP β (Backend) β
β β REST β β
ββββββββββ¬βββββββββ ββββββββββ¬ββββββββββ
β β
β WebSocket β
β Signaling β MongoDB
β β Atlas
βββββββββββββ¬ββββββββββββββββ
β
ββββββββΌβββββββ
β WebRTC β
β P2P Streams β
βββββββββββββββ
- Node.js 18+ and npm
- Go 1.21+
- MongoDB Atlas account (or local MongoDB)
- OpenSSL (for generating secrets)
git clone https://github.com/rishishanbhag/PolyChat.git
cd PolyChatcd server
# Copy environment template
cp .env.example .env
# Edit .env and add your credentials:
# - MONGODB_URI: Your MongoDB connection string
# - JWT_SECRET: Generate with: openssl rand -base64 48
# - ALLOWED_ORIGINS: Frontend URLs (e.g., http://localhost:5173)
# Install dependencies
go mod download
# Run the server
go run cmd/api/main.go
# Or using Make
make runServer will start on http://localhost:8080
cd client
# Copy environment template
cp .env.example .env
# Edit .env if needed (defaults work for local development):
# - VITE_API_URL=http://localhost:8080/api
# - VITE_WS_URL=ws://localhost:8080/api/ws
# Install dependencies
npm install
# Run development server
npm run devClient will start on http://localhost:5173
Server (.env):
PORT=8080
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/
DATABASE_NAME=polychat
JWT_SECRET=<generate-with-openssl-rand-base64-48>
ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000Client (.env):
VITE_API_URL=http://localhost:8080/api
VITE_WS_URL=ws://localhost:8080/api/wsSee SECURITY.md for detailed security guidelines.
-
Sign Up / Login
- Create an account or login with existing credentials
- JWT token stored securely in localStorage
-
Create a Meeting
- Click "Create Meeting" from the dashboard
- Share the generated meeting link with participants
-
Join a Meeting
- Click on a meeting from your list
- Or use a shared meeting link
- Grant camera/microphone permissions when prompted
-
During the Meeting
- See all participants' video streams
- Use chat for text communication
- Video/audio will automatically fall back if devices unavailable
POST /api/auth/signup- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout user
GET /api/meetings- List user's meetingsPOST /api/meetings- Create new meetingGET /api/meetings/:id- Get meeting detailsGET /api/meetings/link/:linkId- Get meeting by shareable linkPOST /api/meetings/:id/join- Join a meeting
WS /api/ws?userId=<id>&username=<name>&roomId=<room>- WebSocket signaling connection
server/
βββ cmd/api/main.go # Application entry point
βββ internal/
β βββ auth/ # JWT utilities
β βββ database/ # MongoDB connection
β βββ handlers/ # HTTP request handlers
β βββ middleware/ # Auth middleware
β βββ models/ # Data models
β βββ repository/ # Database operations
β βββ server/ # Server setup & routes
β βββ websocket/ # WebSocket hub & clients
βββ .env.example # Environment template
βββ go.mod # Go dependencies
client/
βββ src/
β βββ components/ # React components
β β βββ ChatBox.jsx # Chat component
β β βββ ui/ # Reusable UI components
β βββ lib/
β β βββ api.js # HTTP API client
β β βββ websocket.js # WebSocket client
β β βββ webrtc.js # WebRTC manager
β βββ pages/ # Page components
β β βββ DashboardPage.jsx
β β βββ LoginPage.jsx
β β βββ SignupPage.jsx
β β βββ MeetingRoomPage.jsx
β βββ store/
β β βββ useStore.js # Zustand state management
β βββ App.jsx # Root component
β βββ main.jsx # Application entry
βββ .env.example # Environment template
βββ package.json # Dependencies
make build # Build the application
make run # Run the application
make test # Run tests- β JWT-based authentication with 24-hour token expiration
- β Bcrypt password hashing (no plaintext storage)
- β Environment-based configuration (no hardcoded secrets)
- β CORS protection with configurable origins
- β Password fields excluded from JSON responses
- β
.envfiles properly gitignored
Important: Read SECURITY.md before deploying to production.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a 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
This project is licensed under the MIT License.
Rishi Shanbhag
- GitHub: @rishishanbhag
Built with β€οΈ by Rishi