Development Workflow
Tome of Sessions is a full-stack app with a Vite/React frontend, FastAPI backend, PostgreSQL database, and AI/RAG services. Most changes cross at least two boundaries, so keep the API contract and feature ledger in sync.
Local Setup
From the repository root:
docker compose up -d
cp server/.env.example server/.env
npm run install:all
Run the app in watch mode:
./start.sh
The app runs on http://localhost:5559 by default and proxies API/upload
requests to the FastAPI server on :4000. The launcher also serves this docs
site with the Docusaurus dev server on http://localhost:3050 (override with
DOCS_PORT). ./stop.sh frees all three ports.
Branching & Pull Requests
Direct pushes to main are not allowed. Every change lands through the same
flow:
- Branch off the latest
main(feat/…,fix/…,docs/…,chore/…). - Commit on the branch and push it to the remote (
git push -u origin <branch>). - Open a pull request against
mainand wait for CI to pass. The PR description follows the What / Why / How template in.github/PULL_REQUEST_TEMPLATE.md(GitHub pre-fills it), and the PR title follows the Conventional Commits format —type(scope): imperative lowercase summary, withtypeone offeat/fix/docs/test/refactor/chore/ci/perf(e.g.fix(encounters): carry statBlockRef through AI suggestions). - Merge through the PR.
Continuous Integration
.github/workflows/ci.yml runs on every pull request (and on main after a
merge) with three jobs:
- server —
uv sync,uv run ruff check .,uv run pytestagainst an ephemeral pgvector Postgres service on:5433(the integration conftest creates thetome_py_testdatabase itself). - web —
npm ci,npm run build(type-check + production build),npm test. - docs-site —
npm ci,npm run build(broken links fail the build).
A PR must be green on all three jobs before merging.
Verification Commands
Run these before considering a code change complete:
cd server
uv run pytest
uv run ruff check .
cd ../web
npm run build
For docs-only changes, run the docs build too:
npm install --prefix docs-site
npm run docs:build
Feature Ledger Rule
Every feature addition, change, or removal must update the Features page in the same
change. Move items between planned, in-progress, and done when relevant, add new
entries, and keep the _Last updated_ date current.
The practical rule: if a user can notice it, a developer depends on it, or an API contract changed, the Features page should mention it.
Change Flow
- Read the existing code and nearby tests first.
- If request/response shapes change, update backend schemas/serializers and frontend DTO/API helpers together.
- Add or adjust tests around the behavior you changed.
- Run backend tests, backend lint, and frontend build.
- Update
README.md, this docs site, and the Features page when the workflow, architecture, API, or user-facing behavior changes.
Common Working Areas
| Area | Start Here |
|---|---|
| Backend route | server/app/routers/, server/app/schemas.py, server/app/serializers.py |
| Authorization | server/app/deps.py, server/app/lib/access.py |
| Database schema | server/app/models.py, server/alembic/versions/ |
| Frontend API call | web/src/lib/api.ts, web/src/types.ts |
| Campaign UI | web/src/screens/CampaignDetail.tsx, campaign sub-screens, shared components |
| Sage AI | server/app/lib/rag/, server/app/lib/tools/, server/evals/ |