No description
  • Python 99.3%
  • Dockerfile 0.7%
Find a file
PoweredDeveloper 5dc49b89ce
All checks were successful
Lint and test / lint-and-test (push) Successful in 37s
fix: incorrect type for issue template
2026-06-09 23:55:22 +03:00
.forgejo fix: incorrect type for issue template 2026-06-09 23:55:22 +03:00
app feat: initial backend template 2026-06-09 19:45:18 +03:00
tests feat: initial backend template 2026-06-09 19:45:18 +03:00
.env.example feat: initial backend template 2026-06-09 19:45:18 +03:00
.gitignore feat: initial backend template 2026-06-09 19:45:18 +03:00
docker-compose.yml feat: initial backend template 2026-06-09 19:45:18 +03:00
Dockerfile feat: initial backend template 2026-06-09 19:45:18 +03:00
pyproject.toml feat: initial backend template 2026-06-09 19:45:18 +03:00
README.md feat: initial backend template 2026-06-09 19:45:18 +03:00

Chat Backend

FastAPI backend for a Telegram-like chat app with direct messages, groups, and channels.

Features

  • Direct messages — 1:1 conversations between users
  • Groups — multi-user chats where all members can post
  • Channels — broadcast rooms; only owners/admins post, subscribers read
  • JWT authentication
  • PostgreSQL + async SQLAlchemy

Quick start

# Start PostgreSQL and API
docker compose up --build

# API docs: http://localhost:8000/docs

Local development with uv

docker compose up db db-init -d

uv sync --dev
export DATABASE_URL=postgresql+asyncpg://chat:chat@localhost:5432/chat
export TEST_DATABASE_URL=postgresql+asyncpg://chat:chat@localhost:5432/chat_test

uv run uvicorn app.main:app --reload

Tests

docker compose up db db-init -d
uv run pytest tests/unit -v
uv run pytest tests/e2e -v

API overview

Method Path Description
POST /api/auth/register Register user
POST /api/auth/login Login (OAuth2 form)
GET /api/auth/me Current user
POST /api/conversations/dm/{user_id} Start or get DM
POST /api/conversations Create group or channel
GET /api/conversations List user's conversations
POST /api/conversations/{id}/messages Send message
GET /api/conversations/{id}/messages List messages