Skip to content

CI/CD

Product Factory uses Turborepo for build orchestration. CI/CD can be configured with any CI provider (GitHub Actions, GitLab CI, etc.) that supports pnpm.

CI Pipeline

A typical CI pipeline runs these steps on every push:

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm test
- run: pnpm build

Turborepo Caching

Turborepo caches task outputs and skips unchanged packages. In CI, enable remote caching for faster builds:

Terminal window
npx turbo login
npx turbo link

Or set the TURBO_TOKEN and TURBO_TEAM environment variables.

Deployment Strategy

Frontend Apps

Cloudflare Pages handles deployment automatically when connected to Git:

  1. Push to main triggers production deployment.
  2. Push to feature branches creates preview deployments.

Workers

Workers require explicit deployment via Wrangler:

Terminal window
pnpm --filter worker-gateway wrangler deploy

For automated worker deployment in CI:

- name: Deploy Workers
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: |
for worker in gateway auth billing ai content support admin; do
pnpm --filter worker-$worker wrangler deploy
done

Database Migrations

Run migrations before deploying workers that depend on schema changes:

Terminal window
pnpm db:migrate

In CI, migrations should run as a separate step before worker deployment.

Quality Gates

The following checks should pass before merging to main:

CheckCommandFailure Action
Type checkingpnpm typecheckBlock merge
Lintingpnpm lintBlock merge
Testspnpm testBlock merge
Buildpnpm buildBlock merge