Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .cursor/rules/backend-fastapi.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
description: Python FastAPI backend conventions (SQLModel, routes, migrations)
globs: backend/**/*
alwaysApply: false
---

# Backend (FastAPI + SQLModel)

- App entry: `backend/app/main.py`; routers under `backend/app/api/routes/`, mounted in `app/api/main.py`.
- Use dependency types from `app/api/deps.py` (`SessionDep`, `CurrentUser`, etc.) instead of ad-hoc DB/session wiring.
- Models and Pydantic schemas live in `app/models.py`; persistence helpers in `app/crud.py`.
- Settings via `app/core/config.py` (`pydantic-settings`); never hardcode secrets.
- DB migrations: Alembic in `app/alembic/` — add revisions for schema changes; do not edit applied migration files.
- Lint/typecheck: Ruff + mypy (strict); run from `backend/` with `uv run ruff check app` / `uv run mypy app`.
- Tests mirror app layout under `backend/tests/`; use fixtures in `tests/conftest.py` and helpers in `tests/utils/`.
- Raise `HTTPException` for API errors; use SQLModel `select()` / `session.exec()` patterns consistent with existing routes.
17 changes: 17 additions & 0 deletions .cursor/rules/docker-compose.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
description: Docker Compose stack layout and local development commands
globs: compose*.yml
alwaysApply: false
---

# Docker Compose

- `compose.yml` — base stack (db, backend, frontend, prestart, traefik labels).
- `compose.override.yml` — dev overrides (volume mounts, local Traefik); applied automatically with `compose.yml`.
- `compose.traefik.yml` — production Traefik; not used for simple local dev.
- Configuration flows from `.env`; restart after env changes: `docker compose watch`.
- Services: backend `:8000`, frontend `:5173`, Adminer `:8080`, Mailcatcher `:1080`.
- Run backend prestart/migrations via the `prestart` service; backend image built from `backend/Dockerfile`.
- Logs: `docker compose logs [service]`; stop a service to run it locally on the same port (see `development.md`).

Do not commit production secrets in Compose files; use `.env` and documented env vars.
15 changes: 15 additions & 0 deletions .cursor/rules/frontend-react-bun.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
description: React frontend with Bun, Vite, TanStack Router, and generated API client
globs: frontend/**/*
alwaysApply: false
---

# Frontend (React + Bun)

- Package manager: **Bun** (`bun install`, `bun run dev`). Root `package.json` workspaces delegate to `frontend/`.
- Routes: TanStack Router in `frontend/src/routes/`; run dev server to regenerate `routeTree.gen.ts` — do not hand-edit it.
- UI: Tailwind + shadcn/ui components under `frontend/src/components/ui/`.
- API client is **generated** from OpenAPI (`frontend/src/client/`). Regenerate via repo-root `./scripts/generate-client.sh` after backend API changes.
- Lint/format: Biome — `bun run lint` in `frontend/`.
- E2E tests: Playwright in `frontend/tests/`; config in `playwright.config.ts`. Auth setup in `tests/auth.setup.ts`.
- Use existing hooks (`useAuth`, `useCustomToast`, etc.) and TanStack Query patterns already in the codebase.
27 changes: 27 additions & 0 deletions .cursor/rules/project-overview.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
description: Full-stack template overview, safe AI conventions, and test entrypoints
alwaysApply: true
---

# Project overview

Full-stack FastAPI template: Python API in `backend/`, React + Vite frontend in `frontend/`, orchestrated with Docker Compose. See `development.md` for local workflows.

## Safe conventions for AI-assisted work

- Never commit secrets: `.env`, generated keys, or credentials.
- Prefer minimal, focused diffs; do not remove unrelated code.
- After backend API/schema changes, regenerate the frontend client: `./scripts/generate-client.sh` (do not hand-edit `frontend/src/client/*`).
- Run linters via `uv run prek run --all-files` from repo root (or rely on pre-commit hooks).

## Test entrypoints

| Scope | Command |
|-------|---------|
| Full stack (CI-style) | `./scripts/test.sh` — builds Compose, runs backend pytest in container |
| Backend only (in Compose) | `docker compose exec backend bash scripts/tests-start.sh` |
| Backend pytest (local, in `backend/`) | `bash scripts/test.sh` (coverage + pytest on `tests/`) |
| Frontend E2E | `bun run test` (root) or `cd frontend && bun run test` |
| Frontend E2E UI mode | `bun run test:ui` |

Local dev: `docker compose watch`; backend alone: `cd backend && fastapi dev app/main.py`; frontend alone: `bun run dev`.