Full-stack Real-Time Chat Application Backend using FastAPI, PostgreSQL, and WebSockets.
- Google Authentication (No password login).
- Real-Time Chat using native WebSockets.
- Room/Group Management: Create rooms, join rooms.
- Video/Audio Calls: WebRTC Signaling over WebSockets (Mesh Network).
- PostgreSQL Database with SQLAlchemy ORM.
- Clone the repository.
- Create Virtual Environment:
python -m venv venv .\venv\Scripts\activate
- Install Dependencies:
pip install -r requirements.txt
- Configuration:
- Update
.envfile with your PostgreSQL credentials and Google Client ID.
DATABASE_URL=postgresql+psycopg2://user:password@localhost/dbname GOOGLE_CLIENT_ID=your-google-client-id SECRET_KEY=your-secret-key
- Update
- Run the Server:
The server will start at
uvicorn app.main:app --reload
http://127.0.0.1:8000. API Documentation:http://127.0.0.1:8000/docs.
POST /login/google: Authenticate with Google Token.GET /users/me: Get current user info.GET /api/rooms: Get my rooms.POST /api/rooms: Create a new room.GET /api/rooms/{id}/messages: Get room history.WS /ws?token={jwt}: WebSocket connection for Chat and WebRTC.