Desi-Clans/backend/README.md
2026-10-08 02:52:58 +05:30

1.4 KiB

Desi Clans — Backend

FastAPI application with layered architecture, PostgreSQL, SQLAlchemy, Alembic, and JWT-ready configuration.

Layout

app/
├── main.py              # Application factory
├── core/                # Settings, dependencies, errors
├── db/                  # SQLAlchemy engine, session, Base
├── models/              # ORM entities & enums
├── schemas/             # Pydantic request/response models
├── api/                 # API routers
│   └── routes/          # Route modules (health, …)
├── services/            # Business logic
└── utils/               # Storage and helpers

Legacy route modules under app/routers/ remain for a future mount phase.

Prerequisites

  • Python 3.11+
  • PostgreSQL 15+ (local or Docker)

Setup

cd backend
python -m venv .venv
# Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env

Start Postgres (from repo root):

docker compose up -d db

Run migrations and optional seed:

python scripts/migrate.py
python scripts/seed_catalog.py
python scripts/seed.py

Start API:

uvicorn app.main:app --reload --port 8000

Health (includes DB check): http://localhost:8000/api/health

Tests

pytest tests/

Environment

Copy .env.example to .env. Required: DATABASE_URL, SECRET_KEY.