Directory Layout
This is the lay of the land. The backend, worker, and parsers are Python; the frontend is a Vite app; the docs are this Astro Starlight site. The one structural idea worth internalizing is the ArtifactSpec registry in core/artifacts/ — it’s what makes a new artifact type a single registration instead of a change in four places.
.├── api/ # FastAPI app, routers, dependencies, schemas│ ├── main.py # create_app factory + uvicorn entrypoint│ ├── routes/ # REST routers (backups + per-artifact + search/timeline/report)│ ├── schemas.py # Pydantic response/request models│ └── security.py # Header-based auth dependencies├── core/ # Shared domain logic│ ├── artifacts/ # ArtifactSpec registry + uniform ingest (one registration per type)│ ├── backupfs/ # Filesystem & session cache helpers│ ├── config/ # Pydantic settings + env wiring│ ├── db/ # SQLAlchemy models + async sessions│ ├── queue.py # Redis/RQ helpers│ └── services/ # Backup registry, unlock manager, etc.├── worker/ # RQ worker tasks + CLI entrypoints├── parsers/ # SQLite artifact parsers (photos, messages, etc.)├── alembic/ # Database migrations (applied on backend startup)├── frontend/ # React + Vite SPA served via nginx│ ├── src/main.tsx # Entry point (mounts the app in an ErrorBoundary)│ ├── src/AppNew.tsx # Root component + app state machine│ ├── src/pages/ # Screen components (BackupSelector, PasswordPrompt, Explorer)│ ├── src/pages/modules/ # Per-artifact modules rendered inside the Explorer│ ├── src/components/ # Cross-cutting components (ErrorBoundary)│ └── src/lib/ # Typed fetch client (api.ts), types.ts, csv.ts├── Dockerfile.backend # Multi-stage build for backend + worker├── Dockerfile.frontend # Vite build + nginx runtime├── docker-compose.yml # Orchestrates Postgres, Redis, backend, worker, frontend├── docs/ # Astro Starlight documentation (this site)└── README.md # Quick summary + developer commandsSupporting files worth knowing
Section titled “Supporting files worth knowing”pyproject.tomldefines the package metadata and the console scripts, includingapple-juicer-worker.alembic/plusalembic.inihold the migrations. They apply toheadautomatically on backend startup; add a revision whenever the models change..dockerignorekeepsnode_modules,.venv, and friends out of the Docker build context.
Adding a new artifact type
Section titled “Adding a new artifact type”The registry is what keeps this to one place per concern:
- Add a parser under
parsers/that reads the source SQLite database into records. - Register an
ArtifactSpecincore/artifacts/registry.py— parser, ORM models, schemas, ingest, and router. The worker and the API both iterate the registry, so this one registration wires up indexing, the search rows, and the extraction targets. - Add a frontend module under
frontend/src/pages/modules/, a tab inExplorer, and a typed helper infrontend/src/lib/api.ts. - Generate an Alembic revision for any new tables, and add a sidebar entry in
docs/astro.config.mjsif you write a new docs page.