anhedral 0.13.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 (170) hide show
  1. package/README.md +35 -232
  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 -50
  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 -86
  26. package/dist/delivery-evidence.d.ts +1 -1
  27. package/dist/delivery-evidence.js +7 -36
  28. package/dist/delivery.d.ts +2 -8
  29. package/dist/delivery.js +20 -101
  30. package/dist/dependencies.d.ts +6 -57
  31. package/dist/dependencies.js +54 -188
  32. package/dist/index.d.ts +1 -4
  33. package/dist/index.js +1 -4
  34. package/dist/inspector-model.d.ts +2 -2
  35. package/dist/integration-service-readers.d.ts +1 -2
  36. package/dist/integration-service-readers.js +3 -84
  37. package/dist/lifecycle-model.d.ts +1 -1
  38. package/dist/lifecycle-model.js +1 -1
  39. package/dist/mobile-delivery.d.ts +1 -1
  40. package/dist/mobile-delivery.js +4 -0
  41. package/dist/platforms/mobile.js +30 -121
  42. package/dist/platforms/web.d.ts +3 -0
  43. package/dist/platforms/web.js +299 -0
  44. package/dist/project-config.d.ts +1 -1
  45. package/dist/project-config.js +0 -1
  46. package/dist/project-inspector.js +5 -36
  47. package/dist/project-state.d.ts +1 -3
  48. package/dist/project-state.js +2 -85
  49. package/dist/provider-auth.js +3 -38
  50. package/dist/provider-readiness.d.ts +1 -1
  51. package/dist/provider-readiness.js +5 -24
  52. package/dist/providers/adapters.js +0 -175
  53. package/dist/providers/api.d.ts +1 -1
  54. package/dist/providers/api.js +3 -3
  55. package/dist/providers/config.js +2 -48
  56. package/dist/providers/definitions.d.ts +1 -204
  57. package/dist/providers/definitions.js +0 -85
  58. package/dist/providers/provision.d.ts +1 -1
  59. package/dist/providers/receipts.js +1 -11
  60. package/dist/providers/recovery-verification.js +1 -61
  61. package/dist/providers/runtime.js +4 -35
  62. package/dist/providers/state.js +1 -7
  63. package/dist/provision.d.ts +5 -13
  64. package/dist/provision.js +4 -80
  65. package/dist/readiness.d.ts +1 -1
  66. package/dist/readiness.js +3 -8
  67. package/dist/registry/add.js +10 -70
  68. package/dist/registry/bootstrap.d.ts +3 -2
  69. package/dist/registry/bootstrap.js +4 -13
  70. package/dist/registry/commands.js +8 -10
  71. package/dist/registry/context.js +0 -1
  72. package/dist/registry/options.js +8 -38
  73. package/dist/registry/resolve.d.ts +3 -4
  74. package/dist/registry/resolve.js +26 -108
  75. package/dist/registry/types.d.ts +1 -7
  76. package/dist/registry/usage.js +2 -2
  77. package/dist/runtime-policy.d.ts +0 -2
  78. package/dist/runtime-policy.js +0 -16
  79. package/dist/scaffold/auth.d.ts +1 -2
  80. package/dist/scaffold/auth.js +55 -130
  81. package/dist/scaffold/backend.d.ts +0 -4
  82. package/dist/scaffold/backend.js +1 -186
  83. package/dist/scaffold/billing-schema.d.ts +1 -1
  84. package/dist/scaffold/billing-schema.js +4 -4
  85. package/dist/scaffold/billing.js +11 -19
  86. package/dist/scaffold/bootstrap.d.ts +2 -3
  87. package/dist/scaffold/bootstrap.js +37 -43
  88. package/dist/scaffold/compose.js +2 -14
  89. package/dist/scaffold/database.d.ts +1 -1
  90. package/dist/scaffold/database.js +18 -126
  91. package/dist/scaffold/documentation.d.ts +0 -1
  92. package/dist/scaffold/documentation.js +22 -86
  93. package/dist/scaffold/expo-auth.js +33 -22
  94. package/dist/scaffold/expo-billing.js +17 -52
  95. package/dist/scaffold/expo-runtime.d.ts +2 -2
  96. package/dist/scaffold/expo-runtime.js +6 -97
  97. package/dist/scaffold/integrations.d.ts +1 -3
  98. package/dist/scaffold/integrations.js +9 -10
  99. package/dist/scaffold/managed-email.d.ts +3 -0
  100. package/dist/scaffold/managed-email.js +47 -0
  101. package/dist/scaffold/native-ui.d.ts +2 -0
  102. package/dist/scaffold/native-ui.js +69 -0
  103. package/dist/scaffold/password-reset.d.ts +1 -0
  104. package/dist/scaffold/password-reset.js +99 -0
  105. package/dist/scaffold/private-files.d.ts +2 -0
  106. package/dist/scaffold/private-files.js +78 -0
  107. package/dist/scaffold/stack-documentation.d.ts +0 -1
  108. package/dist/scaffold/stack-documentation.js +3 -49
  109. package/dist/scaffold/styling.d.ts +1 -1
  110. package/dist/scaffold/styling.js +20 -28
  111. package/dist/scaffold/web-billing.d.ts +2 -0
  112. package/dist/scaffold/web-billing.js +48 -0
  113. package/dist/scaffold/workspace.js +53 -194
  114. package/dist/service-deletion.js +1 -1
  115. package/dist/service-descriptor.js +5 -12
  116. package/dist/service-model.d.ts +1 -1
  117. package/dist/service-operations.js +2 -32
  118. package/dist/service-readers.js +1 -32
  119. package/dist/services-command.d.ts +1 -1
  120. package/dist/services-command.js +3 -9
  121. package/dist/ship.d.ts +3 -316
  122. package/dist/ship.js +10 -142
  123. package/dist/stack-registry.d.ts +2 -52
  124. package/dist/stack-registry.js +55 -403
  125. package/dist/standard.js +7 -14
  126. package/dist/version.d.ts +1 -1
  127. package/dist/version.js +1 -1
  128. package/docs/anhedral-stack.md +23 -122
  129. package/docs/assets/anhedral-stack-light.png +0 -0
  130. package/docs/assets/anhedral-stack.png +0 -0
  131. package/docs/software-factory.md +24 -557
  132. package/docs/stack-standard.md +47 -294
  133. package/docs/verification.md +320 -0
  134. package/package.json +20 -22
  135. package/dist/neon-service-data.d.ts +0 -8
  136. package/dist/neon-service-data.js +0 -117
  137. package/dist/platforms/desktop.d.ts +0 -2
  138. package/dist/platforms/desktop.js +0 -415
  139. package/dist/platforms/extension.d.ts +0 -2
  140. package/dist/platforms/extension.js +0 -328
  141. package/dist/registry/presets.d.ts +0 -4
  142. package/dist/registry/presets.js +0 -41
  143. package/dist/scaffold/cloudflare-services.d.ts +0 -8
  144. package/dist/scaffold/cloudflare-services.js +0 -198
  145. package/dist/scaffold/lint.d.ts +0 -4
  146. package/dist/scaffold/lint.js +0 -56
  147. package/dist/scaffold/neon-realtime.d.ts +0 -2
  148. package/dist/scaffold/neon-realtime.js +0 -97
  149. package/dist/scaffold/services.d.ts +0 -5
  150. package/dist/scaffold/services.js +0 -108
  151. package/dist/scaffold/stream.d.ts +0 -2
  152. package/dist/scaffold/stream.js +0 -114
  153. package/dist/scaffold/void.d.ts +0 -4
  154. package/dist/scaffold/void.js +0 -264
  155. package/dist/scaffold/web.d.ts +0 -2
  156. package/dist/scaffold/web.js +0 -130
  157. package/dist/vercel-project.d.ts +0 -101
  158. package/dist/vercel-project.js +0 -305
  159. package/dist/vercel.d.ts +0 -67
  160. package/dist/vercel.js +0 -581
  161. package/dist/vinext.d.ts +0 -2
  162. package/dist/vinext.js +0 -86
  163. package/dist/void-execution.d.ts +0 -10
  164. package/dist/void-execution.js +0 -94
  165. package/dist/void-migrations.d.ts +0 -6
  166. package/dist/void-migrations.js +0 -110
  167. package/dist/void-state.d.ts +0 -16
  168. package/dist/void-state.js +0 -65
  169. package/dist/void.d.ts +0 -3
  170. package/dist/void.js +0 -5
