@donotdev/cli 0.0.16 → 0.0.18

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 (87) hide show
  1. package/dependencies-matrix.json +38 -26
  2. package/dist/bin/commands/bump.js +9 -2
  3. package/dist/bin/commands/create-app.js +185 -81
  4. package/dist/bin/commands/create-project.js +186 -85
  5. package/dist/bin/commands/deploy.js +51 -20
  6. package/dist/bin/commands/doctor.js +249 -56
  7. package/dist/bin/commands/emu.js +18 -20
  8. package/dist/bin/commands/make-admin.js +30 -10
  9. package/dist/bin/commands/setup.js +512 -122
  10. package/dist/bin/commands/type-check.d.ts.map +1 -1
  11. package/dist/bin/commands/type-check.js +7 -3
  12. package/dist/bin/commands/type-check.js.map +1 -1
  13. package/dist/bin/dndev.js +9 -6
  14. package/dist/bin/donotdev.js +35 -20
  15. package/dist/index.js +262 -129
  16. package/package.json +1 -1
  17. package/templates/root-consumer/.claude/commands/brainstorm.md.example +15 -1
  18. package/templates/root-consumer/.claude/commands/build.md.example +24 -2
  19. package/templates/root-consumer/.claude/commands/design.md.example +17 -0
  20. package/templates/root-consumer/.claude/commands/polish.md.example +17 -0
  21. package/templates/root-consumer/AI.md.example +50 -18
  22. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +6 -6
  23. package/templates/root-consumer/guides/dndev/INDEX.md.example +2 -2
  24. package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +13 -6
  25. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +149 -1086
  26. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +68 -16
  27. package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +6 -111
  28. package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +64 -0
  29. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +123 -32
  30. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +108 -91
  31. package/templates/root-consumer/guides/dndev/advanced/EMULATORS.md.example +2 -2
  32. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +1 -1
  33. package/dist/bin/commands/firebase-setup.d.ts +0 -6
  34. package/dist/bin/commands/firebase-setup.d.ts.map +0 -1
  35. package/dist/bin/commands/firebase-setup.js +0 -7
  36. package/dist/bin/commands/firebase-setup.js.map +0 -1
  37. package/dist/bin/commands/supabase-setup.d.ts +0 -6
  38. package/dist/bin/commands/supabase-setup.d.ts.map +0 -1
  39. package/dist/bin/commands/supabase-setup.js +0 -7
  40. package/dist/bin/commands/supabase-setup.js.map +0 -1
  41. package/templates/functions-firebase/functions-firebase/README.md.example +0 -123
  42. package/templates/functions-firebase/functions-firebase/build.mjs.example +0 -5
  43. package/templates/functions-firebase/functions-firebase/src/auth/getCustomClaims.ts.example +0 -19
  44. package/templates/functions-firebase/functions-firebase/src/auth/getUserAuthStatus.ts.example +0 -21
  45. package/templates/functions-firebase/functions-firebase/src/auth/index.ts.example +0 -11
  46. package/templates/functions-firebase/functions-firebase/src/auth/removeCustomClaims.ts.example +0 -21
  47. package/templates/functions-firebase/functions-firebase/src/auth/setCustomClaims.ts.example +0 -21
  48. package/templates/functions-firebase/functions-firebase/src/billing/handleStripeWebhook.ts.example +0 -24
  49. package/templates/functions-firebase/functions-firebase/src/billing/index.ts.example +0 -10
  50. package/templates/functions-firebase/functions-firebase/src/billing/processPaymentSuccess.ts.example +0 -14
  51. package/templates/functions-firebase/functions-firebase/src/billing/refreshSubscriptionStatus.ts.example +0 -14
  52. package/templates/functions-firebase/functions-firebase/src/index.ts.example +0 -39
  53. package/templates/functions-firebase/functions-firebase/src/oauth/checkGitHubAccess.ts.example +0 -14
  54. package/templates/functions-firebase/functions-firebase/src/oauth/disconnect.ts.example +0 -14
  55. package/templates/functions-firebase/functions-firebase/src/oauth/exchangeToken.ts.example +0 -14
  56. package/templates/functions-firebase/functions-firebase/src/oauth/getConnections.ts.example +0 -14
  57. package/templates/functions-firebase/functions-firebase/src/oauth/grantGitHubAccess.ts.example +0 -14
  58. package/templates/functions-firebase/functions-firebase/src/oauth/index.ts.example +0 -17
  59. package/templates/functions-firebase/functions-firebase/src/oauth/refreshToken.ts.example +0 -14
  60. package/templates/functions-firebase/functions-firebase/src/oauth/revokeGitHubAccess.ts.example +0 -14
  61. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +0 -21
  62. package/templates/functions-vercel/functions-vercel/README.md.example +0 -116
  63. package/templates/functions-vercel/functions-vercel/build.mjs.example +0 -52
  64. package/templates/functions-vercel/functions-vercel/src/api/auth/getCustomClaims.ts.example +0 -20
  65. package/templates/functions-vercel/functions-vercel/src/api/auth/getUserAuthStatus.ts.example +0 -20
  66. package/templates/functions-vercel/functions-vercel/src/api/auth/removeCustomClaims.ts.example +0 -20
  67. package/templates/functions-vercel/functions-vercel/src/api/auth/setCustomClaims.ts.example +0 -20
  68. package/templates/functions-vercel/functions-vercel/src/api/billing/handleStripeWebhook.ts.example +0 -20
  69. package/templates/functions-vercel/functions-vercel/src/api/billing/processPaymentSuccess.ts.example +0 -20
  70. package/templates/functions-vercel/functions-vercel/src/api/billing/refreshSubscriptionStatus.ts.example +0 -20
  71. package/templates/functions-vercel/functions-vercel/src/api/crud/createEntity.ts.example +0 -20
  72. package/templates/functions-vercel/functions-vercel/src/api/crud/deleteEntity.ts.example +0 -20
  73. package/templates/functions-vercel/functions-vercel/src/api/crud/getEntity.ts.example +0 -20
  74. package/templates/functions-vercel/functions-vercel/src/api/crud/listEntities.ts.example +0 -20
  75. package/templates/functions-vercel/functions-vercel/src/api/crud/updateEntity.ts.example +0 -20
  76. package/templates/functions-vercel/functions-vercel/src/api/oauth/checkGitHubAccess.ts.example +0 -20
  77. package/templates/functions-vercel/functions-vercel/src/api/oauth/disconnect.ts.example +0 -20
  78. package/templates/functions-vercel/functions-vercel/src/api/oauth/exchangeToken.ts.example +0 -20
  79. package/templates/functions-vercel/functions-vercel/src/api/oauth/getConnections.ts.example +0 -20
  80. package/templates/functions-vercel/functions-vercel/src/api/oauth/grantGitHubAccess.ts.example +0 -20
  81. package/templates/functions-vercel/functions-vercel/src/api/oauth/refreshToken.ts.example +0 -20
  82. package/templates/functions-vercel/functions-vercel/src/api/oauth/revokeGitHubAccess.ts.example +0 -20
  83. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +0 -21
  84. package/templates/functions-vercel/functions-vercel/vercel.json.example +0 -14
  85. package/templates/github/github/workflows/firebase-deploy.yml.example +0 -79
  86. /package/templates/functions-firebase/{functions-firebase/.env.example.example → .env.example} +0 -0
  87. /package/templates/functions-vercel/{functions-vercel/.env.example.example → .env.example} +0 -0
