Contributing¶
Project structure¶
pathogen_genomics/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/v1/ # Route handlers
│ │ ├── models/ # SQLAlchemy ORM models
│ │ ├── schemas/ # Pydantic request/response schemas
│ │ └── services/ # Business logic
│ └── tests/
├── frontend/ # Next.js frontend
│ └── src/
│ ├── app/ # Pages (App Router)
│ ├── components/# React components
│ └── lib/ # API client, utilities
├── docs/ # Documentation (MkDocs)
└── mkdocs.yml # Docs config
Code conventions¶
Backend (Python)¶
- Async everywhere — All database operations use
async/await - Service layer — Business logic in
services/, not in route handlers - Pydantic schemas — Request/response validation via Pydantic v2
- Accession generation — Use
generate_accession()fromservices/accession.py
Frontend (TypeScript)¶
- App Router — Next.js App Router with
"use client"for interactive pages - React Query — All API calls via
useQuery/useMutation - shadcn/ui — UI components from shadcn/ui library
- Tailwind CSS — Styling via utility classes
Adding a new API endpoint¶
- Create or edit the route handler in
backend/app/api/v1/ - Add Pydantic schemas in
backend/app/schemas/ - Add business logic in
backend/app/services/ - Register the router in
backend/app/api/v1/router.py - Add tests in
backend/tests/
Adding documentation¶
- Create a new
.mdfile in the appropriatedocs/subdirectory - Add the page to the
navsection inmkdocs.yml - Preview locally with
mkdocs serve
Branching¶
main— Production-ready codefeature/*— Feature branchesfix/*— Bug fixes
Commit messages¶
Use conventional commits: