Skip to main content

Deployment Guide

All three AYTS services deploy to Cloudflare Workers via wrangler.

Prerequisites

  • Node.js 18+
  • Wrangler CLI: npm install -g wrangler
  • Cloudflare account with Workers + R2 access
  • Supabase project configured

Required Secrets (set once)

Run these before the first production deploy:

cd ayts-api

wrangler secret put SUPABASE_SERVICE_ROLE_KEY --env production
wrangler secret put JWT_SECRET --env production
wrangler secret put PAYMONGO_SECRET_KEY --env production
wrangler secret put PAYMONGO_WEBHOOK_SECRET --env production
wrangler secret put RESEND_API_KEY --env production
wrangler secret put SEMAPHORE_API_KEY --env production

Deploy Order

Always deploy API first, then frontends.

1. Deploy API

cd ayts-api
npx wrangler deploy --env production

2. Deploy Storefront (ayts-fe)

cd ayts-fe
npm run build
npx wrangler pages deploy .next

Deployed automatically via GitHub Actions on push to main in king05-dev/ayts.

3. Deploy Admin (ayts-admin)

cd ayts-admin
npm run build
npx wrangler pages deploy .next

Deployed automatically via GitHub Actions on push to main in king05-dev/ayts-admin.

caution

The API does NOT have GitHub Actions CI/CD. Deploy it manually with wrangler deploy.

Environment Variables

Public variables (safe to commit in wrangler.toml [vars])

[vars]
NEXT_PUBLIC_API_URL = "https://ayts-api.jerquinbayudo.workers.dev"
NEXT_PUBLIC_R2_PUBLIC_URL = "https://pub-cfc3656f8fe64c31862884b05a8159ad.r2.dev"
Never commit secrets

SUPABASE_SERVICE_ROLE_KEY, JWT_SECRET, PAYMONGO_SECRET_KEY, and PAYMONGO_WEBHOOK_SECRET must be set via wrangler secret put — never in wrangler.toml.

Local Development

# Terminal 1 — API
cd ayts-api
cp .dev.vars.example .dev.vars # fill in your secrets
npm run dev # http://localhost:3011

# Terminal 2 — Storefront
cd ayts-fe
npm run dev # http://localhost:3000

# Terminal 3 — Admin
cd ayts-admin
npm run dev # http://localhost:3001

Infrastructure Checklist

ItemStatus
Cloudflare R2 bucket ayts existsVerify in CF dashboard
Supabase PgBouncer enabledEnable for production
Supabase daily backupsEnable in Supabase settings
PayMongo webhook URL registeredhttps://ayts-api.jerquinbayudo.workers.dev/api/webhooks/paymongo
GitHub Actions for FE + AdminConfigured in king05-dev/ayts
GitHub Actions for APINot configured — manual deploy

Production URLs

ServiceURL
Storefronthttps://ayts.jerquinbayudo.workers.dev
Adminhttps://ayts-admin.jerquinbayudo.workers.dev
APIhttps://ayts-api.jerquinbayudo.workers.dev
API Healthhttps://ayts-api.jerquinbayudo.workers.dev/health