Creating An App
Use this when adding a new Cloudflare app under apps/.
Keep the app contract small. Each app owns a handful of tsx scripts under
apps/<app>/scripts/, exposed as package scripts and built on the shared deploy
primitives in scripts/lib/ (see scripts/lib/deploy-app.ts):
deploy—pnpm run deploy --env <name>(build → wrangler deploy with atomic secrets → smoke)ensure-resources— create-only Cloudflare resource provisioningerase-data— wipe an env's data without deleting the workergen:wrangler— expand the generated, gitignoredwrangler.jsoncfrom the rootenvs.tstest:e2eif the app has live preview tests
The package scripts should own only the app action. Doppler selection belongs
outside the app script (doppler run --config <env> -- pnpm run deploy).
CI Workflows#
CI and deploy workflows are hand-written Depot CI YAML in .depot/workflows/
(see docs/depot-ci.md).
The current pattern is:
- Copy an existing deploy workflow (for example
.depot/workflows/deploy-semaphore.yml) to.depot/workflows/deploy-<app>.ymland edit the app name, Doppler project, deploy command, andpathsfilters directly. - If the app participates in PR previews, wire it into the repo preview
router in
scripts/preview/preview.ts. - Depot registers triggers from the default branch, so a new workflow file
only starts running after it lands on
main.
Preview deploys do not live in app-local routers anymore. They run through the repo preview router:
doppler run --project _shared --config prd -- pnpm preview sync --pull-request-number 1234
doppler run --project _shared --config prd -- pnpm preview cleanup --pull-request-number 1234Workflow rules:
- PR pushes deploy a leased
preview_N - pushes to
maindeployprd - PR deploys update the managed preview section in the PR body
maindeploy successes and failures post to Slack viascripts/ci/notify.ts
Do not add preview logic back into apps/<app>/scripts/router.ts just to satisfy CI.
Doppler#
Use the new-doppler-project skill for the project/config setup.
The app package should work with:
doppler run --project <app> --config preview_2 -- pnpm run deploy --env preview_2
doppler run --project <app> --config prd -- pnpm run deploy --env prd