@@ -1,319 +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.
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.
4
4
 
5
- The default is a minimal Expo web/iOS/Android client in `apps/mobile`, with React
6
- Native Reusables using shadcn conventions, NativeWind, shared styling, TypeScript,
7
- pnpm and Turborepo. Cloudflare serves the static web export. Hono, auth, databases,
8
- private storage and paid integrations are generated only when selected or required
9
- by a selected capability. Initialization never provisions or activates services.
5
+ ## Default application
10
6
 
11
- ## Defaults and foundations
12
-
13
- | Layer | Minimal default | Added when needed |
14
- | --- | --- | --- |
15
- | Clients | Expo / React Native / Expo Router | WXT side panel, Electron, explicit web alternatives |
16
- | Styling | NativeWind, shared tokens, shadcn conventions | Platform-specific components and effects |
17
- | Workspace | pnpm, Turborepo, shared TypeScript/ESLint, one lockfile | Public contracts when Hono is selected |
18
- | Web hosting | Cloudflare static asset Worker | Service binding to a separate Hono API Worker |
19
- | Backend | None | Hono for server capabilities |
20
- | Data / identity / files | None | Drizzle/D1, Better Auth, private R2 independently |
21
-
22
- The registry has 33 products and five foundation entries: `workspace`, `typescript`,
23
- `eslint`, `ui` and the conditional server-only `cloudflare-api` transport. The first three accompany every project; `ui` accompanies
24
- explicit Next.js/Vinext apps. Expo and WXT resolve shared styling. Shared packages
25
- are generated for selected responsibilities, not empty future architecture.
26
-
27
- ## Progressive selection and full-product preset
28
-
29
- ```sh
30
- anhedral init my-app
31
- anhedral init accounts --better-auth
32
- anhedral init ai-tool --workers-ai
33
- anhedral init complete --preset full-product --dry-run --json
34
- anhedral add better-auth --cwd my-app --dry-run --json
35
- anhedral add stripe revenuecat --cwd my-app --dry-run --json
36
- ```
37
-
38
- Plain init and `--preset minimal` select only Expo. `--d1` adds Hono and D1 without
39
- auth; `--better-auth` adds Hono and D1 unless Neon was selected. Billing adds Hono,
40
- identity (Better Auth unless Clerk was selected) and a database; RevenueCat does
41
- not require Stripe. `--workers-ai`, `--images` or `--r2` adds the server capability
42
- without adding user accounts, billing or unrelated storage. Capabilities resolve
43
- dependencies to a fixed point independently of flag order. The direct registry API
44
- remains strict; it validates already-resolved selections rather than inventing them.
45
-
46
- `--preset full-product` selects Expo, WXT, Hono, D1, Better Auth, R2, KV, Stripe,
47
- RevenueCat, Workers AI, Analytics Engine, Basin/Pipelines, Durable Object rooms,
48
- RealtimeKit, Images, Stream live video, on-demand video, Queues, Cron, Workflows,
49
- Resend and Sentry. It is a compatible complete product foundation, not every
50
- mutually exclusive vendor or a finished implementation. Explicit Next.js/Vinext,
51
- Neon and Clerk replace the corresponding preset defaults. Electron, local-data,
52
- OpenAI/AI SDK, PostHog and Neon Realtime remain separately selectable alternatives
53
- or specialized additions. The preset does not activate paid services or configure
54
- all provider accounts. Inspect `registry capabilities` for support and evidence.
55
-
56
- ## Applications and runtime ownership
57
-
58
- | Selection | Generates |
7
+ | Owner | Responsibility |
59
8
  | --- | --- |
