Skip to main content

Deployment

Secrets (Worker, apps/api)

npx wrangler secret put JWT_SECRET # required
npx wrangler secret put BAKONG_WEBHOOK_SECRET # optional — enables the live KHQR webhook
npx wrangler secret put RESEND_API_KEY # optional — enables Super Admin OTP emails
npx wrangler secret put SECRET_STORE_KEY # required for the SA Integrations console to save credentials
npx wrangler secret put BOOTSTRAP_TOKEN # if you use a one-time owner-bootstrap route

Migrations

Applied in numeric order from apps/api/migrations/ — see the main README's Database section for the full list and what each one adds.

npx wrangler d1 execute tee-db --remote --file=migrations/0001_initial_schema.sql
# ...through the latest migration file, in order

Deploy manually

npm run deploy:api
for app in pos kds hq customer superadmin docs; do
npm run build -w apps/$app
npx wrangler pages deploy apps/$app/dist --project-name=tee-$app
done

(apps/docs builds to build/, not dist/ — see its own package.json build script; adjust the loop's dist path for that one app, or deploy it separately: npm run build -w apps/docs && npx wrangler pages deploy apps/docs/build --project-name=tee-docs.)

Auto-deploy via GitHub Actions

See .github/workflows/deploy.yml — one job per app, triggered on push to main. Add a deploy-docs job following the same pattern as deploy-customer if you want the docs site to auto-deploy too.

Rollback

Instant, no rebuild: npx wrangler deployments list (in apps/api) then npx wrangler rollback <version-id>.