A production-oriented foundation for a Telegram Web style chat application using only Python for backend and server-side rendering.
- FastAPI async backend + WebSocket stream endpoint.
- Jinja2-rendered Telegram-inspired web shell.
- Environment-driven feature toggles via
FeatureManager. - Runtime protocol auto-detection (
http/httpsandws/wss) usingEnvironmentDetector. - Async SQLAlchemy models and Alembic migration starter.
- Admin CLI for user-management tasks.
- Pytest suite for critical behavior checks.
app/application sourcetests/pytest suitemigrations/alembic migration filesdocs/architecture and design notes.env.exampleconfiguration template
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
cp .env.example .env
uvicorn app.main:app --reloadOpen http://127.0.0.1:8000.
All major capabilities are controlled by environment variables in .env.example.
Disabled features are represented in the admin matrix endpoint (GET /api/admin/features) and can be excluded from route behavior at runtime.
POST /api/auth/registerPOST /api/auth/loginPOST /api/auth/verify-emailWS /api/streamGET /api/chatsGET /api/chats/{id}/messagesPOST /api/chats/{id}/messagesGET /api/health
python -m app.cli.manage deactivate-user 42pytestThis repository now provides a complete modular baseline for the requested Telegram clone architecture in pure Python. It includes protocol adaptation, feature matrix controls, migrations scaffold, and test coverage for core runtime toggles.