Thermograph monorepo: graded-climate API + SSR frontend + infra, domain-specific containerized deploys
Find a file
Emi Griffith d17ac794fd Split the backend into domain packages (#217)
* Centralize filesystem paths in a single module

Add paths.py, which resolves the repo root once and derives the cache,
accounts DB, logs, templates, frontend and bundled-city-data locations
from it. Replace the 13 per-module `dirname(__file__)/..` anchors with
references to it, so a module's location no longer determines where the
app reads its data. Env overrides (accounts DB, VAPID, IndexNow) are
unchanged; every resolved path is byte-identical to before.

Groundwork for moving modules into packages without re-pointing paths.

Claude-Session: https://claude.ai/code/session_01XXxmNFy9cZ6Gh8Y9thZn62

* Split the backend into domain packages

Group the flat backend modules into packages that mirror their concerns:
  data/          climate, grading, scoring, grid, places, cities,
                 city_events, store
  web/           app, views, homepage, content, schemas
  notifications/ notify, digest, push, mailer, discord,
                 discord_interactions, discord_link
  accounts/      models, users, api_accounts, db
  core/          metrics, singleton, audit

Intra-project imports are rewritten to the package-qualified form. The
entry scripts (indexnow, warm_cities, migrate, gen_cities, gen_flavor)
and paths.py stay at the backend/ root, and backend/app.py becomes a
shim re-exporting web.app:app so the launch target stays `app:app` —
run.sh, the systemd units, and CI need no change.

Verified: full suite (318) passes, `uvicorn app:app` boots and serves
the home/SEO/static/API surfaces, and every root script imports clean.

Claude-Session: https://claude.ai/code/session_01XXxmNFy9cZ6Gh8Y9thZn62
2026-07-20 05:31:03 +00:00
accounts Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
core Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
data Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
notifications Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
templates Fix the footer leaking "wrapper. #}" from a broken Jinja comment (#211) 2026-07-20 04:14:56 +00:00
tests Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
web Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
app.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
cities.json SEO: values filter — trim cities in anti-LGBTQ countries, keep notable hubs (#102) 2026-07-16 02:20:41 +00:00
cities_flavor.json SEO: values filter — trim cities in anti-LGBTQ countries, keep notable hubs (#102) 2026-07-16 02:20:41 +00:00
gen_cities.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
gen_flavor.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
indexnow.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
migrate.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
paths.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00
requirements-dev.txt Add backend test suite; gate direct pushes; serialize LAN deploys (#41) 2026-07-11 19:37:49 +00:00
requirements.txt Serve a /grade Discord slash command over HTTP interactions (#207) 2026-07-20 02:19:29 +00:00
warm_cities.py Split the backend into domain packages (#217) 2026-07-20 05:31:03 +00:00