Home

boring / v2

publicBoring-Software-Inc/v2
Overview Code History Branches Pull requestsIssuesInsights Campfire Docs
main
HomeOverview Code PRsIssues

feat(economics): pull Railway cost live from the GraphQL usage API

3 months ago

570184e
Authored
grim7/23/2026, 4:07:00 AM
Kill RAILWAY_USAGE_USD. The pull now queries Railway usage (grouped by service),
prices the quantities with rates verified 2026-07-22 against the real web/worker/
api totals, and stores per-service cost plus the raw quantities. A rates row
carries subscription prices for drift detection: if a price moves, the page warns
to re-verify. Rates live in one file (railway-rates.ts). Needs an account token;
a project token fails honestly (marked failed, page says so with last-pull time)
rather than a silent zero. Admin page shows the per-service split, quantities,
freshness, and the drift banner.

Parentefc0a0a

12 files changed
  • .env.example+5−3
  • apps/web/src/components/admin/economics-page.tsx+110−28
  • apps/web/src/lib/admin-economics.functions.ts+15−1
  • apps/web/src/lib/admin-economics.query.ts+9−0
  • apps/web/src/lib/server-fn-classification.ts+1−0
  • apps/worker/src/jobs/pull-provider-costs.test.ts+7−9
  • apps/worker/src/jobs/pull-provider-costs.ts+51−26
  • apps/worker/src/jobs/railway-cost.test.ts
+156
−0
  • apps/worker/src/jobs/railway-cost.ts+263−0
  • apps/worker/src/jobs/railway-rates.ts+34−0
  • packages/db/src/index.ts+2−0
  • packages/db/src/services/economics.ts+112−6