Deployment
Deploy to Cloudflare
-
Ensure Cloudflare resources exist
Follow Cloudflare Setup to create your D1 database, R2 bucket, and KV namespace.
-
Set secrets
Terminal window wrangler secret put AUTH_JWT_SECRETFor OIDC auth:
Terminal window wrangler secret put OIDC_ISSUERwrangler secret put OIDC_AUDIENCE -
Run remote migrations
Terminal window wrangler d1 migrations apply alokon-db --remote -
Build and deploy
Terminal window yarn deployThis runs
yarn build(Vite + Wrangler bundle) thenwrangler deploy.
What gets deployed
- Worker —
src/server/index.tsbundled by Wrangler - Static assets —
dist/(React SPA) uploaded to Cloudflare’s asset storage and served via theSTATIC_ASSETSbinding
The Worker serves API routes at /api/* and falls back to the SPA index.html for all other paths.
Environment-specific deployments
Use Wrangler environments to deploy to multiple stages:
"env": { "staging": { "name": "alokon-staging", "vars": { "ENVIRONMENT": "staging" } }}Deploy to staging:
wrangler deploy --env stagingContinuous deployment
A typical GitHub Actions workflow:
name: Deploy
on: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: yarn install --frozen-lockfile - run: yarn build working-directory: apps/alokon - run: yarn wrangler deploy working-directory: apps/alokon env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}Custom domain
In the Cloudflare dashboard:
- Go to Workers & Pages → alokon → Settings → Triggers
- Under Custom Domains, click Add Custom Domain
- Enter your domain (e.g.
cms.example.com) - Cloudflare automatically provisions an SSL certificate
Updating
To deploy an update:
git pullyarn installcd apps/alokonyarn deployIf there are new migrations:
wrangler d1 migrations apply alokon-db --remoteThen deploy.