@@ -1,51 +1,39 @@
1
- # Setup: Vercel
1
+ # Setup: Vercel (Hosting & Functions)
2
2
 
3
- **From zero to deployed: Vercel hosting + API routes with Firebase data layer.**
3
+ **Deploy your frontend (and optionally serverless functions) to Vercel. Works with any backend (Firebase, Supabase, or both).**
4
4
 
5
5
  ---
6
6
 
7
7
  ## Architecture
8
8
 
9
- Vercel is your **hosting and API platform** it serves your frontend and runs serverless API routes.
10
- Firebase is your **data layer** — Firestore (CRUD), Firebase Auth (users), Firebase Storage (files).
9
+ Vercel serves your built Vite or Next.js app on a global CDN. It can also run **Vercel Functions** (serverless API routes).
11
10
 
12
- The framework generates API routes as Vercel Serverless Functions that talk to Firebase on the backend.
11
+ **Vercel as hosting only** (backend elsewhere):
12
+ - **Firebase** → Cloud Functions + Firestore + Auth + Storage
13
+ - **Supabase** → Edge Functions + PostgreSQL + Auth + Storage
13
14
 
14
- ---
15
-
16
- ## Step 1: Create Firebase Project (Data Layer)
17
-
18
- Even though you deploy to Vercel, you still need Firebase for data.
19
-
20
- 1. Go to [Firebase Console](https://console.firebase.google.com) → Create a project
21
- 2. Enable **Authentication** → Email/Password (+ OAuth providers if needed)
22
- 3. Enable **Cloud Firestore** → Create Database → select region
23
- 4. Enable **Storage** if your app uploads files
15
+ **Vercel as hosting + functions** (alongside a backend):
16
+ - Vercel Functions handle API routes (`/api/*`)
17
+ - Combine with Firebase/Supabase for auth + database
24
18
 
25
- Get the Firebase web config from: **Project Settings General → Your apps → Web app → SDK config**.
19
+ The framework scaffolds `vercel.json` with CSP headers, rewrites, and caching rules.
26
20
 
27
21
  ---
28
22
 
29
- ## Step 2: Run Setup
30
-
31
- ```bash
32
- dndev setup firebase
33
- ```
23
+ ## Step 1: Create Vercel Project
34
24
 
35
- This writes Firebase SDK config to your app's `.env`. The `overlay-vercel` providers.ts initializes the Firebase client SDK.
25
+ 1. Create a [Vercel](https://vercel.com) account
26
+ 2. Import your Git repo from the Vercel Dashboard
27
+ 3. Set the **Root Directory** to `apps/<your-app>` (or leave blank if monorepo auto-detected)
28
+ 4. Set **Framework Preset** to Vite (or Next.js if using Next)
36
29
 
37
30
  ---
38
31
 
39
- ## Step 3: Configure Vercel
32
+ ## Step 2: Set Environment Variables
40
33
 
41
- 1. Create a [Vercel](https://vercel.com) account and link your Git repo
42
- 2. Import the project in Vercel Dashboard
43
- 3. Set the **Root Directory** to `apps/<your-app>` (or leave blank if monorepo auto-detected)
44
- 4. Set **Framework Preset** to Vite (or Next.js if using Next)
34
+ In Vercel Dashboard Settings Environment Variables, copy the env vars from your `apps/<app>/.env`:
45
35
 
46
- **Environment Variables** (in Vercel Dashboard → Settings → Environment Variables):
47
-
48
- Copy your Firebase vars from `.env`:
36
+ **If using Firebase:**
49
37
  - `VITE_FIREBASE_API_KEY`
50
38
  - `VITE_FIREBASE_PROJECT_ID`
51
39
  - `VITE_FIREBASE_AUTH_DOMAIN`
@@ -53,81 +41,122 @@ Copy your Firebase vars from `.env`:
53
41
  - `VITE_FIREBASE_MESSAGING_SENDER_ID`
54
42
  - `VITE_FIREBASE_APP_ID`
55
43
 
56
- For Next.js apps, use `NEXT_PUBLIC_` prefix instead of `VITE_`.
44
+ **If using Supabase:**
45
+ - `VITE_SUPABASE_URL`
46
+ - `VITE_SUPABASE_PUBLIC_KEY`
47
+
48
+ **Common (all backends):**
49
+ - `VITE_DONOTDEV_LICENSE_KEY`
50
+ - `VITE_STRIPE_PUBLISHABLE_KEY` (if using billing)
51
+
52
+ **Server-side (Vercel Functions only):**
53
+ - `STRIPE_SECRET_KEY` (if using billing)
54
+ - `SUPABASE_SERVICE_ROLE_KEY` (if using Supabase)
57
55
 
58
- **Server secrets** (for API routes):
59
- - `STRIPE_SECRET_KEY`
60
- - `STRIPE_WEBHOOK_SECRET`
61
- - Any OAuth client secrets
56
+ For Next.js apps, replace the `VITE_` prefix with `NEXT_PUBLIC_` (same var names, different prefix).
62
57
 
63
58
  ---
64
59
 
65
- ## Step 4: API Routes (Functions)
60
+ ## Step 3: Deploy
66
61
 
67
- Your backend functions are in `functions/` and deploy as Vercel Serverless Functions.
62
+ **Option A Git push (recommended)**
63
+
64
+ Push to your connected branch. Vercel auto-deploys.
68
65
 
66
+ ```bash
67
+ git push origin main
69
68
  ```
70
- functions/
71
- ├── src/
72
- │ ├── auth/ # Auth endpoints (signup, login, etc.)
73
- │ ├── billing/ # Stripe endpoints (checkout, webhook, etc.)
74
- │ ├── crud/ # CRUD endpoints (create, read, update, delete)
75
- │ └── oauth/ # OAuth callback handlers
76
- ├── vercel.json # Route configuration
77
- ├── tsconfig.json
78
- └── package.json
69
+
70
+ **Option B — CLI**
71
+
72
+ ```bash
73
+ dndev deploy
79
74
  ```
80
75
 
81
- Functions use the Firebase Admin SDK on the server side to access Firestore, verify auth tokens, etc.
76
+ Or directly:
77
+
78
+ ```bash
79
+ bunx vercel --prod
80
+ ```
82
81
 
83
82
  ---
84
83
 
85
- ## Step 5: Deploy
84
+ ## Vercel Functions (Optional)
86
85
 
87
- **Option A Git push (recommended)**
86
+ The framework provides helpers for Vercel Functions via `@donotdev/functions/vercel`. Place your API routes in `pages/api/` (Next.js) or `api/` (Vite).
88
87
 
89
- Push to your connected branch. Vercel auto-deploys.
88
+ ### Custom Functions
90
89
 
91
- ```bash
92
- git push origin main
90
+ ```typescript
91
+ // pages/api/product-details.ts
92
+ import * as v from 'valibot';
93
+ import { createVercelBaseFunction } from '@donotdev/functions/vercel';
94
+
95
+ const schema = v.object({ productId: v.string() });
96
+
97
+ export default createVercelBaseFunction(
98
+ 'POST',
99
+ schema,
100
+ 'get_product_details',
101
+ async (req, res, data, { uid }) => {
102
+ // data is validated, uid is the authenticated user
103
+ const product = await getProduct(data.productId);
104
+ return res.status(200).json(product);
105
+ }
106
+ );
93
107
  ```
94
108
 
95
- **Option BVercel CLI**
109
+ Auth, rate limiting, schema validation, and metrics all included by default.
96
110
 
97
- ```bash
98
- npx vercel --prod
111
+ ### Pre-built Endpoints
112
+
113
+ The framework ships ready-made API handlers:
114
+
115
+ ```typescript
116
+ // pages/api/auth/claims.ts
117
+ import { setCustomClaims } from '@donotdev/functions/vercel';
118
+ export default setCustomClaims;
119
+
120
+ // pages/api/billing/checkout.ts
121
+ import { createCheckoutSession } from '@donotdev/functions/vercel';
122
+ import { billingConfig } from '../../../config/billing';
123
+ export default createCheckoutSession(billingConfig);
99
124
  ```
100
125
 
126
+ Available: auth (claims, status, delete account), billing (checkout, cancel, portal, change plan), OAuth (token exchange, access grants).
127
+
128
+ ### When to use Vercel Functions vs Firebase/Supabase functions
129
+
130
+ - **Vercel Functions:** API routes, webhooks, third-party proxies — especially in Next.js apps
131
+ - **Firebase Cloud Functions:** Firestore triggers, heavy backend logic tied to Firebase
132
+ - **Supabase Edge Functions:** Database triggers, logic tied to Supabase
133
+
134
+ **Server secrets** for Vercel Functions go in Vercel Dashboard → Environment Variables (not `VITE_*` or `NEXT_PUBLIC_*` prefixed — those are exposed to the browser).
135
+
101
136
  ---
102
137
 
103
138
  ## Environment Variables
104
139
 
105
140
  | File | What Goes Here | Loaded By |
106
141
  |------|---------------|-----------|
107
- | `apps/<app>/.env` | Firebase config, license key, Stripe publishable key | Vite/Next.js (dev + build) |
142
+ | `apps/<app>/.env` | Public keys (backend config, license key, Stripe publishable) | Vite/Next.js (dev + build) |
108
143
  | `apps/<app>/.env.local` | Local overrides (gitignored) | Vite/Next.js (overrides .env) |
109
144
  | `apps/<app>/.env.production` | Production overrides | Vite/Next.js (build --mode production) |
110
- | `functions/.env` | Server secrets: STRIPE_SECRET_KEY, OAuth secrets | API routes runtime |
111
145
  | Vercel Dashboard | All production env vars (client + server) | Vercel runtime |
112
146
 
113
147
  **Client vars** (browser-safe): `VITE_*` or `NEXT_PUBLIC_*` prefix.
114
- **Server vars** (secrets): No prefix needed in Vercel Dashboard — only accessible in API routes.
115
148
 
116
149
  ---
117
150
 
118
151
  ## Local Development
119
152
 
120
153
  ```bash
121
- bun dev
154
+ dndev dev
122
155
  ```
123
156
 
124
- The app runs locally, talking to your Firebase project. API routes can be tested with:
125
-
126
- ```bash
127
- vercel dev
128
- ```
157
+ The app runs locally, talking to your backend (Firebase or Supabase) directly.
129
158
 
130
- Or use Firebase emulators for fully local development:
159
+ For local function emulation:
131
160
 
132
161
  ```bash
133
162
  dndev emu start
@@ -135,42 +164,30 @@ dndev emu start
135
164
 
136
165
  ---
137
166
 
138
- ## Secrets
167
+ ## Custom Domain
139
168
 
140
- Server-side secrets go in `functions/.env` locally and in Vercel Dashboard for production.
141
-
142
- **We NEVER ask for secret keys.** You place them yourself:
143
-
144
- ```bash
145
- # functions/.env
146
- STRIPE_SECRET_KEY=sk_live_...
147
- STRIPE_WEBHOOK_SECRET=whsec_...
148
- ```
149
-
150
- Then add the same values in Vercel Dashboard → Settings → Environment Variables.
151
-
152
- See [ENV_SETUP.md → Secrets Philosophy](./ENV_SETUP.md#secrets-philosophy) for the full policy.
169
+ 1. Vercel Dashboard Settings Domains
170
+ 2. Add your domain
171
+ 3. Update DNS records as instructed by Vercel
172
+ 4. If using Firebase Auth: update your `FIREBASE_AUTH_DOMAIN` env var to your custom domain
153
173
 
154
174
  ---
155
175
 
156
176
  ## Troubleshooting
157
177
 
158
- **"Firebase config not loading"**
159
- → Check `.env` is in your **app directory** (`apps/<app>/.env`), not repo root
160
- Vite vars must start with `VITE_`, Next.js vars with `NEXT_PUBLIC_`
161
-
162
- **"401 / Permission denied on API routes"**
163
- → Check Firebase service account key is configured in Vercel env vars
164
- → Verify `GOOGLE_APPLICATION_CREDENTIALS` or inline credentials in API routes
178
+ **"Build fails on Vercel"**
179
+ → Check Root Directory is set to your app directory
180
+ Ensure `package.json` has correct `build` script
181
+ → Check all `VITE_*` env vars are set in Vercel Dashboard
165
182
 
166
183
  **"CORS error"**
167
184
  → Vercel handles CORS for same-origin requests automatically
168
- → For cross-origin: add CORS headers in your API route handler
185
+ → For cross-origin: CSP headers in `vercel.json` are pre-configured for your backend
169
186
 
170
- **"Build fails on Vercel"**
171
- Check Root Directory is set to your app directory
172
- Ensure `package.json` has correct `build` script
187
+ **".env values not loading"**
188
+ Vercel only reads env vars from its Dashboard, not from `.env` files
189
+ Make sure all required vars are set in Vercel Dashboard → Environment Variables
173
190
 
174
191
  ---
175
192
 
176
- **`dndev setup firebase` → configure Vercel project → set env vars → `git push`. Vercel deploys automatically.**
193
+ **Import repo in Vercel → set env vars → `git push`. Vercel deploys automatically.**
@@ -10,7 +10,7 @@ The DoNotDev framework uses a strict separation between local development and pr
10
10
 
11
11
  **`.env.local` is the exclusive source of truth for emulators.**
12
12
 
13
- When you run `dn emu <app-name>`, the framework loads environment variables **ONLY** from `functions/.env.local`.
13
+ When you run `dndev emu <app-name>`, the framework loads environment variables **ONLY** from `functions/.env.local`.
14
14
 
15
15
  1. Create `functions/.env.local` (it is git-ignored by default).
16
16
  2. Add your local development keys (e.g., Stripe ephemeral webhook secret).
@@ -25,7 +25,7 @@ STRIPE_WEBHOOK_SECRET=whsec_... # Get this from 'stripe listen' output
25
25
 
26
26
  **`.env` is the source of truth for production secrets.**
27
27
 
28
- These are the secrets that will be synced to Firebase Cloud Functions when you run `dn deploy` or `dn sync-secrets`.
28
+ These are the secrets that will be synced to Firebase Cloud Functions when you run `dndev deploy` or `dndev sync-secrets`.
29
29
 
30
30
  ```bash
31
31
  # functions/.env
@@ -3,7 +3,7 @@
3
3
  **Goal:** Deeply understand the app and document ALL requirements before any code.
4
4
 
5
5
  **MCP:** `start_phase(0)` to begin. `complete_phase()` when done.
6
- **Done when:** `spec_template.md` is COMPLETE and user has validated it.
6
+ **Done when:** `docs/HLD.md` is COMPLETE (using `guides/wai-way/spec_template.md` as template) and user has validated it.
7
7
 
8
8
  ---
9
9
 
@@ -1,6 +0,0 @@
1
- /**
2
- * @fileoverview Firebase Setup Command Wrapper
3
- * @description Re-exports firebaseSetup from tooling for CLI bundling.
4
- */
5
- export { firebaseSetup as main } from '@donotdev/tooling';
6
- //# sourceMappingURL=firebase-setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebase-setup.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/firebase-setup.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- // packages/cli/src/bin/commands/firebase-setup.ts
2
- /**
3
- * @fileoverview Firebase Setup Command Wrapper
4
- * @description Re-exports firebaseSetup from tooling for CLI bundling.
5
- */
6
- export { firebaseSetup as main } from '@donotdev/tooling';
7
- //# sourceMappingURL=firebase-setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"firebase-setup.js","sourceRoot":"","sources":["../../../src/bin/commands/firebase-setup.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AAEH,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * @fileoverview Supabase Setup Command Wrapper
3
- * @description Re-exports supabaseSetup from tooling for CLI bundling.
4
- */
5
- export { supabaseSetup as main } from '@donotdev/tooling';
6
- //# sourceMappingURL=supabase-setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"supabase-setup.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/supabase-setup.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,7 +0,0 @@
1
- // packages/cli/src/bin/commands/supabase-setup.ts
2
- /**
3
- * @fileoverview Supabase Setup Command Wrapper
4
- * @description Re-exports supabaseSetup from tooling for CLI bundling.
5
- */
6
- export { supabaseSetup as main } from '@donotdev/tooling';
7
- //# sourceMappingURL=supabase-setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"supabase-setup.js","sourceRoot":"","sources":["../../../src/bin/commands/supabase-setup.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AAEH,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,123 +0,0 @@
1
- # {{APP_NAME}} Functions
2
-
3
- This directory contains the Firebase Functions for the {{APP_NAME}} app, generated using the DoNotDev framework's scaffolding system.
4
-
5
- ## Structure
6
-
7
- ```
8
- functions/
9
- ├── src/
10
- │ ├── auth/ # Authentication functions
11
- │ ├── oauth/ # OAuth functions
12
- │ ├── billing/ # Billing functions
13
- │ └── index.ts # Main functions entry point
14
- ├── package.json # Dependencies and scripts
15
- ├── tsconfig.json # TypeScript configuration
16
- ├── .env.example # Environment variables template
17
- └── README.md # This file
18
- ```
19
-
20
- ## Features
21
-
22
- - **Authentication Management**: User custom claims and auth status
23
- - **OAuth Integration**: GitHub access management
24
- - **Billing Processing**: Stripe checkout and webhook handling
25
- - **Secure API Layer**: Professional frontend-backend communication
26
- - **Error Handling**: Comprehensive error handling and logging
27
-
28
- ## Environment Variables
29
-
30
- ### File Structure
31
-
32
- **Functions use a different .env system than Vite/Next.js:**
33
- - `.env` → Local development only (not automatically loaded, use with dotenv if needed)
34
- - Production → Use Firebase Functions Secrets (synced automatically during `dndev deploy`)
35
-
36
- **Note:** Functions don't follow Vite/Next.js `.env.local` priority rules. Use Firebase Secrets for production.
37
-
38
- ### Required Environment Variables
39
-
40
- ```bash
41
- # Stripe Configuration
42
- STRIPE_SECRET_KEY=sk_live_...
43
- STRIPE_WEBHOOK_SECRET=whsec_...
44
-
45
- # GitHub Configuration
46
- GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
47
- GITHUB_REPO_OWNER=your-org
48
- GITHUB_REPO_NAME=your-repo
49
-
50
- # Firebase Configuration
51
- FIREBASE_PROJECT_ID=your-project-id
52
- FIREBASE_REGION={{YOUR_REGION}}
53
- ```
54
-
55
- ### Setup Instructions
56
-
57
- 1. **Stripe Setup**:
58
- - Create products in Stripe Dashboard
59
- - Get price IDs and add to frontend `.env.local` (dev) or `.env.production.local` (prod)
60
- - Configure webhook endpoint in Stripe
61
- - Add webhook secret to functions `.env` (local) or Firebase Secrets (production)
62
-
63
- 2. **GitHub Setup**:
64
- - Create Personal Access Token with `repo` scope
65
- - Add token to functions `.env` (local) or Firebase Secrets (production)
66
- - Configure repository owner/name
67
-
68
- 3. **Firebase Setup**:
69
- - Get service account key: Firebase Console → Project Settings → Service Accounts → "Generate new private key"
70
- - Copy JSON content into `service-account-key.json` in app root (shared by frontend + functions)
71
- - Deploy: `dndev deploy` (from workspace root)
72
- - Update webhook URL in Stripe dashboard
73
-
74
- ## Deployment
75
-
76
- Use the unified deployment command from workspace root:
77
-
78
- ```bash
79
- # Deploy everything (interactive)
80
- dndev deploy
81
-
82
- # Deploy specific app
83
- dndev deploy <app-name>
84
- ```
85
-
86
- ## Development
87
-
88
- ```bash
89
- # Start Firebase emulators
90
- bun run serve
91
-
92
- # Start with debugging
93
- bun run dev
94
- ```
95
-
96
- ## API Endpoints
97
-
98
- ### Stripe Webhook
99
-
100
- - **URL**: `https://your-project.cloudfunctions.net/stripeWebhook`
101
- - **Events**: `checkout.session.completed`
102
- - **Purpose**: Processes purchases and grants access
103
-
104
- ### Checkout Session
105
-
106
- - **Integration**: Direct Stripe calls (no function needed)
107
- - **Purpose**: Creates Stripe checkout sessions for purchases
108
-
109
- ## Security
110
-
111
- - All functions require authentication
112
- - Webhook signature verification
113
- - Secure GitHub token management
114
- - Firebase custom claims for user status
115
-
116
- ## Framework Integration
117
-
118
- This functions package demonstrates how to:
119
-
120
- - Use the framework's scaffolding system
121
- - Implement secure API communication
122
- - Handle complex purchase flows
123
- - Integrate with external services (Stripe, GitHub)
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { buildFunctions } from '@donotdev/core/functions';
3
- import { functionsConfig } from './functions.config.js';
4
-
5
- buildFunctions(functionsConfig);
@@ -1,19 +0,0 @@
1
- /**
2
- * @fileoverview {{APP_NAME}} Get Custom Claims Wrapper
3
- * @description Wrapper for framework's getCustomClaims with {{APP_NAME}}-specific configuration
4
- * @version 0.0.1
5
- * @since 0.0.1
6
- * @author AMBROISE PARK Consulting
7
- */
8
-
9
- import { getCustomClaims as frameworkGetCustomClaims } from '@donotdev/functions/firebase';
10
-
11
- /**
12
- * {{APP_NAME}} custom claims retrieval
13
- * Wraps the framework function with {{APP_NAME}}-specific configuration
14
- *
15
- * @version 0.0.1
16
- * @since 0.0.1
17
- * @author AMBROISE PARK Consulting
18
- */
19
- export const getCustomClaims = frameworkGetCustomClaims;
@@ -1,21 +0,0 @@
1
- // functions/src/auth/getUserAuthStatus.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} User Auth Status Wrapper
5
- * @description Wrapper for framework's getUserAuthStatus with {{APP_NAME}}-specific configuration
6
- * @version 0.0.1
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
-
11
- import { getUserAuthStatus as frameworkGetUserAuthStatus } from '@donotdev/functions/firebase';
12
-
13
- /**
14
- * {{APP_NAME}} user authentication status
15
- * Wraps the framework function with {{APP_NAME}}-specific configuration
16
- *
17
- * @version 0.0.1
18
- * @since 0.0.1
19
- * @author AMBROISE PARK Consulting
20
- */
21
- export const getUserAuthStatus = frameworkGetUserAuthStatus;
@@ -1,11 +0,0 @@
1
- // functions/src/auth/index.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Auth Functions
5
- * @description Exports all auth-related functions for the {{APP_NAME}} app
6
- */
7
-
8
- export { setCustomClaims } from './setCustomClaims';
9
- export { getCustomClaims } from './getCustomClaims';
10
- export { removeCustomClaims } from './removeCustomClaims';
11
- export { getUserAuthStatus } from './getUserAuthStatus';
@@ -1,21 +0,0 @@
1
- // functions/src/auth/removeCustomClaims.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Remove Custom Claims Wrapper
5
- * @description Wrapper for framework's removeCustomClaims with {{APP_NAME}}-specific configuration
6
- * @version 0.0.1
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
-
11
- import { removeCustomClaims as frameworkRemoveCustomClaims } from '@donotdev/functions/firebase';
12
-
13
- /**
14
- * {{APP_NAME}} custom claims removal
15
- * Wraps the framework function with {{APP_NAME}}-specific configuration
16
- *
17
- * @version 0.0.1
18
- * @since 0.0.1
19
- * @author AMBROISE PARK Consulting
20
- */
21
- export const removeCustomClaims = frameworkRemoveCustomClaims;
@@ -1,21 +0,0 @@
1
- // functions/src/auth/setCustomClaims.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Set Custom Claims Wrapper
5
- * @description Wrapper for framework's setCustomClaims with {{APP_NAME}}-specific configuration
6
- * @version 0.0.1
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
-
11
- import { setCustomClaims as frameworkSetCustomClaims } from '@donotdev/functions/firebase';
12
-
13
- /**
14
- * {{APP_NAME}} custom claims setting
15
- * Wraps the framework function with {{APP_NAME}}-specific configuration
16
- *
17
- * @version 0.0.1
18
- * @since 0.0.1
19
- * @author AMBROISE PARK Consulting
20
- */
21
- export const setCustomClaims = frameworkSetCustomClaims;
@@ -1,24 +0,0 @@
1
- // functions/src/billing/handleStripeWebhook.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Stripe Webhook Wrapper
5
- * @description Wrapper for framework's createStripeWebhookHandler with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import { createStripeWebhookHandler } from '@donotdev/functions/firebase';
9
-
10
- /**
11
- * {{APP_NAME}} Stripe webhook handler
12
- * Configured with {{APP_NAME}}-specific product types and settings
13
- */
14
- export const stripeWebhook = createStripeWebhookHandler({
15
- productTypes: {
16
- // Add your product types here
17
- // Example:
18
- // premium_plan: {
19
- // tier: 'premium',
20
- // subscriptionEnd: '2099-12-31T23:59:59.000Z',
21
- // githubRepo: { owner: 'your-org', repo: 'your-repo' },
22
- // },
23
- },
24
- });
@@ -1,10 +0,0 @@
1
- // functions/src/billing/index.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Billing Functions
5
- * @description Exports all billing-related functions for the {{APP_NAME}} app
6
- */
7
-
8
- export { processPaymentSuccess } from './processPaymentSuccess';
9
- export { refreshSubscriptionStatus } from './refreshSubscriptionStatus';
10
- export { stripeWebhook } from './handleStripeWebhook';
@@ -1,14 +0,0 @@
1
- // functions/src/billing/processPaymentSuccess.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Payment Success Wrapper
5
- * @description Wrapper for framework's processPaymentSuccess with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import { processPaymentSuccess as frameworkProcessPaymentSuccess } from '@donotdev/functions/firebase';
9
-
10
- /**
11
- * {{APP_NAME}} payment success processing
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
13
- */
14
- export const processPaymentSuccess = frameworkProcessPaymentSuccess;
@@ -1,14 +0,0 @@
1
- // functions/src/billing/refreshSubscriptionStatus.ts
2
-
3
- /**
4
- * @fileoverview {{APP_NAME}} Subscription Status Wrapper
5
- * @description Wrapper for framework's refreshSubscriptionStatus with {{APP_NAME}}-specific configuration
6
- */
7
-
8
- import { refreshSubscriptionStatus as frameworkRefreshSubscriptionStatus } from '@donotdev/functions/firebase';
9
-
10
- /**
11
- * {{APP_NAME}} subscription status refresh
12
- * Wraps the framework function with {{APP_NAME}}-specific configuration
13
- */
14
- export const refreshSubscriptionStatus = frameworkRefreshSubscriptionStatus;