The console
Repo map, env vars, and APIs for the Backpack control plane.
Live at sites.backpackops.com (Vercel project site-editor). Next.js App Router, shadcn/ui, Geist, light/dark. Password gate (EDITOR_PASSWORD) until real auth lands; real auth is the top platform risk.
Module nav
Sites, Content, Analytics, Inbox, Social, Money, Tasks. The last four are env-configured link-outs (see Modules).
Key paths
lib/sites.ts: approved-sites registry (registry.json in the console repo). Only approved sites appear or are editable. resolveSite enforces approval and a connected repo.lib/github.ts: GitHub API wrapper. Notable: commitFiles (atomic multi-file commits via git trees), branch ops for previews, compareBranches for deep links.lib/vercel.ts: projects, domains, deployments, previewFor(branch), promote-based rollback (requires prj_ id, not the name).lib/ai.ts: gateway models, EDIT_SYSTEM contract, edit validation.lib/cms.ts: CMS v2 engine (see CMS).lib/umami.ts: Umami API client, live-page tracking-id resolution.lib/seo.ts: title/meta/OG parsing and upsert.app/api/sites/[site]/...: per-site APIs (pages, seo, deployments, domains, events, analytics, collections, collections/ai, ai/stream, drafts).app/sites/[site]/workspace.tsx: per-site workspace with section sidebar. Deep links:?section=collections&collection=<id>.
Per-site workspace sections
Overview (production hero, deployments table with instant restore), AI Editor (streamed agent trace, model picker, drafts with preview deep links), SEO & Meta (with AI autofill), Collections (the CMS), Analytics (Umami stats + dashboard link), Domains, Events (legacy, NAACP only).
Env vars (names only)
EDITOR_PASSWORD, GITHUB_TOKEN, VERCEL_TOKEN, UMAMI_USERNAME, UMAMI_PASSWORD, EDIT_MODEL, INBOX_URL, SOCIAL_URL, MONEY_URL, TASKS_URL.
Known sharp edges
- VERCEL_TOKEN from the CLI expires every 8 hours (see ADR 10). Symptom: “Unknown project” errors everywhere. Fix: durable dashboard token.
- Env var changes on Vercel require a redeploy to take effect.
- The Vercel promote API needs the prj_ id resolved from the project first.