Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion specs/epics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ folder is the adoption; the merge creates the epic in the workspace.

| Epic | Cluster | Status | What it is |
|------|---------|--------|------------|
| [`saas-starter/`](./saas-starter/) | **SA** | Draft | Vercel's Next.js SaaS Starter, equivalent in code and function, on Cloudflare Workers with Supabase Postgres through Hyperdrive |
| [`saas-starter/`](./saas-starter/) | **SA** | ✅ Shipped | Vercel's Next.js SaaS Starter, equivalent in code and function, on Cloudflare Workers with Supabase Postgres through Hyperdrive |

As-built ≠ intent: what shipped lives in each epic's `IMPLEMENTATION-STATUS.md`.
2 changes: 1 addition & 1 deletion specs/epics/saas-starter/IMPLEMENTATION-STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ template is kept as written rather than edited to satisfy the linter.
`getUser()` logs `connection attempt failed` and `/api/user` answers 500:
the query went through `env.HYPERDRIVE` to `localhost:54322`, where
nothing was listening — the binding path, exercised.
- CI: `Checks` green on #2, #3, #4 and #5.
- CI: `Checks` green on #2, #3 and #4 (#5 is documentation).
- Not verified: an apply of either Terraform root, a `db-migrate` apply, a
live deploy and a checkout against a real Stripe account — all need the
product linked to an Orun workspace with Supabase and Cloudflare
Expand Down
4 changes: 2 additions & 2 deletions specs/epics/saas-starter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ The upstream code stays the code: the Drizzle schema and queries, the server act

| Field | Value |
|-------|-------|
| Status | Draft |
| Status | ✅ Shipped — SA0–SA4 landed (#1–#5); the Supabase and Hyperdrive applies, the db-migrate apply and a live deploy are gated on a linked workspace |
| Cluster | **SA** (SA0–SA4) |
| Owner(s) | `apps/web` (the app) · `packages/db` (the migrations and their runner) · `tests/web`, `tests/db` · `infra/terraform/supabase`, `infra/terraform/cloudflare-hyperdrive`, `infra/db-migrate` |
| Builds on | `lumen` conventions — the `supabase` and `cloudflare-hyperdrive` Terraform roots, `@saas/db` + `db-migrate`, the per-request `postgres` client; `cirrus-baseline` conventions for the repository shape |
| Upstream | [nextjs/saas-starter](https://github.com/nextjs/saas-starter) (`6e33e58`, Next 15.6 canary) |
| Changes | Adds the Workers build, the monorepo wrapper, tests, the migrations package, the three infra components and the deploy contract; in the template's code: `lib/db/drizzle.ts` (per-request client), `middleware.ts` → `proxy.ts`, the Stripe client's fetch transport and the webhook's async signature check |
| Decisions locked | (1) OpenNext on Workers + Static Assets. (2) Drizzle over a Postgres socket through Hyperdrive, not PostgREST and not D1. (3) A `postgres` client per request — never a module-level pool. (4) `wrangler.jsonc` rendered per environment from the Hyperdrive wiring document; never committed. (5) drizzle-kit stays for local development; the runner applies in CI. (6) `AUTH_SECRET`, `STRIPE_SECRET_KEY`, `STRIPE_WEBHOOK_SECRET` are Worker secrets set once per environment; `BASE_URL` is a wrangler var. |
| Gate | SA1 is the first user-visible rung. SA2 and SA3 need a workspace with Supabase and Cloudflare connections to apply; they are verified by `plan` and `terraform validate`. |
| Shipped as | — |
| Shipped as | `main` after [#5](https://github.com/sourceplane/saas-starter/pull/5); verified locally under `wrangler dev` with the fixture config and a throwaway `.dev.vars` |

## Read order

Expand Down
2 changes: 1 addition & 1 deletion specs/epics/saas-starter/epic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
spec:
title: "Vercel's Next.js SaaS Starter on Cloudflare Workers with Supabase Postgres through Hyperdrive"
summary: "The Next.js SaaS Starter — Postgres through Drizzle, Stripe Checkout, Customer Portal and webhooks, email/password auth with a jose JWT in a cookie, a session-refreshing middleware, teams with roles, invitations and an activity log — runs on Cloudflare Workers + Static Assets through @opennextjs/cloudflare. Its Postgres is the Supabase project's database reached through Cloudflare Hyperdrive, both provisioned by Terraform through Orun (the Lumen baseline's roots), and its schema is applied by Orun's db-migrate component from the drizzle-kit SQL the template ships. The code stays the code: the one departure is the per-request database client the Workers runtime forces."
state: draft
state: completed
milestones:
- name: "SA0 — the spec"
exitCriteria:
Expand Down
10 changes: 5 additions & 5 deletions specs/epics/saas-starter/implementation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
Milestones land in order; each task is one pull request on an
`orun/SA-n-<slug>` branch with an `Orun-Task: SA-n` trailer.

## SA0 — the spec
## SA0 — the spec ✅

This doc set, `epic.yaml` and the task contracts, merged to `main`.

**Done when**
- the five documents and `epic.yaml` are on `main`
- `tasks/SA-1..SA-5.TaskContract.yaml` exist

## SA1 — the app on Workers
## SA1 — the app on Workers ✅

`apps/web` is the upstream template with the Workers build around it:
`lib/db/drizzle.ts` exports `getDb()` (a `postgres` client + Drizzle per
Expand All @@ -28,7 +28,7 @@ session, the proxy and the webhook route.
- `wrangler dev` answers `/` with the marketing page and `/sign-in` with the form, and `/dashboard` with a 307 to `/sign-in` when signed out
- the diff against upstream is the forced set and nothing else

## SA2 — the schema through db-migrate
## SA2 — the schema through db-migrate ✅

`packages/db` (`@saas/db`) is Lumen's migration runner with the template's
drizzle-kit SQL as `010_saas_starter_schema/up.sql`, listed in
Expand All @@ -41,7 +41,7 @@ the offline plan.
- `node packages/db/dist/runner/cli.js plan --env stage` lists both migrations as pending (offline)
- `tests/db` is green; the component's `path` and `dependsOn` are Lumen's

## SA3 — Supabase and Hyperdrive from Terraform
## SA3 — Supabase and Hyperdrive from Terraform ✅

`infra/terraform/supabase` provisions a project per environment and
publishes its credentials; `infra/terraform/cloudflare-hyperdrive` creates
Expand All @@ -55,7 +55,7 @@ the Hyperdrive config over that database and publishes
- the component's `secretEnv` keys match the roots' `secretOutputs`
- the fixture's wiring keys match the template's tokens (`wire:fixture` renders)

## SA4 — ready to instantiate
## SA4 — ready to instantiate ✅

README (local development with the Supabase CLI or any Postgres, the seed,
Stripe, the Worker secrets; test, preview, deploy), `IMPLEMENTATION-STATUS.md`
Expand Down
Loading