anhedral 0.1.5 → 0.1.6

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 (3) hide show
  1. package/README.md +12 -0
  2. package/dist/scaffold.js +144 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -77,6 +77,18 @@ pnpm verify:backend
77
77
  pnpm verify:extension
78
78
  ```
79
79
 
80
+ ## Generated Provider Setup
81
+
82
+ New projects ship with placeholder env values so the repository can be inspected before accounts are provisioned. A production UI requires real keys from each provider. The generated `README.md` and `PRODUCTION.md` now include setup links and exact env placement for:
83
+
84
+ - Neon database: `DATABASE_URL`
85
+ - Clerk auth: `EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY`, `CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`, `VITE_CLERK_PUBLISHABLE_KEY`
86
+ - RevenueCat + Stripe: `EXPO_PUBLIC_RC_*`, `RC_SECRET_API_KEY`, `RC_WEBHOOK_SECRET`
87
+ - Cloudflare R2/CDN: `R2_ACCOUNT_ID`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET`
88
+ - Vercel: two projects from the same Git repo, rooted at `Frontend` and `Backend`
89
+ - EAS: native iOS and Android builds from `Frontend`
90
+ - Chrome Web Store: WXT ZIP upload from `Extension/.output`
91
+
80
92
  ## Native App Deployment
81
93
 
82
94
  Use `Frontend` as the Expo project root for iOS and Android. Vercel only deploys the web export from this app; native builds go through EAS.
package/dist/scaffold.js CHANGED
@@ -157,16 +157,61 @@ pnpm dev:frontend
157
157
  pnpm dev:extension