60
- | Default / `--expo` | Expo universal client and Cloudflare static gateway |
61
- | `--next` | Next.js on Vercel, the usual explicit web alternative |
62
- | `--vinext` | Vinext on Cloudflare |
63
- | `--next --hosting=cloudflare` | Explicit OpenNext compatibility profile |
64
- | `--hono` | Standalone Hono API, no implicit frontend |
65
- | `--wxt` | Standalone WXT Chrome side panel; combine with Expo explicitly |
66
- | `--electron` | Standalone Electron client |
67
-
68
- Selecting only service capabilities retains Expo as the default client. Explicit
69
- application selections replace that implicit choice. When server capabilities are
70
- selected, new profiles use Hono for identity, authorization, persistence and
71
- privileged integrations; web routes adapt/proxy calls. Existing web-owned backends
72
- retain their owner, and `add` rejects a required relocation or edited-source
73
- replacement rather than performing an implicit migration.
74
-
75
- Hono creates `packages/contracts` for public Zod schemas and HTTP transport.
76
- Browser clients use `/api/*` through the web gateway; native clients use public
77
- `EXPO_PUBLIC_API_URL`. Next.js on Vercel uses server-only `API_URL`; a private
78
- Cloudflare Access API also requires scoped server-only service credentials.
79
- Clients never import auth/database server packages or another app's source.
80
-
81
- Adding Hono to an existing minimal Expo app wires its gateway and API client without
82
- regenerating product screens. Adding auth exposes `/sign-in` and `/account`; connect
83
- those routes to the product navigation explicitly. Existing edited generated files
84
- remain protected by transaction fingerprints. No addition removes capabilities.
85
-
86
- Root `pnpm dev` runs the exported Expo gateway on 3000; Hono joins on 8787 when
87
- selected. Native Metro uses `pnpm --dir apps/mobile start`. Re-export browser changes
88
- with `pnpm --dir apps/mobile build:web`; this loop is not HMR. Keep SDK 57 pinned
89
- unless upgrading deliberately. Static dynamic routes need `generateStaticParams`
90
- or a supported explicit alternative; static export does not supply SSR.
91
-
92
- New Expo, OpenNext, Queues, Basin, Images and Analytics Engine selections use
93
- Wrangler. Preserve existing engines; incompatible additions to Void need a
94
- reviewed migration. Expo + Better Auth generates browser/native transport and
95
- screens, but device acceptance remains separate. Full-stack CLI capabilities do
96
- not automatically upgrade the portal's legacy publisher.
97
-
98
- ## Select data and identity
99
-
100
- | Selection | Destination and generated scope | Required implementation/setup |
101
- | --------------- | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |
102
- | `--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 |
103
- | `--neon` | `packages/db`; Drizzle/Neon HTTP factory, schema and transactional migration tooling | Select project/role, configure runtime and separate direct migration connections, review SQL |
104
- | `--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 |
105
- | `--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 |
106
- | `--local-data` | `packages/local-data`; async read/write interface | Implement platform-specific SQLite/filesystem adapters, offline behavior and synchronization |
107
-
108
- 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.
109
-
110
- ## Select services
111
-
112
- | Selection | Destination and generated scope | Required implementation/setup |
113
- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
114
- | `--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 |
115
- | `--kv` | Selected server's `CONFIG` binding | Keys, TTLs and propagation handling; never use KV as transactional authority |
116
- | `--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 |
117
- | `--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 |
118
- | `--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 |
119
- | `--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 |
120
- | `--cron` | `apps/scheduled`; scheduled Worker with an hourly starter trigger | Product schedule, task implementation, overlap policy, idempotency and failure visibility |
121
- | `--workflows` | `apps/workflows`; durable workflow and a retryable validation step | Authorized invocation, product steps, retry/resume/cancel behavior and recovery |
122
- | `--workers-ai` | Selected server's `AI` Worker binding | Model calls, authorization, input handling, usage and spending limits |
123
- | `--analytics-engine` | `EVENTS` dataset binding and `packages/analytics-engine/server` helper | Define privacy-safe events; verify ingestion and sampled queries; not a billing ledger |
124
- | `--images` | `IMAGES` binding and private raw-byte transform helper | Activate Images, authorize source objects and enforce transform/cache limits |
125
- | `--realtimekit` | Server-only meeting and participant-token factory | Activate app/presets, implement authorized routes and platform media SDK/UI |
126
- | `--video` | Stream private direct-upload URL helper | Activate Stream, implement processing checks, retention and signed playback |
127
-
128
- `--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.
129
-
130
- ## Select SDKs and integrations
131
-
132
- | Selection | Destination and generated scope | Required implementation/setup |
133
- | -------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
134
- | `--openai` | `packages/ai`; direct server-side OpenAI SDK factory | Models, routes, failure handling and usage limits |
135
- | `--ai-sdk` | `packages/ai`; AI SDK `generateText`/`streamText` exports and OpenAI provider | Streaming, tools, cancellation and provider configuration; generated credentials default to OpenAI |
136
- | `--resend` | `packages/email`; server SDK factory | Verified sending domain, templates, delivery/bounce handling and webhook verification |
137
- | `--stripe` | `packages/billing`; Hono Checkout/portal, verified webhooks, DB projection and entitlement guard | Configure plans/prices/origin/secrets, review/apply SQL, verify sandbox/live purchase lifecycle |
138
- | `--revenuecat` | `packages/billing`; native purchase/restore/manage, verified webhooks and shared entitlement projection | Configure project/app IDs, platform keys/offerings/store products, migrate and verify real development-build purchases |
139
- | `--sentry` | `packages/observability`; integration boundary and redaction fields | Install/init platform SDKs, configure private source-map uploads and verify alerts |
140
- | `--posthog` | `packages/analytics`; server analytics factory | Event schema, consent, privacy filtering and event delivery |
141
- | `--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 |
142
- | `--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 |
143
-
144
- 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.
145
-
146
- 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.
147
-
148
- Optional `--stripe` and `--revenuecat` now generate shared Hono billing, DB schema and validated contracts. Stripe supplies web Checkout/customer portal; RevenueCat supplies native purchase/restore/manage wiring. Each provider projects independently to the signed-in account; Hono unions verified grants and enforces access. Configuration, reviewed SQL migration and provider/store acceptance remain required. Neither provider is selected by plain init.
149
-
150
- Existing billing-guidance/scaffold projects retain their recorded provenance. New billing implementation requires an explicitly reviewed migration; do not silently replace edited source or treat an old SDK factory as the new entitlement contract.
151
-
152
- ## Composition and compatibility
153
-
154
- | Choice | Resolver behavior |
155
- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
156
- | No application flag | Adds Expo universal frontend; explicit Vercel hosting selects Next.js |
157
- | `--next` without a hosting flag | Selects Vercel |
158
- | Vinext with Vercel | Rejected; Vinext requires Cloudflare |
159
- | Vinext and Next.js; D1 and Neon; Better Auth and Clerk; OpenAI and AI SDK | Each pair is mutually exclusive |
160
- | Better Auth without a database | Adds D1; an explicit Neon selection uses PostgreSQL instead |
161
- | Neon Realtime without a database | Adds Neon; an explicit D1 selection is rejected |
162
- | Better Auth with Neon Realtime | Resolves to Neon regardless of flag order |
163
- | RevenueCat without Stripe | Supported independent selection; billing remains optional |
164
- | Expo or WXT | Includes the shared styling package |
165
- | Database/auth or Neon Realtime without a server | Init includes Hono; existing additions require a compatible server |
166
- | Native Next.js/Vercel with Worker-bound capabilities such as D1, R2, KV or Workers AI | Adds Hono on Cloudflare when required |
167
- | New Expo workspaces, OpenNext, Queues, Basin, Images or Analytics Engine | Uses Wrangler for all Cloudflare targets in the workspace |
168
- | Later addition that changes the engine or relocates existing runtime source | Rejected; `add` does not migrate delivery engines or runtime ownership |
169
-
170
- Hono 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.
171
-
172
- ```sh
173
- # Web with D1 and Better Auth (D1 is also the conditional auth default).
174
- anhedral init my-app --better-auth
175
-
176
- # Universal web/iOS/Android and API with PostgreSQL.
177
- anhedral init my-app --expo --neon
178
-
179
- # Vercel web with an automatically selected Hono backend for R2.
180
- anhedral init my-app --next --r2
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 |
181
16
 
