Deployment
Deployment
Section titled “Deployment”Bookmarks deployment is Cloudflare-first.
Release sequence
Section titled “Release sequence”- Create/verify D1 database
bookmarksand R2 bucketbookmarks-media. - Update
workers/bookmarks/api/wrangler.tomlbindings and IDs. - Deploy mail worker for auth notifications (
bookmarks-mail-workerpreferred target). - Deploy auth worker.
- Deploy API worker (
wrangler deploy). - Set
AUTH_MODE=serviceand bindAUTH_SERVICEto auth worker (cosmos-auth-workercurrent,bookmarks-auth-workertarget). - Set worker vars:
APP_URL=https://bookmarksapp.cosmosdigitalservices.comCORS_ORIGINSincludes deployed app origins.
- Deploy
apps/bookmarks/siteto Cloudflare Pages with canonical env:PUBLIC_BOOKMARKS_APP_URL=https://bookmarksapp.cosmosdigitalservices.com
- Build/deploy Flutter web and mobile with production API base URL.
Prerequisites
Section titled “Prerequisites”- Auth worker has
APP_URLset to deployed Bookmarks app URL. - Auth worker has healthy
MAIL_SERVICEbinding (bookmarks-mail-workerpreferred). JWT_SECRETandENCRYPTION_KEYare configured on auth worker.
Post-deploy smoke tests
Section titled “Post-deploy smoke tests”Run these in order after each production deploy:
GET /healthreturns{ ok: true, service: "bookmarks-api-worker" }.- Login flow works (
/v1/auth/loginand/v1/auth/refresh). - Session expiry handling works: expired refresh token redirects user to app login with session-expired notice.
/auth/open-appredirects tohttps://bookmarksapp.cosmosdigitalservices.com.- Email verification redirect lands on
/verify-emailwithverified=1orerror. - Authenticated
GET /v1/mereturns user context. - Create club (
POST /v1/clubs) returns201andclubId. - Member can open
/v1/clubs/:clubId/settings. - Admin can update club settings and member role.
- Note create/comment/reaction flow works.
- Meeting create/RSVP/calendar endpoints work.
/v1/clubs/:clubId/streamwebsocket connects for a member.- Realtime reconnects after app background/resume.
Rollback guidance
Section titled “Rollback guidance”If critical regressions are detected:
- Roll back worker to previous known-good deployment.
- Revert app/site to previous release artifact.
- Re-run smoke tests against rolled-back versions.
- If DB migration introduced incompatibility, halt write traffic and apply a tested corrective migration before re-enable.
Operational guidance
Section titled “Operational guidance”- Treat API worker as authorization and persistence boundary.
- Keep site deployment independent so marketing updates do not block app/API releases.
- Add direct R2 upload flows only when attachment throughput requires it.
- After logo updates, regenerate native launcher icons in
apps/bookmarks/appusingdart run flutter_launcher_icons.