- Add .claude/claude.md with project context - Add .claude/settings.local.json with Python/npm/SSH permissions - Add .claude/commands/ (migrate, deploy, import-data) - Add .claude/agents/verify_fediversion.md Full Boris-style workflow configuration for Fediversion repo. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
7 KiB
7 KiB
Project Overview
Name: Fediversion Type: Full-stack web application (Python FastAPI + Next.js) Primary Languages: Python (backend), TypeScript (frontend) Status: Active development
High-Level Description
Fediversion is a unified setlist tracking, rating, and community platform for jam bands. It supports multiple bands (Goose, Phish, Grateful Dead, Dead & Company, Billy Strings) from a single account using a "vertical" architecture.
Architecture:
Frontend (Next.js 16) → Backend (FastAPI) → Database (PostgreSQL/SQLite)
↓
Data Importers (Phish.net, Setlist.fm, Grateful Stats)
Supported Bands:
- 🦆 Goose (El Goose API) - Active
- 🐟 Phish (Phish.net API v5) - Ready
- 💀 Grateful Dead (Grateful Stats API) - Ready
- ⚡ Dead & Company (Setlist.fm) - Ready
- 🎸 Billy Strings (Setlist.fm) - Ready
Layout
fediversion/
├── backend/ # FastAPI backend
│ ├── importers/ # Band-specific data importers
│ │ ├── base.py # Abstract base class
│ │ ├── phish.py # Phish.net API
│ │ ├── grateful_dead.py # Grateful Stats API
│ │ └── setlistfm.py # D&C, Billy Strings
│ ├── routers/ # API endpoints
│ ├── models.py # SQLModel database models
│ ├── alembic/ # Database migrations
│ └── main.py # FastAPI app entry
├── frontend/ # Next.js 16 frontend
│ ├── app/ # App router
│ ├── components/ # React components
│ └── package.json
├── docs/ # Documentation
├── email/ # Email templates
├── docker-compose.yml # Local development
└── DEPLOY.md # Deployment guide
Conventions
Language/Style
- Backend: Python 3.11+, FastAPI, SQLModel, Alembic
- Frontend: Next.js 16, React 19, Radix UI, Tailwind CSS
- TypeScript strict mode enabled
- Conventional commits for git messages
Package Managers
- Backend:
pipfor Python dependencies - Frontend:
npmfor Node.js dependencies
Database (Alembic)
- Migrations in
backend/alembic/ - Create migration:
alembic revision --autogenerate -m "description" - Apply migrations:
alembic upgrade head - Downgrade:
alembic downgrade -1
Error Handling
- Backend: FastAPI exception handlers
- Frontend: Error boundaries and proper toast notifications
- Never expose sensitive data in error messages
Logging
- Backend: Python logging module
- Frontend: Console in dev, structured logging in prod
Config
- Backend: Environment variables via
python-dotenv - Frontend: Next.js env vars (
NEXT_PUBLIC_*) - Never hard-code secrets or API keys
Patterns & Playbooks
How to Run Locally
Backend (port 8000):
cd backend
pip install -r requirements.txt
alembic upgrade head
uvicorn main:app --reload --port 8000
Frontend (port 3000):
cd frontend
npm install
npm run dev
Full Stack (Docker):
docker compose up -d
How to Write Database Migrations
- Modify models in
backend/models.py - Generate migration:
cd backend alembic revision --autogenerate -m "description" - Review migration in
backend/alembic/versions/ - Apply migration:
alembic upgrade head
How to Add a New Band Importer
- Create importer in
backend/importers/{band}.py - Inherit from
BaseImporterclass - Implement required methods:
fetch_shows,parse_show, etc. - Add entry point to
__main__.pyor create standalone script - Test with:
python -m importers.{band}
How to Add API Endpoints
- Create router in
backend/routers/ - Use FastAPI decorators:
@router.get("/path") - Register in
backend/main.py:app.include_router(router) - Add request/response models with SQLModel or Pydantic
- Add error handling for edge cases
How to Add Frontend Components
- Create component in
frontend/components/ - Use Radix UI primitives + Tailwind styling
- Follow existing patterns (class-variance-authority, clsx)
- Export from component index file if needed
- Use Next.js app router for pages
VPS Deployment (nexus-vector)
Deploy to VPS:
ssh admin@nexus-vector 'cd /path/to/fediversion && git pull && docker compose down && docker compose up -d --build'
Run migrations:
ssh admin@nexus-vector 'cd /path/to/fediversion/backend && alembic upgrade head'
Verify:
ssh admin@nexus-vector 'docker compose ps'
ssh admin@nexus-vector 'docker compose logs --tail 50'
Important Environment Variables
Backend
DATABASE_URL: PostgreSQL/SQLite connection stringSECRET_KEY: JWT secret for authenticationPHISHNET_API_KEY: Phish.net API accessSETLISTFM_API_KEY: Setlist.fm API access
Frontend
NEXT_PUBLIC_API_URL: Backend API URLNEXT_PUBLIC_APP_URL: Frontend URL
Data Import
Import Goose data:
cd backend
python import_elgoose.py
Import Phish data:
cd backend
python -m importers.phish
Import from Setlist.fm (D&C, Billy Strings):
cd backend
python -m importers.setlistfm deadco
python -m importers.setlistfm bmfs
Core Concept: Verticals
Fediversion uses the "Vertical" model to support multiple bands:
class Vertical(SQLModel):
name: str # "Phish"
slug: str # "phish"
description: str
class Show(SQLModel):
vertical_id: int # Links to band
# ...
Routes support both:
- Single-band:
/shows - Multi-band:
/phish/shows
Testing Strategy
- Backend: pytest with httpx for API tests
- Frontend: Jest for component tests
- E2E: Manual testing of critical flows
- Build verification: Both backend and frontend must build successfully
PR & Learning Workflow
- When a PR introduces a new pattern or fixes a subtle issue:
- Summarize the lesson in 1-2 bullets
- Append under "Patterns & Playbooks" above
- Consider updating relevant documentation in
docs/
Multi-Band Considerations
Data Source Integration
- Each band has a different API (Phish.net, Setlist.fm, Grateful Stats)
- Importers abstract away API differences
- All data normalizes to common models (Show, Song, Venue, etc.)
Route Patterns
- Global routes:
/shows,/venues,/songs(all bands) - Vertical-specific routes:
/phish/shows,/dead/venues(single band) - Frontend handles both patterns with dynamic routing
Performance
- Database indexes on
vertical_idfor efficient filtering - API response caching for frequently accessed data
- Importers run asynchronously via background tasks
Deployment Notes
- VPS: nexus-vector (100.95.3.92)
- User: admin
- Database: PostgreSQL in production, SQLite for local dev
- Reverse Proxy: Traefik (configured in
traefik-routes.yml) - Containers: backend, frontend, db (PostgreSQL)