[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79GN92BND7FVQ6FQYK3PCN2":3,"skill-same:01M79GN92BND7FVQ6FQYK3PCN2":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M79GN92BND7FVQ6FQYK3PCN2","saasaloy-waitlist",null,"Runbook for the waitlist feature — a landing-page email waitlist proving the api chained-route patch and the database\u002Fui file-drop conventions end to end. Use when adding, changing, or debugging the waitlist route, schema, table, or block, placing the block on a page, running migrations after install, or setting PUBLIC_API_URL.","mimukit\u002Fsaasaloy","mimukit","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11677026?v=4","01M79GFSERAQQ77QPQMC1N0Y6M","Mukitul Islam Mukit","01M79GFSFA4WMGEEBHA68N59WV",4,"MIT","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fwaitlist\u002Fskills\u002Fsaasaloy-waitlist\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: saasaloy-waitlist\ndescription: Runbook for the waitlist feature — a landing-page email waitlist proving the api chained-route patch and the database\u002Fui file-drop conventions end to end. Use when adding, changing, or debugging the waitlist route, schema, table, or block, placing the block on a page, running migrations after install, or setting PUBLIC_API_URL.\n---\n\n# waitlist — landing-page email waitlist\n\n`waitlist` is a **feature module** (`saasaloy:feature`): it drops files into the extension points\n`api`, `database`, `validators`, `packages\u002Fui` and `apps\u002Fweb` already established, registers its\nroute with one `chained-route` patch, and leaves one step to you — placing its form on a page (see\n[Wire-up](#wire-up)). It depends on `api`, `database` and `validators`, resolved and installed\nautomatically. It names no database **driver**: `database`'s own `requiresOneOf` is what guarantees\none is present.\n\n## Either database driver\n\nThis module installs against `database-d1` or `database-postgres`, and picks the right table\ndeclaration for whichever one the project holds. It ships the table twice:\n\n| Source in the module | Installs when | Dialect |\n|---|---|---|\n| `files\u002Fdb\u002Fschema\u002Fwaitlist.sqlite.ts` | `onlyWith: \"database-d1\"` | `sqliteTable`, `drizzle-orm\u002Fsqlite-core` |\n| `files\u002Fdb\u002Fschema\u002Fwaitlist.pg.ts` | `onlyWith: \"database-postgres\"` | `pgTable`, `drizzle-orm\u002Fpg-core` |\n\nBoth name the same `target`, `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts`, so exactly one lands and the\nother is filtered out before the plan is built. `saasaloy add waitlist --dry-run` prints which\nsource it chose.\n\n**Everything else is one file.** The route, the validators and the block are dialect-neutral,\nbecause Drizzle's query builder is the same under both dialects and the driver's `withDb(c, …)` is\nthe same call. The dialect reaches the column declarations and stops there.\n\nThe two variants are the same table, so keep them in step. They differ only where each dialect is\nidiomatic: the SQLite id is `integer(\"id\").primaryKey({ autoIncrement: true })` and the Postgres id\nis `integer(\"id\").primaryKey().generatedAlwaysAsIdentity()`; `created_at` is a millisecond integer\non SQLite (`mode: \"timestamp_ms\"`, defaulted from `unixepoch('subsecond')`) and a `timestamptz` on\nPostgres (defaulted from `now()`). A row comes back the same shape either way.\n\n**Switching driver is remove-then-add, and it takes this module with it.** The unchosen variant is\nfiltered before planning, so a project that swaps `database-d1` for `database-postgres` keeps the\nSQLite table it already installed. Remove `waitlist` and add it again after the driver switch to\nget the other variant. There is no data migration; see ADR 0026.\n\n## What it drops, and where\n\n| File | Convention it extends |\n|------|------------------------|\n| `apps\u002Fapi\u002Fsrc\u002Froutes\u002Fwaitlist.ts` | api's route-module contract — a chained sub-app under `export const waitlist` |\n| `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts` | db's `schema\u002F*.ts` glob — one table, `waitlist_entries`, in the installed driver's dialect |\n| `packages\u002Fvalidators\u002Fsrc\u002Fwaitlist.ts` | validators' one-file-per-feature rule — `@repo\u002Fvalidators\u002Fwaitlist` |\n| `packages\u002Fui\u002Fsrc\u002Fblocks\u002Fwaitlist.tsx` | ui's blocks folder — one file, one component export, same as every base block |\n| `apps\u002Fweb\u002Fsrc\u002Fcomponents\u002FWaitlistForm.tsx` | the app's own island — supplies the block's `onSubmit` |\n| `apps\u002Fweb\u002Fsrc\u002Ftypes\u002Fwaitlist-env.d.ts` | ambient `ImportMetaEnv` augmentation (see below) |\n\n**The block is presentational and the app supplies the behaviour.** `Waitlist` renders the panel,\nowns the form's own state, and takes a required `onSubmit`. It imports React and three ui\nprimitives, and nothing else — no api package, no http client, no env var. `WaitlistForm.tsx`\nholds all of that: it builds `hc\u003CAppType>` and passes the function down. Keeping `packages\u002Fui`\nclear of the api package is not tidiness — a design package that imports it compiles the whole\nWorker source tree on every `pnpm typecheck`.\n\n**Neither file is placed for you.** `saasaloy add waitlist` writes both and stops; no command edits\na page. Read [Wire-up](#wire-up) for the two lines that put the form on the landing page.\n\n## Wire-up\n\nPut the form on a page yourself:\n\n1. Open `apps\u002Fweb\u002Fsrc\u002Fpages\u002Findex.astro`.\n2. Add the import, beside the other block imports:\n\n   ```astro\n   import WaitlistForm from \"@web\u002Fcomponents\u002FWaitlistForm\";\n   ```\n\n3. Render it inside `\u003Cmain>`, after `\u003CCta siteName={siteName} \u002F>` — or wherever you want it:\n\n   ```astro\n   \u003CWaitlistForm client:load \u002F>\n   ```\n\nImport `WaitlistForm`, **not** `Waitlist`. The block needs a function prop, and Astro serializes\nisland props, so a function cannot cross from `.astro` into an island. `WaitlistForm` is the React\nfile that closes over it. This is also why `client:load` is required rather than a default: the form\nowns browser state, and with no client directive the page renders dead HTML whose button does\nnothing. The whole block hydrates, heading and paragraph included, because a static React parent\ncannot hold a hydrated React child.\n\nThe suggested spot is after `\u003CCta \u002F>` for one reason: both use the muted panel, and this block is\nlaid out in two columns so that the pair does not read as two centred panels in a row. Move it and\nthe page still works.\n\n`Waitlist` also takes optional `id`, `title` and `description` props, which `WaitlistForm` is the\nplace to pass. Its copy lives in the block file rather than in\n`packages\u002Fui\u002Fsrc\u002Fcontent\u002Flanding.ts`, because that content module belongs to the base and this\nmodule never edits a file it does not own.\n\n`saasaloy remove waitlist` deletes both files and **does not** touch the import you added. Take\nthose two lines out yourself, or the page stops building.\n\n## What it patches\n\nThree patches; `saasaloy remove` reverses only the first — it does not uninstall npm dependencies,\nso the other two are dropped with a warning and uninstalling leaves them in\n`apps\u002Fweb\u002Fpackage.json`:\n\n| Patch | Target | Why |\n|---|---|---|\n| `chained-route` | `apps\u002Fapi\u002Fsrc\u002Findex.ts` | mounts the route at `POST \u002Fwaitlist` **and** puts it in `AppType` |\n| `package-json-dependency` | `apps\u002Fweb\u002Fpackage.json` | `hono`, for `hc` from `hono\u002Fclient` |\n| `package-json-dependency` | `apps\u002Fweb\u002Fpackage.json` | `@repo\u002Fapi`, for `type { AppType }` |\n\nThe route link is a patch, not a drop, because a folder scan gives the chain no type to carry. See\nthe `saasaloy-api` skill for the convention. Nothing here edits `src\u002Fschema.ts` or `index.astro`.\n\nThe `hono` patch carries a **version**, `4.13.5`, and it is the only versioned patch range in the\nrepo. It must match `modules\u002Fapi\u002Ffiles\u002Fpackage.json`'s `hono` pin: `apps\u002Fweb` infers `AppType`\nacross the package boundary from `apps\u002Fapi`, and two `hono` copies at different versions make that\ninference fail in ways the error message does not explain. `pnpm deps:check` scans this range and\nfails on drift, but `pnpm deps:update` will not rewrite it — re-serializing the descriptor would\nreflow the whole file, so the report prints the edit and you make it by hand (see CONTRIBUTING.md\n\"Updating dependencies\", and #93 for the fix that automates it).\n\n## After install: generate + apply the migration\n\nThe table only exists once its migration is generated and applied — this module ships **no\npre-generated SQL**:\n\n```sh\npnpm --filter @repo\u002Fdb db:generate       # emits SQL for the new `waitlist_entries` table\n```\n\n`db:generate` belongs to the `database` core and is the same command under either driver. **The\napply step is the driver's**, and the command differs, so read the skill for the driver this\nproject installed: `saasaloy-database-d1` or `saasaloy-database-postgres`. Nothing here should name\none of them, because this module works with both.\n\n### Updating a D1 project that installed waitlist before the two-variant split\n\n`created_at` used to be `integer(\"created_at\", { mode: \"timestamp\" })`, which stores **whole\nseconds**. The SQLite variant now uses `mode: \"timestamp_ms\"`, which stores **milliseconds**. The\nintegers already in the table do not change when `saasaloy update waitlist` rewrites the schema\nfile — only the way Drizzle reads them changes, so every pre-existing row comes back dated near\n1970.\n\nNothing this module ships reads `createdAt` back (the route only inserts), so a project that never\nqueries the column can ignore this. If yours does, rescale the old rows once, after the update and\nbefore the first read:\n\n```sql\nUPDATE waitlist_entries SET created_at = created_at * 1000 WHERE created_at \u003C 100000000000;\n```\n\nThe `WHERE` clause is what makes it safe to run twice: a genuine millisecond timestamp is already\npast that bound, so a second run touches nothing. Apply it with the same command your driver's\nskill gives for migrations. Postgres projects are unaffected — `timestamptz` never carried the\nseconds form.\n\n## Upgrading from singular table names\n\nThis module used to name its table `waitlist`. It now names it `waitlist_entries`, and the Drizzle\nexport is `waitlistEntries`. The file stays `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts`. A project that\ninstalled the old name upgrades it with one migration:\n\n1. Run `saasaloy update waitlist` to take the new schema file.\n2. Run `pnpm --filter @repo\u002Fdb db:generate`.\n3. drizzle-kit asks, for each new table, whether it is created or renamed from an existing table.\n   Pick the rename from the old name: `waitlist` → `waitlist_entries`.\n4. Read the generated SQL before you apply it. It must rename the table and its unique `email`\n   index (`ALTER TABLE ... RENAME TO ...`), and contain no `DROP TABLE` or `CREATE TABLE` for a\n   table that holds data.\n5. If it drops a table, delete that migration file and run `pnpm --filter @repo\u002Fdb db:generate`\n   again.\n6. Apply the migration with your driver's command, then submit the waitlist form to confirm that\n   the insert succeeds.\n\n## The route's responses\n\n`POST \u002Fwaitlist` answers with two status codes, both explicit so `hc` can key the response type on\nthem:\n\n| Status | Body | When |\n|---|---|---|\n| **201** | `{ ok: true }` | the address was accepted, new or duplicate |\n| **400** | `{ error: { code: \"invalid_input\", message } }` | the address failed `waitlistInput` |\n\nThe 400 has two sources and one shape. A body that parses and fails `waitlistInput` hits\n`zValidator`'s third-argument failure hook, which returns `errorBody(\"invalid_input\", message)` from\n`@repo\u002Fvalidators\u002Fcommon`. A body that does not parse at all never reaches the hook — Hono's json\nvalidator throws `HTTPException(400, \"Malformed JSON in request body\")` first — and `modules\u002Fapi`'s\n`onError` handler converts that to the same `{ error: { code: \"invalid_input\", message } }`. Both\npaths match the type `hc` publishes. Neither the hook nor the handler is optional: drop either and\none of the two 400s ships as plain text.\n\n## The input schema lives in `@repo\u002Fvalidators`\n\n`packages\u002Fvalidators\u002Fsrc\u002Fwaitlist.ts` exports `waitlistInput` and `WaitlistInput`. The route does\nnot define a local `z.object`. The schema reuses `email` from `@repo\u002Fvalidators\u002Fcommon`, which\ntrims and lowercases before parsing, so `\"A@B.com \"` and `a@b.com` reach the unique column as the\nsame value. Widen the accepted input by editing that file, not the route.\n\n## `PUBLIC_API_URL`\n\n`WaitlistForm.tsx` builds a typed client, `hc\u003CAppType>(import.meta.env.PUBLIC_API_URL ??\n\"http:\u002F\u002Flocalhost:4000\")`, and calls `api.waitlist.$post({ json: { email } })`. The fallback matches\nthe api Worker's pinned local dev port — `:4000`, fixed with `strictPort` in `vite.config.ts` and\n`dev.port` in `wrangler.jsonc` so it can't drift — so a fresh project needs **no env var in dev**.\nSet `PUBLIC_API_URL` at web build time once the api Worker has a real (non-localhost) URL — e.g. its\ndeployed `*.workers.dev` address or a custom domain.\n\n`waitlist-env.d.ts` augments the bundler's `ImportMetaEnv` with `PUBLIC_API_URL` so the read\ntypechecks. It's a global ambient `interface` in its own file — TypeScript merges same-named\ninterfaces across files, so a future feature can add its own env var the same way without\ntouching this one. It sits in `apps\u002Fweb` rather than `packages\u002Fui`, because the env read sits there\ntoo — the block takes a function and never looks at `import.meta.env`.\n\n## Duplicate submissions are a success, not an error\n\n`POST \u002Fwaitlist` uses `.onConflictDoNothing()` on the unique `email` column: resubmitting an\nemail already on the list returns the same `201 { ok: true }` response and does **not** insert a\nsecond row. This is deliberate — it avoids leaking \"is this email already on the list\" as a side\nchannel, and keeps the form's UI simple (no special-cased duplicate error state).\n\n## CORS\n\n`web` and `api` are separate origins in dev (`:3000` vs `:4000`) and in prod, so the form's request\nis cross-origin. The route itself carries **no CORS code**: `modules\u002Fapi`'s entry applies the\ncredentialed `CORS_ORIGINS` allowlist to `*` before this sub-app is mounted, and a route-level\n`cors()` would run as an inner middleware and overwrite those headers with permissive defaults.\nIf a submission is blocked in the browser, check `CORS_ORIGINS` on the api Worker.\n\n## Boundaries to honor\n\n- **The route registers by patch; table, block and island stay file-drops.** Extend any of them by\n  editing the dropped file. The one edit to `apps\u002Fapi\u002Fsrc\u002Findex.ts` is the `chained-route` patch's,\n  so don't hand-write the link and don't reach into `src\u002Fschema.ts`.\n- **The block stays free of the api.** `packages\u002Fui\u002Fsrc\u002Fblocks\u002Fwaitlist.tsx` takes `onSubmit` and\n  imports React and ui primitives only. Never move `hc`, `@repo\u002Fapi`, or an `import.meta.env` read\n  into it: `packages\u002Fui` has a `typecheck` script, and one import of `@repo\u002Fapi` there makes `tsc`\n  compile the whole Worker source tree under the ui package's own tsconfig.\n- **The form's placement is the owner's, and no code of ours writes it.** Never teach a user to\n  expect the form on the page automatically, and never add a patch that edits `index.astro`. The\n  Wire-up section above is the whole mechanism.\n- **Keep the route one unbroken chain.** A `waitlist.post(...)` statement still serves the request\n  and still typechecks, but `typeof waitlist` forgets it, so `api.waitlist` disappears from the\n  client with no error anywhere in `apps\u002Fapi`.\n- **Input shapes live in `@repo\u002Fvalidators\u002Fwaitlist`**, not inline in the route.\n- **Migrations stay manual** — `db:generate` from the `saasaloy-database` skill, then the apply\n  command from the installed driver's skill. Never auto-migrate.\n- **Duplicate email → 201, not error.** Don't change this to a 409 without reconsidering the\n  membership-leak tradeoff above.\n- **The dialect lives in the two schema variants and nowhere else.** Edit both when the table\n  changes, and keep the route on `withDb(c, …)` and the shared query builder. A `sqlite-core` or\n  `pg-core` import anywhere but `files\u002Fdb\u002Fschema\u002Fwaitlist.*.ts` pins this module to one driver\n  again.\n- **No email-confirmation flow ships here.** Optional `email`-module integration is a follow-up\n  (no resolver support yet for optional `dependsOn`); this module's `dependsOn` is a hard\n  requirement on `api` + `database` + `validators` only.\n\n## Next\n\nRun `saasaloy-landing-copy` to point the landing page's primary button at the waitlist form.\n","# waitlist — landing-page email waitlist\n\n`waitlist` is a **feature module** (`saasaloy:feature`): it drops files into the extension points\n`api`, `database`, `validators`, `packages\u002Fui` and `apps\u002Fweb` already established, registers its\nroute with one `chained-route` patch, and leaves one step to you — placing its form on a page (see\n[Wire-up](#wire-up)). It depends on `api`, `database` and `validators`, resolved and installed\nautomatically. It names no database **driver**: `database`'s own `requiresOneOf` is what guarantees\none is present.\n\n## Either database driver\n\nThis module installs against `database-d1` or `database-postgres`, and picks the right table\ndeclaration for whichever one the project holds. It ships the table twice:\n\n| Source in the module | Installs when | Dialect |\n|---|---|---|\n| `files\u002Fdb\u002Fschema\u002Fwaitlist.sqlite.ts` | `onlyWith: \"database-d1\"` | `sqliteTable`, `drizzle-orm\u002Fsqlite-core` |\n| `files\u002Fdb\u002Fschema\u002Fwaitlist.pg.ts` | `onlyWith: \"database-postgres\"` | `pgTable`, `drizzle-orm\u002Fpg-core` |\n\nBoth name the same `target`, `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts`, so exactly one lands and the\nother is filtered out before the plan is built. `saasaloy add waitlist --dry-run` prints which\nsource it chose.\n\n**Everything else is one file.** The route, the validators and the block are dialect-neutral,\nbecause Drizzle's query builder is the same under both dialects and the driver's `withDb(c, …)` is\nthe same call. The dialect reaches the column declarations and stops there.\n\nThe two variants are the same table, so keep them in step. They differ only where each dialect is\nidiomatic: the SQLite id is `integer(\"id\").primaryKey({ autoIncrement: true })` and the Postgres id\nis `integer(\"id\").primaryKey().generatedAlwaysAsIdentity()`; `created_at` is a millisecond integer\non SQLite (`mode: \"timestamp_ms\"`, defaulted from `unixepoch('subsecond')`) and a `timestamptz` on\nPostgres (defaulted from `now()`). A row comes back the same shape either way.\n\n**Switching driver is remove-then-add, and it takes this module with it.** The unchosen variant is\nfiltered before planning, so a project that swaps `database-d1` for `database-postgres` keeps the\nSQLite table it already installed. Remove `waitlist` and add it again after the driver switch to\nget the other variant. There is no data migration; see ADR 0026.\n\n## What it drops, and where\n\n| File | Convention it extends |\n|------|------------------------|\n| `apps\u002Fapi\u002Fsrc\u002Froutes\u002Fwaitlist.ts` | api's route-module contract — a chained sub-app under `export const waitlist` |\n| `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts` | db's `schema\u002F*.ts` glob — one table, `waitlist_entries`, in the installed driver's dialect |\n| `packages\u002Fvalidators\u002Fsrc\u002Fwaitlist.ts` | validators' one-file-per-feature rule — `@repo\u002Fvalidators\u002Fwaitlist` |\n| `packages\u002Fui\u002Fsrc\u002Fblocks\u002Fwaitlist.tsx` | ui's blocks folder — one file, one component export, same as every base block |\n| `apps\u002Fweb\u002Fsrc\u002Fcomponents\u002FWaitlistForm.tsx` | the app's own island — supplies the block's `onSubmit` |\n| `apps\u002Fweb\u002Fsrc\u002Ftypes\u002Fwaitlist-env.d.ts` | ambient `ImportMetaEnv` augmentation (see below) |\n\n**The block is presentational and the app supplies the behaviour.** `Waitlist` renders the panel,\nowns the form's own state, and takes a required `onSubmit`. It imports React and three ui\nprimitives, and nothing else — no api package, no http client, no env var. `WaitlistForm.tsx`\nholds all of that: it builds `hc\u003CAppType>` and passes the function down. Keeping `packages\u002Fui`\nclear of the api package is not tidiness — a design package that imports it compiles the whole\nWorker source tree on every `pnpm typecheck`.\n\n**Neither file is placed for you.** `saasaloy add waitlist` writes both and stops; no command edits\na page. Read [Wire-up](#wire-up) for the two lines that put the form on the landing page.\n\n## Wire-up\n\nPut the form on a page yourself:\n\n1. Open `apps\u002Fweb\u002Fsrc\u002Fpages\u002Findex.astro`.\n2. Add the import, beside the other block imports:\n\n   ```astro\n   import WaitlistForm from \"@web\u002Fcomponents\u002FWaitlistForm\";\n   ```\n\n3. Render it inside `\u003Cmain>`, after `\u003CCta siteName={siteName} \u002F>` — or wherever you want it:\n\n   ```astro\n   \u003CWaitlistForm client:load \u002F>\n   ```\n\nImport `WaitlistForm`, **not** `Waitlist`. The block needs a function prop, and Astro serializes\nisland props, so a function cannot cross from `.astro` into an island. `WaitlistForm` is the React\nfile that closes over it. This is also why `client:load` is required rather than a default: the form\nowns browser state, and with no client directive the page renders dead HTML whose button does\nnothing. The whole block hydrates, heading and paragraph included, because a static React parent\ncannot hold a hydrated React child.\n\nThe suggested spot is after `\u003CCta \u002F>` for one reason: both use the muted panel, and this block is\nlaid out in two columns so that the pair does not read as two centred panels in a row. Move it and\nthe page still works.\n\n`Waitlist` also takes optional `id`, `title` and `description` props, which `WaitlistForm` is the\nplace to pass. Its copy lives in the block file rather than in\n`packages\u002Fui\u002Fsrc\u002Fcontent\u002Flanding.ts`, because that content module belongs to the base and this\nmodule never edits a file it does not own.\n\n`saasaloy remove waitlist` deletes both files and **does not** touch the import you added. Take\nthose two lines out yourself, or the page stops building.\n\n## What it patches\n\nThree patches; `saasaloy remove` reverses only the first — it does not uninstall npm dependencies,\nso the other two are dropped with a warning and uninstalling leaves them in\n`apps\u002Fweb\u002Fpackage.json`:\n\n| Patch | Target | Why |\n|---|---|---|\n| `chained-route` | `apps\u002Fapi\u002Fsrc\u002Findex.ts` | mounts the route at `POST \u002Fwaitlist` **and** puts it in `AppType` |\n| `package-json-dependency` | `apps\u002Fweb\u002Fpackage.json` | `hono`, for `hc` from `hono\u002Fclient` |\n| `package-json-dependency` | `apps\u002Fweb\u002Fpackage.json` | `@repo\u002Fapi`, for `type { AppType }` |\n\nThe route link is a patch, not a drop, because a folder scan gives the chain no type to carry. See\nthe `saasaloy-api` skill for the convention. Nothing here edits `src\u002Fschema.ts` or `index.astro`.\n\nThe `hono` patch carries a **version**, `4.13.5`, and it is the only versioned patch range in the\nrepo. It must match `modules\u002Fapi\u002Ffiles\u002Fpackage.json`'s `hono` pin: `apps\u002Fweb` infers `AppType`\nacross the package boundary from `apps\u002Fapi`, and two `hono` copies at different versions make that\ninference fail in ways the error message does not explain. `pnpm deps:check` scans this range and\nfails on drift, but `pnpm deps:update` will not rewrite it — re-serializing the descriptor would\nreflow the whole file, so the report prints the edit and you make it by hand (see CONTRIBUTING.md\n\"Updating dependencies\", and #93 for the fix that automates it).\n\n## After install: generate + apply the migration\n\nThe table only exists once its migration is generated and applied — this module ships **no\npre-generated SQL**:\n\n```sh\npnpm --filter @repo\u002Fdb db:generate       # emits SQL for the new `waitlist_entries` table\n```\n\n`db:generate` belongs to the `database` core and is the same command under either driver. **The\napply step is the driver's**, and the command differs, so read the skill for the driver this\nproject installed: `saasaloy-database-d1` or `saasaloy-database-postgres`. Nothing here should name\none of them, because this module works with both.\n\n### Updating a D1 project that installed waitlist before the two-variant split\n\n`created_at` used to be `integer(\"created_at\", { mode: \"timestamp\" })`, which stores **whole\nseconds**. The SQLite variant now uses `mode: \"timestamp_ms\"`, which stores **milliseconds**. The\nintegers already in the table do not change when `saasaloy update waitlist` rewrites the schema\nfile — only the way Drizzle reads them changes, so every pre-existing row comes back dated near\n1970.\n\nNothing this module ships reads `createdAt` back (the route only inserts), so a project that never\nqueries the column can ignore this. If yours does, rescale the old rows once, after the update and\nbefore the first read:\n\n```sql\nUPDATE waitlist_entries SET created_at = created_at * 1000 WHERE created_at \u003C 100000000000;\n```\n\nThe `WHERE` clause is what makes it safe to run twice: a genuine millisecond timestamp is already\npast that bound, so a second run touches nothing. Apply it with the same command your driver's\nskill gives for migrations. Postgres projects are unaffected — `timestamptz` never carried the\nseconds form.\n\n## Upgrading from singular table names\n\nThis module used to name its table `waitlist`. It now names it `waitlist_entries`, and the Drizzle\nexport is `waitlistEntries`. The file stays `packages\u002Fdb\u002Fsrc\u002Fschema\u002Fwaitlist.ts`. A project that\ninstalled the old name upgrades it with one migration:\n\n1. Run `saasaloy update waitlist` to take the new schema file.\n2. Run `pnpm --filter @repo\u002Fdb db:generate`.\n3. drizzle-kit asks, for each new table, whether it is created or renamed from an existing table.\n   Pick the rename from the old name: `waitlist` → `waitlist_entries`.\n4. Read the generated SQL before you apply it. It must rename the table and its unique `email`\n   index (`ALTER TABLE ... RENAME TO ...`), and contain no `DROP TABLE` or `CREATE TABLE` for a\n   table that holds data.\n5. If it drops a table, delete that migration file and run `pnpm --filter @repo\u002Fdb db:generate`\n   again.\n6. Apply the migration with your driver's command, then submit the waitlist form to confirm that\n   the insert succeeds.\n\n## The route's responses\n\n`POST \u002Fwaitlist` answers with two status codes, both explicit so `hc` can key the response type on\nthem:\n\n| Status | Body | When |\n|---|---|---|\n| **201** | `{ ok: true }` | the address was accepted, new or duplicate |\n| **400** | `{ error: { code: \"invalid_input\", message } }` | the address failed `waitlistInput` |\n\nThe 400 has two sources and one shape. A body that parses and fails `waitlistInput` hits\n`zValidator`'s third-argument failure hook, which returns `errorBody(\"invalid_input\", message)` from\n`@repo\u002Fvalidators\u002Fcommon`. A body that does not parse at all never reaches the hook — Hono's json\nvalidator throws `HTTPException(400, \"Malformed JSON in request body\")` first — and `modules\u002Fapi`'s\n`onError` handler converts that to the same `{ error: { code: \"invalid_input\", message } }`. Both\npaths match the type `hc` publishes. Neither the hook nor the handler is optional: drop either and\none of the two 400s ships as plain text.\n\n## The input schema lives in `@repo\u002Fvalidators`\n\n`packages\u002Fvalidators\u002Fsrc\u002Fwaitlist.ts` exports `waitlistInput` and `WaitlistInput`. The route does\nnot define a local `z.object`. The schema reuses `email` from `@repo\u002Fvalidators\u002Fcommon`, which\ntrims and lowercases before parsing, so `\"A@B.com \"` and `a@b.com` reach the unique column as the\nsame value. Widen the accepted input by editing that file, not the route.\n\n## `PUBLIC_API_URL`\n\n`WaitlistForm.tsx` builds a typed client, `hc\u003CAppType>(import.meta.env.PUBLIC_API_URL ??\n\"http:\u002F\u002Flocalhost:4000\")`, and calls `api.waitlist.$post({ json: { email } })`. The fallback matches\nthe api Worker's pinned local dev port — `:4000`, fixed with `strictPort` in `vite.config.ts` and\n`dev.port` in `wrangler.jsonc` so it can't drift — so a fresh project needs **no env var in dev**.\nSet `PUBLIC_API_URL` at web build time once the api Worker has a real (non-localhost) URL — e.g. its\ndeployed `*.workers.dev` address or a custom domain.\n\n`waitlist-env.d.ts` augments the bundler's `ImportMetaEnv` with `PUBLIC_API_URL` so the read\ntypechecks. It's a global ambient `interface` in its own file — TypeScript merges same-named\ninterfaces across files, so a future feature can add its own env var the same way without\ntouching this one. It sits in `apps\u002Fweb` rather than `packages\u002Fui`, because the env read sits there\ntoo — the block takes a function and never looks at `import.meta.env`.\n\n## Duplicate submissions are a success, not an error\n\n`POST \u002Fwaitlist` uses `.onConflictDoNothing()` on the unique `email` column: resubmitting an\nemail already on the list returns the same `201 { ok: true }` response and does **not** insert a\nsecond row. This is deliberate — it avoids leaking \"is this email already on the list\" as a side\nchannel, and keeps the form's UI simple (no special-cased duplicate error state).\n\n## CORS\n\n`web` and `api` are separate origins in dev (`:3000` vs `:4000`) and in prod, so the form's request\nis cross-origin. The route itself carries **no CORS code**: `modules\u002Fapi`'s entry applies the\ncredentialed `CORS_ORIGINS` allowlist to `*` before this sub-app is mounted, and a route-level\n`cors()` would run as an inner middleware and overwrite those headers with permissive defaults.\nIf a submission is blocked in the browser, check `CORS_ORIGINS` on the api Worker.\n\n## Boundaries to honor\n\n- **The route registers by patch; table, block and island stay file-drops.** Extend any of them by\n  editing the dropped file. The one edit to `apps\u002Fapi\u002Fsrc\u002Findex.ts` is the `chained-route` patch's,\n  so don't hand-write the link and don't reach into `src\u002Fschema.ts`.\n- **The block stays free of the api.** `packages\u002Fui\u002Fsrc\u002Fblocks\u002Fwaitlist.tsx` takes `onSubmit` and\n  imports React and ui primitives only. Never move `hc`, `@repo\u002Fapi`, or an `import.meta.env` read\n  into it: `packages\u002Fui` has a `typecheck` script, and one import of `@repo\u002Fapi` there makes `tsc`\n  compile the whole Worker source tree under the ui package's own tsconfig.\n- **The form's placement is the owner's, and no code of ours writes it.** Never teach a user to\n  expect the form on the page automatically, and never add a patch that edits `index.astro`. The\n  Wire-up section above is the whole mechanism.\n- **Keep the route one unbroken chain.** A `waitlist.post(...)` statement still serves the request\n  and still typechecks, but `typeof waitlist` forgets it, so `api.waitlist` disappears from the\n  client with no error anywhere in `apps\u002Fapi`.\n- **Input shapes live in `@repo\u002Fvalidators\u002Fwaitlist`**, not inline in the route.\n- **Migrations stay manual** — `db:generate` from the `saasaloy-database` skill, then the apply\n  command from the installed driver's skill. Never auto-migrate.\n- **Duplicate email → 201, not error.** Don't change this to a 409 without reconsidering the\n  membership-leak tradeoff above.\n- **The dialect lives in the two schema variants and nowhere else.** Edit both when the table\n  changes, and keep the route on `withDb(c, …)` and the shared query builder. A `sqlite-core` or\n  `pg-core` import anywhere but `files\u002Fdb\u002Fschema\u002Fwaitlist.*.ts` pins this module to one driver\n  again.\n- **No email-confirmation flow ships here.** Optional `email`-module integration is a follow-up\n  (no resolver support yet for optional `dependsOn`); this module's `dependsOn` is a hard\n  requirement on `api` + `database` + `validators` only.\n\n## Next\n\nRun `saasaloy-landing-copy` to point the landing page's primary button at the waitlist form.\n",{"name":5,"description":7},"main","a46a4dd388795519840da0ed1f695634b6dcd99b","modules\u002Fwaitlist\u002Fskills\u002Fsaasaloy-waitlist",0,"https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy","https:\u002F\u002Fsaasaloy.com","https:\u002F\u002Fgithub.com\u002Fmimukit","https:\u002F\u002Fmimukit.com","Senior Software Engineer · 9+ yrs Fullstack (TS\u002FNode\u002FReact) · AI integrations, distributed systems · Building @saasaloy & @codealoy · Bangladesh 🇧🇩 \u002F Remote","2026-11-13 20:39:28",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add mimukit\u002Fsaasaloy --skill saasaloy-waitlist",{"tool":40,"command":41},"bunx","bunx skills add mimukit\u002Fsaasaloy --skill saasaloy-waitlist",{"tool":43,"command":44},"pnpm","pnpm dlx skills add mimukit\u002Fsaasaloy --skill saasaloy-waitlist","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fwaitlist\u002Fskills\u002Fsaasaloy-waitlist\u002FSKILL.md",true,[],[49,56,63,70,77,83],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7BE75C34XHSPVJNQC8FY4Q0","saasaloy-subscription","Runbook for the subscription capability — provider-agnostic subscriptions in packages\u002Fsubscription, with a plan file, a projection table, a billable-subject file, plan entitlements and per-provider modules. Use when adding a plan, adding a plan feature or a numeric limit, gating an API route with requireFeature or requireWithinLimit, reading the 402 it returns, working out why a subject resolves to the free plan, wiring a checkout or portal route, reading a SubscriptionError, choosing or switching SUBSCRIPTION_PROVIDER, registering a webhook in the vendor's dashboard, writing a third subscription provider, or upgrading a project that still has `billing` installed.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fsubscription\u002Fskills\u002Fsaasaloy-subscription\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7BE68MJ8H47JZKTBDFYR6JD","saasaloy-notification","Runbook for the notification module, in-app notifications for apps\u002Fapp. It owns the notifications and notification_opt_outs tables, notify() in apps\u002Fapi\u002Fsrc\u002Flib\u002Fnotify.ts, the \u002Fnotifications api routes, the bell in the app header, the sidebar badge, the \u002Fnotifications page with Inbox and Preferences tabs, the notification config section, and the daily prune. Use when sending a notification from an api route, adding or changing a category, changing retention, debugging a badge or bell count that does not move, or removing the module.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fnotification\u002Fskills\u002Fsaasaloy-notification\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7BE53PDQV0YDPG8RNVGTPEQ","saasaloy-cms","Runbook for the cms module, the in-house CMS behind apps\u002Fadmin. Covers code-defined collections, the Tiptap editor, drafts, revisions and redirects, the publish-time renderer, the public blog on apps\u002Fweb and its 60-second cache. Use when adding a collection or a field, rendering a stored body, reusing the editor, renderer or media field from another module, moving the blog to another path, re-rendering live posts after a renderer upgrade or a STORAGE_PUBLIC_URL change, or working out why a published post is not live yet.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fmodules\u002Fcms\u002Fskills\u002Fsaasaloy-cms\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M79GQ03M63V5EKSST92B3S5X","saasaloy-beta","The beta module's own procedure.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftest\u002Ffixtures\u002Fregistry-clean\u002Fbeta\u002Fsaasaloy-beta\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M79GPXV3K8YF3M4VA0KGVE0B","helper","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftest\u002Ffixtures\u002Fregistry-broken\u002Fbad-skill\u002Fhelper\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M79GPR8EVS1YX0W8X33Q9YD8","saasaloy-update","Runbook for an AI agent that updates this project to a newer Saasaloy CLI and newer module versions with saasaloy update. Use when the owner says \"update saasaloy\", \"upgrade the CLI\", \"pull the latest modules\", \"update the base template\", \"work the merge plan\", \"clear the update notes\", when saasaloy update or saasaloy outdated --check exits 3 or 2, when a merge plan or .saasaloy\u002Fmerge-plan.md is handed to you, or when an adopted project takes its first update. Covers the CLI upgrade, the preview, --out, the file merges, the update notes and \"Notes that may apply\", --resolved and --done, a file deleted locally and --restore, a three-way or two-way base, an update that skips releases, --from, the verify commands, and the exit codes.","https:\u002F\u002Fgithub.com\u002Fmimukit\u002Fsaasaloy\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Ftemplates\u002Fbase\u002F_agents\u002Fskills\u002Fsaasaloy-update\u002FSKILL.md",[],[]]