anhedral 0.12.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +35 -172
  2. package/assets/patches/audit-deps.mjs +12 -2
  3. package/assets/ui/LICENSE.shadcn +21 -0
  4. package/assets/ui/UPSTREAM.json +33 -0
  5. package/assets/ui/native/button.tsx +85 -0
  6. package/assets/ui/native/card.tsx +33 -0
  7. package/assets/ui/native/dialog.tsx +75 -0
  8. package/assets/ui/native/input.tsx +27 -0
  9. package/assets/ui/native/label.tsx +4 -0
  10. package/assets/ui/native/layout.tsx +26 -0
  11. package/assets/ui/native/text.tsx +20 -0
  12. package/assets/ui/native/theme-switcher.tsx +22 -0
  13. package/assets/ui/theme-storage.ts +25 -0
  14. package/assets/ui/theme.tsx +66 -0
  15. package/assets/ui/web/button.tsx +59 -0
  16. package/assets/ui/web/input.tsx +21 -0
  17. package/assets/ui/web/label.tsx +19 -0
  18. package/dist/capabilities.d.ts +5 -5
  19. package/dist/capabilities.js +3 -21
  20. package/dist/capability-contract.d.ts +3 -3
  21. package/dist/capability-contract.js +11 -39
  22. package/dist/cli-delivery.d.ts +1 -1
  23. package/dist/cli-delivery.js +5 -65
  24. package/dist/cli-output.js +3 -3
  25. package/dist/command-schema.js +35 -80
  26. package/dist/command.js +9 -11
  27. package/dist/delivery-evidence.d.ts +1 -1
  28. package/dist/delivery-evidence.js +7 -36
  29. package/dist/delivery.d.ts +2 -8
  30. package/dist/delivery.js +23 -102
  31. package/dist/dependencies.d.ts +12 -58
  32. package/dist/dependencies.js +67 -189
  33. package/dist/index.d.ts +1 -3
  34. package/dist/index.js +1 -3
  35. package/dist/inspector-model.d.ts +2 -2
  36. package/dist/integration-service-readers.d.ts +1 -2
  37. package/dist/integration-service-readers.js +3 -84
  38. package/dist/lifecycle-model.d.ts +1 -1
  39. package/dist/lifecycle-model.js +1 -1
  40. package/dist/mobile-delivery.d.ts +1 -1
  41. package/dist/mobile-delivery.js +4 -0
  42. package/dist/platforms/mobile.d.ts +1 -1
  43. package/dist/platforms/mobile.js +64 -114
  44. package/dist/platforms/web.d.ts +3 -0
  45. package/dist/platforms/web.js +299 -0
  46. package/dist/project-config.d.ts +1 -1
  47. package/dist/project-config.js +0 -1
  48. package/dist/project-inspector.js +5 -36
  49. package/dist/project-state.d.ts +1 -3
  50. package/dist/project-state.js +6 -86
  51. package/dist/provider-auth.js +3 -32
  52. package/dist/provider-readiness.d.ts +1 -1
  53. package/dist/provider-readiness.js +5 -24
  54. package/dist/providers/adapters.js +9 -178
  55. package/dist/providers/api.d.ts +1 -1
  56. package/dist/providers/api.js +3 -3
  57. package/dist/providers/config.js +2 -48
  58. package/dist/providers/definitions.d.ts +1 -204
  59. package/dist/providers/definitions.js +0 -85
  60. package/dist/providers/provision.d.ts +1 -1
  61. package/dist/providers/receipts.js +1 -11
  62. package/dist/providers/recovery-verification.js +1 -61
  63. package/dist/providers/runtime.js +15 -35
  64. package/dist/providers/state.js +1 -7
  65. package/dist/provision.d.ts +5 -13
  66. package/dist/provision.js +4 -80
  67. package/dist/readiness.d.ts +1 -1
  68. package/dist/readiness.js +3 -6
  69. package/dist/registry/add.js +11 -38
  70. package/dist/registry/bootstrap.d.ts +3 -2
  71. package/dist/registry/bootstrap.js +4 -13
  72. package/dist/registry/commands.js +8 -10
  73. package/dist/registry/context.js +0 -1
  74. package/dist/registry/options.js +8 -26
  75. package/dist/registry/resolve.d.ts +3 -2
  76. package/dist/registry/resolve.js +26 -82
  77. package/dist/registry/types.d.ts +2 -7
  78. package/dist/registry/usage.js +2 -2
  79. package/dist/runtime-policy.d.ts +0 -2
  80. package/dist/runtime-policy.js +0 -13
  81. package/dist/scaffold/api.js +10 -2
  82. package/dist/scaffold/auth.d.ts +1 -2
  83. package/dist/scaffold/auth.js +57 -116
  84. package/dist/scaffold/backend.d.ts +2 -0
  85. package/dist/scaffold/backend.js +39 -0
  86. package/dist/scaffold/billing-config.d.ts +1 -0
  87. package/dist/scaffold/billing-config.js +73 -0
  88. package/dist/scaffold/billing-contracts.d.ts +2 -0
  89. package/dist/scaffold/billing-contracts.js +48 -0
  90. package/dist/scaffold/billing-providers.d.ts +1 -0
  91. package/dist/scaffold/billing-providers.js +249 -0
  92. package/dist/scaffold/billing-schema.d.ts +1 -0
  93. package/dist/scaffold/billing-schema.js +34 -0
  94. package/dist/scaffold/billing-security.d.ts +1 -0
  95. package/dist/scaffold/billing-security.js +46 -0
  96. package/dist/scaffold/billing-server.d.ts +1 -0
  97. package/dist/scaffold/billing-server.js +139 -0
  98. package/dist/scaffold/billing-store.d.ts +1 -0
  99. package/dist/scaffold/billing-store.js +72 -0
  100. package/dist/scaffold/billing.d.ts +2 -0
  101. package/dist/scaffold/billing.js +208 -0
  102. package/dist/scaffold/bootstrap.d.ts +2 -3
  103. package/dist/scaffold/bootstrap.js +37 -43
  104. package/dist/scaffold/compose.js +2 -12
  105. package/dist/scaffold/database.d.ts +1 -1
  106. package/dist/scaffold/database.js +20 -111
  107. package/dist/scaffold/documentation.d.ts +0 -1
  108. package/dist/scaffold/documentation.js +22 -82
  109. package/dist/scaffold/expo-auth.d.ts +3 -0
  110. package/dist/scaffold/expo-auth.js +203 -0
  111. package/dist/scaffold/expo-billing.d.ts +3 -0
  112. package/dist/scaffold/expo-billing.js +257 -0
  113. package/dist/scaffold/expo-runtime.d.ts +3 -0
  114. package/dist/scaffold/expo-runtime.js +43 -0
  115. package/dist/scaffold/integrations.d.ts +1 -2
  116. package/dist/scaffold/integrations.js +9 -5
  117. package/dist/scaffold/managed-email.d.ts +3 -0
  118. package/dist/scaffold/managed-email.js +47 -0
  119. package/dist/scaffold/native-ui.d.ts +2 -0
  120. package/dist/scaffold/native-ui.js +69 -0
  121. package/dist/scaffold/password-reset.d.ts +1 -0
  122. package/dist/scaffold/password-reset.js +99 -0
  123. package/dist/scaffold/private-files.d.ts +2 -0
  124. package/dist/scaffold/private-files.js +78 -0
  125. package/dist/scaffold/stack-documentation.d.ts +0 -1
  126. package/dist/scaffold/stack-documentation.js +3 -49
  127. package/dist/scaffold/styling.d.ts +1 -1
  128. package/dist/scaffold/styling.js +20 -28
  129. package/dist/scaffold/web-billing.d.ts +2 -0
  130. package/dist/scaffold/web-billing.js +48 -0
  131. package/dist/scaffold/workspace.js +53 -189
  132. package/dist/service-deletion.js +1 -1
  133. package/dist/service-descriptor.js +5 -12
  134. package/dist/service-model.d.ts +1 -1
  135. package/dist/service-operations.js +2 -32
  136. package/dist/service-readers.js +1 -32
  137. package/dist/services-command.d.ts +1 -1
  138. package/dist/services-command.js +3 -9
  139. package/dist/ship.d.ts +3 -316
  140. package/dist/ship.js +13 -143
  141. package/dist/stack-registry.d.ts +2 -43
  142. package/dist/stack-registry.js +80 -308
  143. package/dist/standard.js +7 -14
  144. package/dist/version.d.ts +1 -1
  145. package/dist/version.js +1 -1
  146. package/docs/anhedral-stack.md +23 -0
  147. package/docs/assets/anhedral-stack-light.png +0 -0
  148. package/docs/assets/anhedral-stack.png +0 -0
  149. package/docs/software-factory.md +25 -499
  150. package/docs/stack-standard.md +48 -226
  151. package/docs/verification.md +433 -0
  152. package/package.json +22 -21
  153. package/dist/neon-service-data.d.ts +0 -8
  154. package/dist/neon-service-data.js +0 -117
  155. package/dist/platforms/desktop.d.ts +0 -2
  156. package/dist/platforms/desktop.js +0 -415
  157. package/dist/platforms/extension.d.ts +0 -2
  158. package/dist/platforms/extension.js +0 -328
  159. package/dist/scaffold/lint.d.ts +0 -4
  160. package/dist/scaffold/lint.js +0 -56
  161. package/dist/scaffold/neon-realtime.d.ts +0 -2
  162. package/dist/scaffold/neon-realtime.js +0 -97
  163. package/dist/scaffold/services.d.ts +0 -5
  164. package/dist/scaffold/services.js +0 -108
  165. package/dist/scaffold/stream.d.ts +0 -2
  166. package/dist/scaffold/stream.js +0 -114
  167. package/dist/scaffold/void.d.ts +0 -4
  168. package/dist/scaffold/void.js +0 -256
  169. package/dist/scaffold/web.d.ts +0 -2
  170. package/dist/scaffold/web.js +0 -128
  171. package/dist/vercel-project.d.ts +0 -101
  172. package/dist/vercel-project.js +0 -305
  173. package/dist/vercel.d.ts +0 -67
  174. package/dist/vercel.js +0 -581
  175. package/dist/vinext.d.ts +0 -2
  176. package/dist/vinext.js +0 -86
  177. package/dist/void-execution.d.ts +0 -10
  178. package/dist/void-execution.js +0 -94
  179. package/dist/void-migrations.d.ts +0 -6
  180. package/dist/void-migrations.js +0 -110
  181. package/dist/void-state.d.ts +0 -16
  182. package/dist/void-state.js +0 -65
  183. package/dist/void.d.ts +0 -3
  184. package/dist/void.js +0 -5