182
- # Independent room messaging and live PostgreSQL queries.
183
- anhedral init my-app --realtime --neon-realtime
184
- ```
185
-
186
- The bundled registry is authoritative for exact dependencies, destinations and compatibility:
187
-
188
- ```sh
189
- anhedral registry list --json
190
- anhedral registry view better-auth --json
191
- anhedral init my-app --vinext --hono --d1 --better-auth --r2 --dry-run --json
192
- ```
193
-
194
- 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.
195
-
196
- ## Organize the source
197
-
198
- | Location | Owns |
199
- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
200
- | `apps/mobile`, `apps/api`, explicit `apps/web`, other selected `apps/*` | Deployable applications and services, runtime entry points and configuration |
201
- | `packages/ui` | Shared web UI components |
202
- | `packages/db` | Server-only database factory, schemas and migrations |
203
- | `packages/auth`, other selected `packages/*` | Reusable integration code with explicit inputs |
204
- | `packages/typescript-config`, `packages/eslint-config` | Shared tooling conventions |
205
- | `anhedral.json` | Committed Anhedral configuration and provenance |
206
- | `docs/stack.md` | Generated selection, destinations and setup requirements |
207
- | `.anhedral/` | Ignored local delivery journals and private state |
208
-
209
- 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.
210
-
211
- Validate browser/API routing through the Cloudflare gateway and Hono separately from iOS/Android exports. Static/native exports establish compilation, not device, auth or store acceptance.
212
-
213
- 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.
214
-
215
- ### One Anhedral configuration
216
-
217
- 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.
218
-
219
- | Section | Purpose |
220
- | ------------ | --------------------------------------------------------------------- |
221
- | `identity` | Stable application identity and local catalog registration |
222
- | `setup` | Products, hosting, environment requirements and owner setup |
223
- | `standard` | Scaffold conventions and version provenance |
224
- | `registry` | Recipe versions, generated-file fingerprints and workspace references |
225
- | `providers` | Nonsecret integration settings and resource selections |
226
- | `cloudflare` | Delivery engine, account, audience and targets |
227
- | `vercel` | Repository, team, project and audience |
228
-
229
- 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.
230
-
231
- ## Data and migrations
232
-
233
- All database-backed selections use the server-only `@workspace/db` package:
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.
234
18
 
235
- | Path | Responsibility |
236
- | ------------------------------- | ----------------------------------------------------- |
237
- | `packages/db/src/index.ts` | Factory receiving a D1 binding or connection string |
238
- | `packages/db/src/schema.ts` | Shared Drizzle schema, including selected auth tables |
239
- | `packages/db/src/migrate.ts` | Explicit migration entry point |
240
- | `packages/db/drizzle/` | SQL, snapshots and migration journal |
241
- | `packages/db/drizzle.config.ts` | Configuration with paths relative to itself |
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.
242
20
 
243
- 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.
21
+ ## Private files
244
22
 
245
- 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.
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.
246
24
 
247
- 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.
25
+ ## Identity
248
26
 
249
- ## Live video with Cloudflare Stream
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.
250
28
 
251
- 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 use the separately selected `--realtimekit` server helpers and platform client implementation.
29
+ ## Only two optional additions
252
30
 
253
- 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.
254
-
255
- 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.
256
-
257
- 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.
258
-
259
- 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 |
260
35
 
261
36
  ```sh
262
- anhedral init my-app --stream
263
- 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
264
42
  ```
265
43
 
266
- ## Neon Realtime
267
-
268
- `--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.
269
-
270
- 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.
271
-
272
- 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.
273
-
274
- 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.
275
-
276
- ## Runtime and delivery configuration
277
-
278
- | Profile | Engine and configuration | Project runtime floor |
279
- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
280
- | 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+` |
281
- | Explicit OpenNext, Queues/DLQ or Basin | Wrangler; app-local `wrangler.jsonc` | Node.js `22.13+` on 22.x, or `24+` |
282
- | Native Next.js/Vercel and other non-Void profiles | Native framework/platform tools | Node.js `22.13+` on 22.x, or `24+` |
283
-
284
- 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.
285
-
286
- Existing projects keep their recorded backend ownership during readiness checks and additions. A pre-contracts Hono project needs an explicit contracts/proxy migration before adding web/auth UI wiring; unrelated additions preserve its API source. 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.
287
-
288
- 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.
289
-
290
- ### Delivery scope by target
291
-
292
- | Target | Supported automation | Remaining delivery work |
293
- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
294
- | 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 |
295
- | 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 |
296
- | Mixed Cloudflare/Vercel | Cloudflare first, then Vercel, with per-target receipts | Handle partial success; there is no atomic cross-provider release or rollback |
297
- | 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 |
298
- | Electron | Local build and packaging scripts | Platform signing, notarization, installers, updates and distribution |
299
- | WXT | Local extension build and ZIP tooling | Installed-browser acceptance, store review and publication |
300
-
301
- 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.
302
-
303
- 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.
304
45
 
305
- ## Source ownership and dependency policy
46
+ ## Runtime boundaries
306
47
 
307
- 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.
308
49
 
309
- 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.
310
51
 
311
- 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
312
53
 
313
- 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.
314
55
 
315
- ## Product requirements
56
+ ## Managed authentication email
316
57
 
317
- 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.
318
64
 
319
- 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.