158
158
  \`\`\`
159
159
 
160
- For a provider-free smoke test, keep \`ANHEDRAL_DEMO=true\` in \`Backend/.env\`. Demo mode returns a signed-in sample user and active subscription responses without Clerk, RevenueCat, or Stripe credentials. It is for local development only.
160
+ The generated env files intentionally contain placeholder provider values. That is enough to inspect the project structure and run backend smoke tests, but the full UI needs real provider keys before auth, billing, uploads, and extension sign-in behave like production.
161
+
162
+ For a provider-free backend smoke test, keep \`ANHEDRAL_DEMO=true\` in \`Backend/.env\`. Demo mode returns a signed-in sample user and active subscription responses without Clerk, RevenueCat, or Stripe credentials. It is for local development only.
161
163
 
162
164
  ## Provider Setup
163
165
 
164
- - Neon: create a Postgres database and set \`DATABASE_URL\` in the root and API env files.
165
- - Clerk: create an application, configure allowed origins, and set \`CLERK_PUBLISHABLE_KEY\`, \`CLERK_SECRET_KEY\`, plus the Expo and extension publishable keys.
166
- - RevenueCat + Stripe: create an entitlement named \`pro\`, configure Stripe as a RevenueCat web billing source, configure app keys, then set \`RC_SECRET_API_KEY\`, \`RC_WEBHOOK_SECRET\`, and the \`EXPO_PUBLIC_RC_*\` values.
167
- - Cloudflare R2: create a bucket and API token, then set \`R2_ACCOUNT_ID\`, \`R2_ACCESS_KEY_ID\`, \`R2_SECRET_ACCESS_KEY\`, and \`R2_BUCKET\`.
168
- - Vercel: import this same Git repository twice. Use \`Frontend\` as the root directory for the Expo web project, and \`Backend\` as the root directory for the Fastify API project. Enable access to source files outside each root directory so workspace packages under \`packages/*\` are available during builds. The Backend project uses Vercel Fastify entrypoint detection from \`Backend/src/index.ts\`.
169
- - EAS: use \`Frontend\` as the Expo project root for iOS and Android builds. Vercel deploys the web export from the same source.
166
+ Use this order so each service has the domains and callback URLs it needs:
167
+
168
+ 1. Neon database
169
+ - Create a Neon project and database: https://neon.com/docs/get-started-with-neon/connect-neon
170
+ - Put the pooled connection string in \`DATABASE_URL\` in \`.env\`, \`Backend/.env\`, and the Backend Vercel project.
171
+ - Run \`pnpm db:generate\` and \`pnpm db:migrate\` after \`DATABASE_URL\` is real.
172
+
173
+ 2. Clerk auth
174
+ - Expo setup: https://docs.expo.dev/guides/using-clerk/
175
+ - Clerk Expo quickstart: https://clerk.com/docs/quickstarts/get-started-with-expo
176
+ - Set \`EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY\` in \`Frontend/.env\`, Vercel Frontend, and EAS.
177
+ - Set \`CLERK_PUBLISHABLE_KEY\` and \`CLERK_SECRET_KEY\` in \`Backend/.env\` and Vercel Backend.
178
+ - Set \`VITE_CLERK_PUBLISHABLE_KEY\` in \`Extension/.env\`.
179
+ - Add allowed origins for \`http://localhost:8081\`, the Frontend Vercel domain, and the extension origin after Chrome assigns an extension id.
180
+
181
+ 3. RevenueCat + Stripe
182
+ - RevenueCat Web overview: https://www.revenuecat.com/docs/web/overview
183
+ - RevenueCat Stripe Billing integration: https://www.revenuecat.com/docs/web/integrations/stripe
184
+ - Stripe API keys: https://docs.stripe.com/keys
185
+ - Create an entitlement named \`pro\`.
186
+ - Create iOS, Android, and Web apps in RevenueCat and copy their public SDK keys into \`EXPO_PUBLIC_RC_API_KEY_IOS\`, \`EXPO_PUBLIC_RC_API_KEY_ANDROID\`, and \`EXPO_PUBLIC_RC_WEB_API_KEY\`.
187
+ - Set \`EXPO_PUBLIC_RC_ENTITLEMENT_ID=pro\`.
188
+ - Set \`RC_SECRET_API_KEY\` and \`RC_WEBHOOK_SECRET\` only in Backend envs.
189
+ - Point the RevenueCat webhook to \`https://<backend-domain>/webhooks/revenuecat\`.
190
+
191
+ 4. Cloudflare R2/CDN
192
+ - R2 S3-compatible setup: https://developers.cloudflare.com/r2/get-started/s3/
193
+ - R2 API tokens: https://developers.cloudflare.com/r2/api/tokens/
194
+ - Create a bucket and least-privilege API token.
195
+ - Set \`R2_ACCOUNT_ID\`, \`R2_ACCESS_KEY_ID\`, \`R2_SECRET_ACCESS_KEY\`, and \`R2_BUCKET\` only in Backend envs.
196
+ - If you use a public CDN/custom domain for uploaded files, add that URL to your own app config before exposing uploads broadly.
197
+
198
+ 5. Vercel web/API deploys
199
+ - Monorepo docs: https://vercel.com/docs/monorepos
200
+ - Monorepo FAQ for source outside root: https://vercel.com/docs/monorepos/monorepo-faq
201
+ - Import this same Git repository twice. Use \`Frontend\` as the root directory for the Expo web project and \`Backend\` as the root directory for the Fastify API project.
202
+ - Enable access to source files outside each project root so workspace packages under \`packages/*\` are available during builds.
203
+ - Frontend build command: \`pnpm build:web\`; output directory: \`dist\`.
204
+ - Backend build command: \`pnpm build\`; Vercel detects \`Backend/src/index.ts\` as the Fastify entrypoint.
205
+
206
+ 6. EAS native app builds
207
+ - EAS docs: https://docs.expo.dev/eas/
208
+ - Store submission docs: https://docs.expo.dev/deploy/submit-to-app-stores/
209
+ - Use \`Frontend\` as the Expo project root for iOS and Android builds. Vercel deploys the web export from the same source.
210
+
211
+ 7. Chrome Web Store
212
+ - WXT publishing: https://wxt.dev/guide/essentials/publishing.html
213
+ - Chrome publishing: https://developer.chrome.com/docs/webstore/publish
214
+ - Build with \`pnpm extension:zip\`, then upload \`Extension/.output/*-chrome.zip\` in the Chrome Web Store Developer Dashboard.
170
215
 
171
216
  ## Setup Notes
172
217
 
@@ -296,6 +341,8 @@ pnpm db:migrate
296
341
 
297
342
  Local demo mode is enabled through generated \`.env\` files. Real provider behavior needs Clerk, RevenueCat/Stripe, Neon, and R2 credentials.
298
343
 
344
+ The generated placeholder values are intentionally non-production. They let you inspect files and run backend demo checks, but browser auth, paid subscriptions, uploads, and extension sign-in require the setup below.
345
+
299
346
  ## Environment Variables
300
347
 
301
348
  - Root/local: \`DATABASE_URL\` for shared Drizzle commands.
@@ -304,6 +351,76 @@ Local demo mode is enabled through generated \`.env\` files. Real provider behav
304
351
  - Extension: \`VITE_API_URL\`, \`VITE_CLERK_PUBLISHABLE_KEY\`, and optionally \`VITE_CRX_PUBLIC_KEY\`.
305
352
  - EAS: add native app public keys with \`eas secret:create\` or the EAS dashboard.
306
353
 
354
+ ## Provider Setup
355
+
356
+ ### Neon + Drizzle
357
+
358
+ Docs:
359
+
360
+ - https://neon.com/docs/get-started-with-neon/connect-neon
361
+ - https://orm.drizzle.team/docs/tutorials/drizzle-with-neon
362
+
363
+ Steps:
364
+
365
+ 1. Create a Neon project and Postgres database.
366
+ 2. Copy the pooled connection string.
367
+ 3. Set \`DATABASE_URL\` in the root \`.env\`, \`Backend/.env\`, and the Backend Vercel project.
368
+ 4. Run:
369
+
370
+ \`\`\`sh
371
+ pnpm db:generate
372
+ pnpm db:migrate
373
+ \`\`\`
374
+
375
+ ### Clerk
376
+
377
+ Docs:
378
+
379
+ - https://docs.expo.dev/guides/using-clerk/
380
+ - https://clerk.com/docs/quickstarts/get-started-with-expo
381
+
382
+ Steps:
383
+
384
+ 1. Create a Clerk application.
385
+ 2. Set \`EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY\` in \`Frontend/.env\`, the Frontend Vercel project, and EAS.
386
+ 3. Set \`CLERK_PUBLISHABLE_KEY\` and \`CLERK_SECRET_KEY\` in \`Backend/.env\` and the Backend Vercel project.
387
+ 4. Set \`VITE_CLERK_PUBLISHABLE_KEY\` in \`Extension/.env\`.
388
+ 5. Add allowed origins for local Expo web, the deployed Frontend Vercel domain, and the Chrome extension origin after the extension id is stable.
389
+ 6. Configure native redirect/deep-link settings for the Expo scheme in \`Frontend/app.json\`.
390
+
391
+ ### RevenueCat + Stripe
392
+
393
+ Docs:
394
+
395
+ - https://www.revenuecat.com/docs/web/overview
396
+ - https://www.revenuecat.com/docs/web/integrations/stripe
397
+ - https://docs.stripe.com/keys
398
+
399
+ Steps:
400
+
401
+ 1. Create the RevenueCat project.
402
+ 2. Create an entitlement named \`pro\`.
403
+ 3. Create iOS, Android, and Web apps in RevenueCat.
404
+ 4. Copy the public SDK keys into \`EXPO_PUBLIC_RC_API_KEY_IOS\`, \`EXPO_PUBLIC_RC_API_KEY_ANDROID\`, and \`EXPO_PUBLIC_RC_WEB_API_KEY\`.
405
+ 5. Set \`EXPO_PUBLIC_RC_ENTITLEMENT_ID=pro\`.
406
+ 6. Connect Stripe as the RevenueCat web billing source.
407
+ 7. Set \`RC_SECRET_API_KEY\` and \`RC_WEBHOOK_SECRET\` only in Backend envs.
408
+ 8. Configure the RevenueCat webhook URL as \`https://<backend-domain>/webhooks/revenuecat\`.
409
+
410
+ ### Cloudflare R2/CDN
411
+
412
+ Docs:
413
+
414
+ - https://developers.cloudflare.com/r2/get-started/s3/
415
+ - https://developers.cloudflare.com/r2/api/tokens/
416
+
417
+ Steps:
418
+
419
+ 1. Create an R2 bucket.
420
+ 2. Create a least-privilege API token for that bucket.
421
+ 3. Set \`R2_ACCOUNT_ID\`, \`R2_ACCESS_KEY_ID\`, \`R2_SECRET_ACCESS_KEY\`, and \`R2_BUCKET\` only in Backend envs.
422
+ 4. Configure a public bucket URL or custom domain if uploaded assets need public CDN delivery.
423
+
307
424
  ## Deploy
308
425
 
309
426
  Vercel deployment is two Vercel projects from the same Git repo:
@@ -338,18 +455,33 @@ pnpm extension:zip
338
455
 
339
456
  Upload \`Extension/.output/*-chrome.zip\` to the Chrome Web Store Developer Dashboard.
340
457
 
341
- ## Provider Checklist
458
+ ## Production Checklist
342
459
 
343
- - Clerk: configure allowed origins for the Expo web Vercel domain, native redirect/deep-link settings for the Expo scheme in \`Frontend/app.json\`, and the Chrome extension origin after publishing or after assigning a stable extension key.
344
- - RevenueCat + Stripe: create a \`pro\` entitlement, configure iOS/Android/Web app API keys separately, connect Stripe as the web billing source, set the RevenueCat webhook URL to \`https://<backend-domain>/webhooks/revenuecat\`, and keep \`RC_WEBHOOK_SECRET\` only in Backend.
345
- - Neon + Drizzle: create the Neon database, set \`DATABASE_URL\` locally and in the Backend Vercel project, then run \`pnpm db:generate\` and \`pnpm db:migrate\` before production traffic.
346
- - Cloudflare R2: create an R2 bucket and least-privilege API token, then set \`R2_ACCOUNT_ID\`, \`R2_ACCESS_KEY_ID\`, \`R2_SECRET_ACCESS_KEY\`, and \`R2_BUCKET\` in Backend only.
460
+ - Replace every \`*_placeholder\` value before production deploy.
461
+ - Keep server secrets out of Frontend, Extension, and EAS public envs.
462
+ - Confirm Clerk works on local web, Vercel web, iOS, Android, and the Chrome extension.
463
+ - Confirm RevenueCat returns the \`pro\` entitlement after Stripe web purchase and native store purchase.
464
+ - Confirm \`pnpm db:migrate\` has run against the production Neon database.
465
+ - Confirm R2 upload and signed avatar URL retrieval work from the deployed Backend domain.
466
+ - Confirm both Vercel projects can resolve \`packages/*\` workspace packages.
467
+ - Confirm the Chrome extension ZIP is tested locally with \`chrome://extensions\` before Chrome Web Store upload.
347
468
 
348
469
  ## Relevant Docs
349
470
 
350
471
  - [Vercel monorepos](https://vercel.com/docs/monorepos)
472
+ - [Vercel monorepo FAQ](https://vercel.com/docs/monorepos/monorepo-faq)
351
473
  - [Expo web publishing](https://docs.expo.dev/guides/publishing-websites/)
352
474
  - [Expo EAS](https://docs.expo.dev/eas/)
475
+ - [Expo store submissions](https://docs.expo.dev/deploy/submit-to-app-stores/)
476
+ - [Clerk with Expo](https://docs.expo.dev/guides/using-clerk/)
477
+ - [Clerk Expo quickstart](https://clerk.com/docs/quickstarts/get-started-with-expo)
478
+ - [Neon connection strings](https://neon.com/docs/get-started-with-neon/connect-neon)
479
+ - [Drizzle with Neon](https://orm.drizzle.team/docs/tutorials/drizzle-with-neon)
480
+ - [RevenueCat Web](https://www.revenuecat.com/docs/web/overview)
481
+ - [RevenueCat Stripe Billing](https://www.revenuecat.com/docs/web/integrations/stripe)
482
+ - [Stripe API keys](https://docs.stripe.com/keys)
483
+ - [Cloudflare R2 S3 API](https://developers.cloudflare.com/r2/get-started/s3/)
484
+ - [Cloudflare R2 API tokens](https://developers.cloudflare.com/r2/api/tokens/)
353
485
  - [WXT publishing](https://wxt.dev/guide/essentials/publishing.html)
354
486
  - [Chrome Web Store publishing](https://developer.chrome.com/docs/webstore/publish)
355
487
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anhedral",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Opinionated init CLI for Expo, Fastify, WXT, shared packages, Neon, Drizzle, Clerk, RevenueCat, Stripe, R2, and Vercel.",
5
5
  "type": "module",
6
6
  "bin": {