This repository contains two major components:
- A WebSocket server written in Node.js
- A FastAPI backend (Python) served using uvicorn with uv for environment management
Make sure you have the following installed:
- Node.js (for the WebSocket server)
- Python 3.10+
- uv (a modern Python packaging tool)
- Git (to clone the repository)
[bash] git clone cd Part 1: WebSocket Server Setup (Node.js) Initialize & Install Dependencies [bash] npm init -y npm install ws Run the WebSocket Server [bash] node server.js Part 2: FastAPI Backend Setup (Python with uv) Make sure uv is installed globally. If not, install it using: pip install uv
Setup Virtual Environment If this is your first time setting it up, run:
[bash] uv venv On Windows [powershell] Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted .venv/Scripts/Activate.ps1 On Linux/macOS [bash] source .venv/bin/activate To deactivate the environment:
[bash] deactivate Install Python Dependencies Inside the project folder, ensure main.py is present.
[bash] uv add
uv sync # If dependencies are listed in pyproject.toml Run the FastAPI Server [bash] uvicorn main:app --reload File Structure [bash] ├── server.js # WebSocket server ├── main.py # FastAPI backend ├── pyproject.toml # Python dependencies (if using uv) └── README.md # This file Notes Make sure ports used by the WebSocket and FastAPI servers do not conflict.
Always activate the Python virtual environment before running Python-related commands.