@@ -1,250 +1,72 @@
1
1
  # Stack standard
2
2
 
3
- This is the architecture standard for applications generated by Anhedral. Use it to select components and decide where code belongs. Follow the [software factory](software-factory.md) to implement and deliver the product.
4
-
5
- The default web foundation is Vinext, React, TypeScript, Tailwind, shadcn/ui and Lucide on Cloudflare Workers. Every project uses pnpm workspaces and Turborepo. Add components for a concrete product requirement; the default does not include a database, identity provider or every available service.
6
-
7
- ## Defaults and foundations
8
-
9
- | Area | Default behavior |
10
- | ------------------------------- | ---------------------------------------------------------------------------------------------------- |
11
- | Application | Vinext web app; Cloudflare hosting |
12
- | Workspace | pnpm workspaces, Turborepo and one root lockfile, including single-app projects |
13
- | Shared tooling | `packages/typescript-config` and `packages/eslint-config` |
14
- | Web UI | Shared `packages/ui`, shadcn/ui conventions, React, Tailwind and Lucide |
15
- | Cloudflare delivery | Void for supported selections; explicit OpenNext, Queues and Basin use Wrangler |
16
- | Runtime | Node.js `24.21.0+` for Void; pnpm `10.34.5` |
17
- | Configuration | One root `anhedral.json`; application tooling stays beside its app |
18
- | Data, identity and integrations | Opt-in; no database, authentication, billing, email or analytics service is selected by plain `init` |
19
- | Generation | Source and dependency setup; no cloud provisioning, deployment or automatic source commit |
20
-
21
- The registry contains 28 selectable products and four foundation entries: `workspace`, `typescript`, `eslint` and `ui`. The first three accompany every project; `ui` accompanies web applications. Product flags select recipes; the resolver supplies required foundation dependencies.
22
-
23
- ## Select the applications
24
-
25
- | Need | Selection | Destination and generated architecture |
26
- | ------------------------------ | ----------------------------- | --------------------------------------------------------------------------------------------------- |
27
- | Web on Workers | Default, or `--vinext` | `apps/web`; Vinext, Vite and React on Cloudflare |
28
- | Native Next.js on Vercel | `--next` | `apps/web`; native Next.js and Vercel configuration |
29
- | Next.js on Workers | `--next --hosting=cloudflare` | `apps/web`; OpenNext adapter and Wrangler delivery |
30
- | API shared by multiple clients | `--hono` | `apps/api`; Hono Worker with OpenAPI/Zod contracts and health route |
31
- | iOS and Android | `--expo` | `apps/mobile`; Expo, React Native, Expo Router, NativeWind and React Native Reusables configuration |
32
- | Desktop | `--electron` | `apps/desktop`; Electron, React, Vite, isolated preload and platform packaging configuration |
33
- | Browser extension | `--wxt` | `apps/extension`; WXT/React Chrome side panel with user-triggered active-page access |
34
-
35
- For example, `--vinext --hono --expo --neon` selects web, an API, mobile and PostgreSQL. Explicit application flags replace the default application selection: `--expo` alone selects mobile, and `--hono` alone selects the API. If only add-ons are requested, the resolver includes a default web app: `--neon` selects Neon and Vinext. Vinext and Next.js are alternatives. Native Next.js defaults to Vercel; Vinext uses Workers.
36
-
37
- Use server routes inside the web app when it is the only consumer. Add Hono when mobile, desktop, extensions or independent clients need a shared API. Browser and device clients access server endpoints; they never import database factories or receive server credentials. Check actual Vinext behavior in its Worker runtime rather than assuming native Next.js parity.
38
-
39
- ## Select data and identity
40
-
41
- | Selection | Destination and generated scope | Required implementation/setup |
42
- | --------------- | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
43
- | `--d1` | `packages/db`; Drizzle/D1 factory, schema and explicit migration tooling; `DB` Worker binding | Create/reconcile the database, define product tables and review SQL; one deployment migration owner |
44
- | `--neon` | `packages/db`; Drizzle/Neon HTTP factory, schema and transactional migration tooling | Select project/role, configure runtime and separate direct migration connections, review SQL |
45
- | `--better-auth` | `packages/auth` and database schema; auth routes on the selected server | Private secret, public auth origin, migrations, sign-up policy and resource authorization |
46
- | `--clerk` | Web provider, sign-in/up pages and middleware when web is selected; `packages/auth` backend helper when Hono is selected | Configure keys, origins, protected routes and native client integration as needed |
47
- | `--local-data` | `packages/local-data`; async read/write interface | Implement platform-specific SQLite/filesystem adapters, offline behavior and synchronization |
48
-
49
- D1 is the standard choice when Worker-local SQL fits. Choose Neon when the application needs PostgreSQL semantics. Better Auth supplies application-controlled identity; Clerk supplies hosted identity. Hosting audience protection is a separate access layer from either choice.
50
-
51
- ## Select services
52
-
53
- | Selection | Destination and generated scope | Required implementation/setup |
54
- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
55
- | `--r2` | Selected server's private `FILES` binding and `private-files.md` | Authorized upload/download/delete endpoints and file ownership checks; no public bucket or generic file API is generated |
56
- | `--kv` | Selected server's `CONFIG` binding | Keys, TTLs and propagation handling; never use KV as transactional authority |
57
- | `--realtime` | `apps/realtime`; SQLite-backed Durable Object rooms and WebSocket message forwarding | Authenticate connections, authorize membership, isolate rooms and handle reconnects; public entry returns 501 until implemented |
58
- | `--neon-realtime` | `packages/neon-realtime`; separate sealing server/subscription client factories and Drizzle adapter | Manually activate the selected branch, configure origins and implement authorized queries, renewal and cleanup |
59
- | `--stream` | `packages/stream`; server-only Cloudflare Stream live input factory for WHIP/WHEP broadcasts | Activate Stream manually; implement creator/player UI, input ownership, media negotiation, playback privacy and teardown |
60
- | `--queues` | `apps/jobs`; queue producer/consumer, retry limits and dead-letter configuration; producer binding on a selected server | Transactional idempotency, processing and dead-letter recovery; the starter retries messages instead of acknowledging unimplemented work |
61
- | `--cron` | `apps/scheduled`; scheduled Worker with an hourly starter trigger | Product schedule, task implementation, overlap policy, idempotency and failure visibility |
62
- | `--workflows` | `apps/workflows`; durable workflow and a retryable validation step | Authorized invocation, product steps, retry/resume/cancel behavior and recovery |
63
- | `--workers-ai` | Selected server's `AI` Worker binding | Model calls, authorization, input handling, usage and spending limits |
64
-
65
- `--realtime` and `--neon-realtime` are independent and can coexist. The former supplies room-based messaging infrastructure; the latter supplies live SQL query integration. Neither generates a complete collaboration or subscription feature.
66
-
67
- ## Select SDKs and integrations
68
-
69
- | Selection | Destination and generated scope | Required implementation/setup |
70
- | -------------- | ---------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
71
- | `--openai` | `packages/ai`; direct server-side OpenAI SDK factory | Models, routes, failure handling and usage limits |
72
- | `--ai-sdk` | `packages/ai`; AI SDK `generateText`/`streamText` exports and OpenAI provider | Streaming, tools, cancellation and provider configuration; generated credentials default to OpenAI |
73
- | `--resend` | `packages/email`; server SDK factory | Verified sending domain, templates, delivery/bounce handling and webhook verification |
74
- | `--stripe` | `packages/billing`; server SDK factory | Products/prices, purchase/cancellation flows, signed webhooks, entitlements and idempotency |
75
- | `--revenuecat` | `packages/billing/revenuecat.md`; cross-store integration guidance | Install platform SDKs and configure store products, offerings, purchase/restore flows and entitlement reconciliation |
76
- | `--sentry` | `packages/observability`; integration boundary and redaction fields | Install/init platform SDKs, configure private source-map uploads and verify alerts |
77
- | `--posthog` | `packages/analytics`; server analytics factory | Event schema, consent, privacy filtering and event delivery |
78
- | `--basin` | `packages/analytics`, or `packages/basin` alongside PostHog; event helper and private `ANALYTICS` stream binding | Event schema, ingestion verification and application-specific sink/transformation design |
79
- | `--styling` | `packages/styling`; light/dark tokens and Tailwind v3 preset used by Expo/WXT | Platform typography/components and adoption by other interfaces; automatically selected with Expo and WXT |
80
-
81
- OpenAI and AI SDK are alternative recipes for `packages/ai`; Workers AI can accompany either. PostHog and Basin can coexist: the Basin recipe changes its package destination to avoid a collision. Electron starts with its own renderer styling; shared tokens do not imply one component library across every platform.
82
-
83
- The provider adapters can configure selected Neon projects/connections, Clerk applications/keys, Resend domains/sending keys, Stripe account/webhook setup, RevenueCat projects/apps/keys, Sentry projects/DSNs, PostHog projects and OpenAI projects/service accounts. This automation is separate from the generated application integration. See [provider configuration](software-factory.md#provider-configuration) for fields, credentials, permissions and remaining owner steps. Neon Realtime activation is manual.
84
-
85
- ## Composition and compatibility
86
-
87
- | Choice | Resolver behavior |
88
- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
89
- | No application flag | Adds Vinext, or Next.js when Vercel hosting is selected |
90
- | `--next` without a hosting flag | Selects Vercel |
91
- | Vinext with Vercel | Rejected; Vinext requires Cloudflare |
92
- | Vinext and Next.js; D1 and Neon; Better Auth and Clerk; OpenAI and AI SDK | Each pair is mutually exclusive |
93
- | Better Auth without a database | Adds D1; an explicit Neon selection uses PostgreSQL instead |
94
- | Neon Realtime without a database | Adds Neon; an explicit D1 selection is rejected |
95
- | Better Auth with Neon Realtime | Resolves to Neon regardless of flag order |
96
- | RevenueCat without Stripe | Rejected; select `--stripe` explicitly |
97
- | Expo or WXT | Includes the shared styling package |
98
- | Database/auth or Neon Realtime without a server | Rejected; select a compatible web app or Hono |
99
- | Native Next.js/Vercel with Worker-bound capabilities such as D1, R2, KV or Workers AI | Adds Hono for the Cloudflare runtime |
100
- | OpenNext, Queues or Basin | Uses Wrangler for all Cloudflare targets in the workspace |
101
- | Later addition that changes the engine or relocates existing runtime source | Rejected; `add` does not migrate delivery engines or runtime ownership |
102
-
103
- When Hono is selected, it owns the shared database/auth runtime and server resource bindings. Other interfaces consume its endpoints. Worker services such as realtime, cron and workflows have their own deployable applications.
3
+ Anhedral generates one application architecture. The public CLI is maintained as an open-source application factory, separate from the hosted Anhedral platform control plane.
104
4
 
105
- ```sh
106
- # Web with D1 and Better Auth (D1 is also the conditional auth default).
107
- anhedral init my-app --better-auth
108
-
109
- # Web, API and mobile with PostgreSQL.
110
- anhedral init my-app --vinext --hono --expo --neon
111
-
112
- # Vercel web with an automatically selected Hono backend for R2.
113
- anhedral init my-app --next --r2
114
-
115
- # Independent room messaging and live PostgreSQL queries.
116
- anhedral init my-app --realtime --neon-realtime
117
- ```
118
-
119
- The bundled registry is authoritative for exact dependencies, destinations and compatibility:
120
-
121
- ```sh
122
- anhedral registry list --json
123
- anhedral registry view better-auth --json
124
- anhedral init my-app --vinext --hono --d1 --better-auth --r2 --dry-run --json
125
- ```
126
-
127
- Append `--dry-run --json` to an initialization command to inspect its resolved products, destinations and setup requirements without writes or network requests. There is no `--all` or external registry support. Recipes create integration foundations; provider resources, credentials and finished features have their own setup and acceptance requirements.
128
-
129
- ## Organize the source
130
-
131
- | Location | Owns |
132
- | ------------------------------------------------------ | ---------------------------------------------------------------------------- |
133
- | `apps/web`, `apps/api`, other selected `apps/*` | Deployable applications and services, runtime entry points and configuration |
134
- | `packages/ui` | Shared web UI components |
135
- | `packages/db` | Server-only database factory, schemas and migrations |
136
- | `packages/auth`, other selected `packages/*` | Reusable integration code with explicit inputs |
137
- | `packages/typescript-config`, `packages/eslint-config` | Shared tooling conventions |
138
- | `anhedral.json` | Committed Anhedral configuration and provenance |
139
- | `docs/stack.md` | Generated selection, destinations and setup requirements |
140
- | `.anhedral/` | Ignored local delivery journals and private state |
141
-
142
- Use one root `pnpm-lock.yaml` and the root task graph. Keep framework-specific lint dependencies in the consuming app; shared lint configuration stays usable by non-web clients. Shared packages receive bindings, connections and configuration through factories. Extract code around actual consumers, and keep runtime/network relationships explicit.
143
-
144
- See the [full-stack example](https://github.com/anhedral/anhedral-cli/tree/main/examples/full-stack) for a source-only composition. It demonstrates the structure; it is not a running production system.
145
-
146
- ### One Anhedral configuration
147
-
148
- The root `anhedral.json` has an envelope with `schemaVersion: 1` and validated named sections. Each section retains its own domain schema. Only selected hosting sections are present.
149
-
150
- | Section | Purpose |
151
- | ------------ | --------------------------------------------------------------------- |
152
- | `identity` | Stable application identity and local catalog registration |
153
- | `setup` | Products, hosting, environment requirements and owner setup |
154
- | `standard` | Scaffold conventions and version provenance |
155
- | `registry` | Recipe versions, generated-file fingerprints and workspace references |
156
- | `providers` | Nonsecret integration settings and resource selections |
157
- | `cloudflare` | Delivery engine, account, audience and targets |
158
- | `vercel` | Repository, team, project and audience |
5
+ ## Default application
159
6
 
160
- Preserve unrelated sections when editing. Credentials and delivery history stay outside this document. Native tooling files remain with their applications: a single Anhedral document does not replace `package.json`, Vite configuration or per-app deployment configuration.
7
+ | Owner | Responsibility |
8
+ | --- | --- |
9
+ | apps/web | Next.js App Router web application, DOM shadcn UI, SSR/RSC and Cloudflare OpenNext |
10
+ | apps/mobile | Expo iOS/Android application and the Anhedral native shadcn port using StyleSheet and shared tokens |
11
+ | apps/api | Hono Worker, authentication, application routes and authorization |
12
+ | packages/contracts | Framework-independent schemas, JSON contracts and transport |
13
+ | packages/db | Drizzle/D1 schema and explicit migrations |
14
+ | packages/auth | Better Auth server construction and session contracts |
15
+ | packages/styling | Shared colors, spacing and light/dark tokens |
161
16
 
162
- ## Data and migrations
17
+ Plain `anhedral init my-app` includes Next.js web, Expo native, Hono, D1, private R2, supporting Better Auth and styling. TypeScript, pnpm, Turborepo and shared checks are supporting infrastructure. There is no frontend, database, hosting or preset selection menu.
163
18
 
164
- All database-backed selections use the server-only `@workspace/db` package:
19
+ D1 is the supported database. Neon/PostgreSQL is not an available addition in this release. A future migration would require schema conversion, data movement and validation; it is not a connection-string change.
165
20
 
166
- | Path | Responsibility |
167
- | ------------------------------- | ----------------------------------------------------- |
168
- | `packages/db/src/index.ts` | Factory receiving a D1 binding or connection string |
169
- | `packages/db/src/schema.ts` | Shared Drizzle schema, including selected auth tables |
170
- | `packages/db/src/migrate.ts` | Explicit migration entry point |
171
- | `packages/db/drizzle/` | SQL, snapshots and migration journal |
172
- | `packages/db/drizzle.config.ts` | Configuration with paths relative to itself |
21
+ ## Private files
173
22
 
174
- The factory does not load environment files or migrate on startup. Review generated SQL from `pnpm db:generate` before running `pnpm db:migrate`. Both tasks are uncached and excluded from builds and checks. Exactly one server owns deployment migrations; other consumers share the database without becoming migration writers.
23
+ R2 is accessed through the API's authenticated owner-scoped file routes, never public bucket access or client storage credentials. Authorize every object operation server-side. Bound upload sizes and reject caller-controlled ownership; test anonymous and cross-user rejection as well as successful upload/download/delete. Buckets and database bindings are provisioned explicitly after source generation.
175
24
 
176
- D1 manual migration defaults to local. `pnpm db:migrate -- --remote` explicitly targets the configured database in the migration owner's Worker configuration. Void deployment validates an ignored, byte-identical app-local copy against the authoritative shared SQL; the copy is not another migration source.
25
+ ## Identity
177
26
 
178
- Neon runtime queries use server-supplied `DATABASE_URL` through the HTTP adapter. Interactive transactions require a reviewed WebSocket or PostgreSQL adapter. Migrations use a transactional WebSocket connection and direct `DATABASE_URL_UNPOOLED` from the environment or `packages/db/.env.local`/`.env`. Test migrations on the intended development branch before production. Runtime provisioning does not supply migration credentials automatically.
27
+ Better Auth is supporting core infrastructure rather than a selectable catalog alternative. Use its verified session subject for file ownership and billing identity. Application identity is separate from provider-management authentication and hosted Platform accounts. Keep auth secrets on the server, configure trusted origins, and apply reviewed auth migrations explicitly. Native session handling and HTTPS device origins need their own acceptance.
179
28
 
180
- ## Live video with Cloudflare Stream
29
+ ## Only two optional additions
181
30
 
182
- Select `--stream` for one-to-many ultra-low latency live video: browser or supported encoder publishes with WHIP and viewers play with WHEP. [Stream Live WebRTC reached GA on October 15, 2026](https://developers.cloudflare.com/changelog/post/2026-10-15-stream-live-webrtc-ga/). It is the preferred broadcast service when a product needs live video. Add it only when needed; it can coexist with `--realtime` Durable Object messaging and `--neon-realtime` live SQL. Many-to-many calls require a separate Cloudflare Realtime design.
183
-
184
- The recipe creates `packages/stream` with a server-only `@workspace/stream/server` export. `createStream({ accountId, apiToken })` exposes live input creation and retrieval. It requires a server, works with Vinext, native Next.js or Hono, and adds no Worker resource binding or SDK dependency. Follow the generated package README. Stream activation, live inputs and runtime credentials are configured explicitly; CLI provisioning and `ship` do not automate this integration.
185
-
186
- Keep `STREAM_API_TOKEN` server-only and scope it to Stream Write in the customer account selected by `STREAM_ACCOUNT_ID`. Authorize creators, persist input ownership and enforce quotas before management calls. The returned `webRTC.url` is a publish credential: disclose it only to the authorized broadcaster, never to viewers, logs or static assets. Viewer responses contain only the approved WHEP endpoint or short-lived playback token. Choose `requireSignedURLs` explicitly when creating an input; implement and verify playback token issuance for private broadcasts. Hosting access protection does not protect Stream media endpoints.
187
-
188
- Media goes directly between the browser and Stream. The application server owns identity, input ownership and endpoint/token issuance. Implement camera/microphone consent, HTTPS, ICE negotiation, user-facing errors, reconnect and session cleanup. Delete signaling sessions, close peer connections and stop capture tracks when a broadcast ends. No finished player, broadcaster or conferencing feature is generated.
189
-
190
- As reviewed October 16, 2026, the [WebRTC documentation](https://developers.cloudflare.com/stream/webrtc-beta/) requires paired WHIP/WHEP and excludes recording, WHIP-to-HLS/DASH playback, RTMP/SRT-to-WHEP bridging, restreaming and live viewer counts. Usage is visible in Stream analytics/billing; broadcast and player-experience metrics remain unsupported. The URL retains `webrtc-beta` although the feature is GA. [Delivery billing](https://developers.cloudflare.com/stream/pricing/) began October 15 at standard Stream rates; budget viewer-minutes and check current account eligibility before activation. Verify creator/viewer access, private media denial, cross-tenant isolation, reconnect and teardown against the actual provider before claiming live acceptance.
31
+ | Addition | Scope |
32
+ | --- | --- |
33
+ | stripe | Authenticated web checkout/customer portal, webhooks, reconciliation and server entitlements |
34
+ | revenuecat | Native purchase/restore/manage adapters, provider reconciliation and shared server entitlements |
191
35
 
192
36
  ```sh
193
- anhedral init my-app --stream
194
- anhedral add stream --dry-run --json
37
+ anhedral init my-app --stripe
38
+ anhedral init my-app --revenuecat
39
+ anhedral init my-app --stripe --revenuecat
40
+ anhedral add stripe --cwd my-app --dry-run --json
41
+ anhedral add revenuecat --cwd my-app
195
42
  ```
196
43
 
197
- ## Neon Realtime
198
-
199
- `--neon-realtime` selects live PostgreSQL query foundations and adds Neon if no database was chosen. It requires a server and rejects an explicit conflicting database. It can coexist with `--realtime`, which means Durable Object WebSocket rooms.
200
-
201
- The recipe creates `@workspace/neon-realtime/server` and `/client` exports in `packages/neon-realtime`. The server receives private `NEON_REALTIME_SECRET` and `DATABASE_URL`; the client receives public `NEON_REALTIME_URL`. Follow the generated package README for framework-specific public environment mapping.
202
-
203
- Enable Realtime on the intended Neon branch and configure exact allowed origins, secret and endpoint manually. Authenticate sealing requests, derive user/tenant scope from verified identity, and construct bounded read-only queries on the server. Clients subscribe with short-lived sealed queries; implement authorized renewal, reconnect behavior and isolation tests. No arbitrary SQL endpoint or complete subscription feature is generated.
204
-
205
- The pinned integration targets the [Neon Realtime beta](https://neon.com/docs/realtime/overview), whose reviewed authorization model has no RLS support. Scope the queries you seal and review the provider's current limits before production use. Recipe tests do not establish live subscription or cross-tenant acceptance.
206
-
207
- ## Runtime and delivery configuration
208
-
209
- | Profile | Engine and configuration | Project runtime floor |
210
- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
211
- | Supported Cloudflare selections | Void `0.27.0`; app-local `anhedral.cloudflare.json`, `void.config.ts`, `env.ts`, `env.example`, committed `void.lock.json` | Node.js `24.21.0+` |
212
- | Explicit OpenNext, Queues/DLQ or Basin | Wrangler; app-local `wrangler.jsonc` | Node.js `22.13+` on 22.x, or `24+` |
213
- | Native Next.js/Vercel and other non-Void profiles | Native framework/platform tools | Node.js `22.13+` on 22.x, or `24+` |
214
-
215
- Use pnpm `10.34.5`. The CLI's own supported Node range is broader than the generated toolchains' requirements. For a new development environment, Node.js `24.21.0+` satisfies these documented floors.
216
-
217
- There is one Cloudflare engine per workspace. `add` refuses selections that would switch the engine or relocate existing runtime source. Anhedral owns composition, account/audience selection, shared packages and independent verification; Void owns its supported provisioning, deployment and code rollback mechanics. Native Void framework features are not implied by deploying Vinext through Void.
218
-
219
- Void apps read one private app-root `.env`, copied from `env.example`. Avoid `.env.*` companions and `.dev.vars` in those apps. Wrangler and native Vercel use their generated runtime templates. Keep production secrets server-side; public `VITE_*`, `NEXT_PUBLIC_*` and `EXPO_PUBLIC_*` values are build inputs, not server secrets. Vinext maps `NEXT_PUBLIC_*` into client bundles. The [provider reference](software-factory.md#provider-configuration) describes credential transport and each integration's prerequisites.
220
-
221
- ### Delivery scope by target
222
-
223
- | Target | Supported automation | Remaining delivery work |
224
- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
225
- | Cloudflare web/API/services | Selected resource setup, bindings/secrets, deployment, provider evidence, verification and recorded code rollback | Account/audience selection, product acceptance and data compatibility; rollback does not reverse SQL or restore data |
226
- | Native Next.js/Vercel | Project connection, environment configuration, CLI delivery or adoption of connected Git deployments, provider evidence and recorded rollback | Eligible account plan, audience protection, repository/CI policy and product acceptance |
227
- | Mixed Cloudflare/Vercel | Cloudflare first, then Vercel, with per-target receipts | Handle partial success; there is no atomic cross-provider release or rollback |
228
- | Expo | Explicit platform/profile EAS build, project/source checks, queued-build resume and artifact receipt | Signing, device acceptance, store enrollment and submission; a simulator build is not a store artifact |
229
- | Electron | Local build and packaging scripts | Platform signing, notarization, installers, updates and distribution |
230
- | WXT | Local extension build and ZIP tooling | Installed-browser acceptance, store review and publication |
231
-
232
- Hosting audience starts unconfigured and must be selected explicitly. Hosting protection, application authentication and resource authorization are separate decisions. Generated SDK factories and configured provider resources do not establish completed user flows.
233
-
234
- The optional Codex inspector uses the same project and service domain logic as the CLI. Opening it reads local configuration and recorded evidence. Live status, analytics and bounded data reads require explicit service actions; supported deletion requires its separate confirmation flow. The inspector is development tooling, not a generated application dependency.
44
+ Stripe and RevenueCat are independent. Configure products, prices/offerings, environment, application IDs, credentials and webhook endpoints in the intended accounts. Use server-verified provider state for access; client purchase callbacks and redirects never grant entitlements. Preserve replay handling, durable reconciliation, expiry and fail-closed behavior. No real payment or provider activation occurs during generation.
235
45
 
236
- ## Source ownership and dependency policy
46
+ ## Runtime boundaries
237
47
 
238
- Generated source belongs to the application and remains editable. Preview bundled additions with `add --dry-run`, `--diff` or `--view`; additions preserve edited/untracked source and record provenance. They require current registry receipts. When `filesChecked: false`, the selection plan is available but a new upstream web bootstrap cannot be previewed offline. Actual installation checks conflicts before committing files.
48
+ Hono owns privileged behavior. Applications do not import each other's source. Shared schema/transport stays framework-independent. Use request-scoped database and service factories. Private responses must not enter shared caches. No credentials or raw secrets in clients, generated source, logs or Git.
239
49
 
240
- The catalog in `src/stack-registry.ts` defines composition, `src/dependencies.ts` pins dependencies, and `src/scaffold/` implements recipes. Generated plugin references come from these maintained sources and documents.
50
+ Cloudflare Workers host the OpenNext web application and Hono API. The web Worker calls Hono through its `ANHEDRAL_API` service binding. Next server rendering and actions adapt requests to Hono; they never own database/auth-server access. Web UI uses DOM shadcn components; native UI uses the Anhedral-maintained shadcn port. Both share contracts and design tokens. Native signing, device/store acceptance and store submission remain separate from OpenNext deployment. See [workflow](software-factory.md) for supported commands and evidence boundaries.
241
51
 
242
- Commit the resolved lockfile and any generated `patches/*` plus `pnpm-workspace.yaml` patch mappings. Conditional reviewed patches apply only to `braces@3.0.3` and `node-forge@1.4.0`. `pnpm audit:deps` retains raw upstream findings in `.anhedral-audit-report.json` and blocks high/critical advisories except the exact reviewed advisory/version/patch combinations (`GHSA-vfj7-8cjw-p6xm` and `GHSA-86w9-cpqp-85rv`). Frozen pnpm installation applies patches; detailed runtime regressions belong to this repository's `pnpm test:patch`. These temporary mitigations must be reviewed each release and retired when a compatible verified fix replaces them. Compatible brace-expansion overrides do not create an exception for an affected 3.x consumer.
52
+ ## Version compatibility
243
53
 
244
- Validate the resolved dependency graph for each application selection. A clean CLI dependency graph does not establish a clean generated application graph.
54
+ Version 0.15 replaces Expo web with full Next.js App Router through OpenNext and keeps Expo for iOS/Android only. The former broad catalog remains retired. Core records are always present; only Stripe and RevenueCat can be selected as additions. Registry inspection may show supporting records; it does not make those records independently selectable additions. Legacy application source and provider resources are never deleted or migrated by this change. Preserve old CLI pins for old projects and retain dated verification as historical evidence.
245
55
 
246
- ## Product requirements
56
+ ## Managed authentication email
247
57
 
248
- A completed application has server-side resource authorization, private file access, reviewed migrations, meaningful error/loading/empty states and tests for its actual user flows. Jobs and webhooks must tolerate duplicates; paid operations need limits and ownership. Verify the selected runtime and any native packaging, permissions and signing.
58
+ New apps include a server-only `packages/managed-email` adapter and web/native
59
+ verification and password-reset screens. Anhedral operations may provision the API
60
+ Worker's `ANHEDRAL_EMAIL` service binding, `ANHEDRAL_EMAIL_SCOPE` UUID and secret
61
+ `ANHEDRAL_EMAIL_CAPABILITY`; provider keys and sender configuration stay in the
62
+ broker. Its scope must match the app's public Better Auth origin and exact native
63
+ scheme. Do not expose these values through Next public variables or Expo config.
249
64
 
250
- Use the [software factory](software-factory.md) for the implementation and acceptance process. Detailed delivery evidence and outstanding live acceptance gaps belong in the [Void verification reference](verification.md#void-delivery-verification) and the application's own verification record, rather than in this architecture standard.
65
+ No broker configuration preserves standalone sign-in behavior. Partial setup fails
66
+ closed. Complete setup requires verified email and enables reset delivery with
67
+ session revocation. Do not remove broker configuration to bypass verification;
68
+ existing unverified sessions need an explicit revocation plan when enabling the
69
+ policy for an existing deployment. Initialization does not provision email or send
70
+ messages. Test with an isolated sink; a receipt proves acceptance, not inbox delivery.
71
+ Existing hosted execution images remain pinned until a separate verified image
72
+ release; publishing the CLI does not replace them or rewrite saved apps.