- Python 3.12
- PostgreSQL 16 for production-like local development
- Redis through Docker Desktop or WSL2
Python 3.13 may work, but Python 3.12 provides the widest third-party package compatibility.
cd enterprise-realtime-chat-api
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt
Copy-Item .env.example .envUpdate .env:
DATABASE_URL=sqlite:///./realtime_chat.db
REDIS_URL=
CORS_ORIGINS=http://localhost:3000,http://localhost:5173
TRUSTED_HOSTS=localhost,127.0.0.1,testserver
UPLOAD_DIR=./uploads
PUBLIC_MEDIA_BASE_URL=http://127.0.0.1:8000/mediaRun migrations and seed:
alembic upgrade head
python -m scripts.seed
uvicorn app.main:app --reloadSwagger: http://127.0.0.1:8000/docs
WebSocket: ws://127.0.0.1:8000/ws?token=<ACCESS_TOKEN>
Copy-Item .env.example .env
docker compose up --buildSeed:
docker compose exec api python -m scripts.seedThe project accepts either:
CORS_ORIGINS=http://localhost:3000,http://localhost:5173or:
CORS_ORIGINS=["http://localhost:3000","http://localhost:5173"]Confirm that the token user is an active conversation member and that Redis is reachable when running more than one API process.
Set PUBLIC_MEDIA_BASE_URL to the externally reachable API or CDN origin.
For the current terminal only:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1