Data layer
D1, R2 & Secrets
The three sites communicate through shared server-side resources. Bind them correctly and keep secrets out of source control.
D1 setup
- Create the D1 database.
- Open its console/query interface.
- Run the full
command-app/command-schema.sql. - Verify
team_members, content, site override, presentation, advertising, analytics, and operations tables exist. - Bind the database as
COMMAND_DBto Command, Iridesceux, and HVN Pages Functions. - Redeploy all projects after adding bindings.
R2 setup
- Create a private R2 bucket for Command/HVN approved assets.
- Bind it as
COMMAND_ASSETSwhere the code expects it. - Keep originals/private assets private; deliver public-approved content only through controlled media routes.
- Do not store master encryption keys in D1 or R2.
Command variables and secrets
| Name | Purpose |
|---|---|
BOOTSTRAP_ADMIN_EMAIL | First founder/Super Admin. |
CF_ACCESS_TEAM_DOMAIN | Access team/issuer domain used for JWT verification. |
CF_ACCESS_AUD | Audience tag for the Command Access app. |
COMMAND_REQUIRE_ACCESS_JWT=true | Require cryptographic Access JWT validation in production. |
COMMAND_MASTER_KEY | Encryption key for the operational secret vault. |
BROADCAST_AGENT_TOKEN | Additional app-layer token for the trusted OBS agent. |
IRIDESC_EUX_GITHUB_* | Iridesceux Code Studio integration. |
HVN_GITHUB_* | HVN Code Studio integration. |
Never commit secrets to Git. Put secret values in Cloudflare environment/secrets. If a token is ever exposed in chat, a screenshot, source code, or a public log, revoke/rotate it.
Upload-size reality
Command's broadcast/ad browser uploader intentionally caps a single creative below Cloudflare's common request-body ceiling. This is for station IDs, station bugs, short promos and normal ad creatives—not giant program masters.
Large master files: use a direct/multipart R2 ingest workflow rather than pushing a huge master through a Pages Function form upload. Always test your actual Cloudflare plan and representative media before launch.
Binding test
- Bind D1 as
COMMAND_DB. - Bind R2 as
COMMAND_ASSETS. - Redeploy.
- Run
/setup-doctor.html. - Upload a disposable station-bug image.
- Refresh Command and confirm the inventory record remains.
- Preview the asset through the protected media-preview route.