@donotdev/cli 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dependencies-matrix.json +372 -88
  2. package/dist/bin/commands/agent-setup.js +7 -1
  3. package/dist/bin/commands/build.js +141 -44
  4. package/dist/bin/commands/bump.js +81 -41
  5. package/dist/bin/commands/cacheout.js +37 -9
  6. package/dist/bin/commands/create-app.js +276 -121
  7. package/dist/bin/commands/create-project.js +506 -217
  8. package/dist/bin/commands/deploy.js +1785 -694
  9. package/dist/bin/commands/dev.js +177 -43
  10. package/dist/bin/commands/doctor.d.ts +6 -0
  11. package/dist/bin/commands/doctor.d.ts.map +1 -0
  12. package/dist/bin/commands/{lint.js → doctor.js} +1215 -156
  13. package/dist/bin/commands/doctor.js.map +1 -0
  14. package/dist/bin/commands/emu.js +451 -104
  15. package/dist/bin/commands/format.js +37 -9
  16. package/dist/bin/commands/make-admin.js +77499 -11
  17. package/dist/bin/commands/preview.js +181 -43
  18. package/dist/bin/commands/setup.d.ts +6 -0
  19. package/dist/bin/commands/setup.d.ts.map +1 -0
  20. package/dist/bin/commands/setup.js +11733 -0
  21. package/dist/bin/commands/setup.js.map +1 -0
  22. package/dist/bin/commands/supabase-setup.d.ts +6 -0
  23. package/dist/bin/commands/supabase-setup.d.ts.map +1 -0
  24. package/dist/bin/commands/supabase-setup.js +7 -0
  25. package/dist/bin/commands/supabase-setup.js.map +1 -0
  26. package/dist/bin/commands/sync-secrets.js +211 -34
  27. package/dist/bin/commands/type-check.d.ts +14 -0
  28. package/dist/bin/commands/type-check.d.ts.map +1 -0
  29. package/dist/bin/commands/type-check.js +2049 -0
  30. package/dist/bin/commands/type-check.js.map +1 -0
  31. package/dist/bin/commands/wai.js +3 -1
  32. package/dist/bin/dndev.js +73 -52
  33. package/dist/bin/donotdev.js +54 -45
  34. package/dist/index.js +4212 -3050
  35. package/package.json +3 -3
  36. package/templates/app-demo/src/App.tsx.example +1 -0
  37. package/templates/app-demo/src/pages/FullPage.tsx.example +2 -2
  38. package/templates/app-demo/src/pages/components/DemoLayout.tsx.example +2 -2
  39. package/templates/app-demo/src/themes.css.example +5 -12
  40. package/templates/app-expo/.env.example +44 -0
  41. package/templates/app-expo/.expo/README.md.example +5 -0
  42. package/templates/app-expo/.gitignore.example +36 -0
  43. package/templates/app-expo/README.md.example +58 -0
  44. package/templates/app-expo/app/.gitkeep +2 -0
  45. package/templates/app-expo/app/_layout.tsx.example +41 -0
  46. package/templates/app-expo/app/form.tsx.example +52 -0
  47. package/templates/app-expo/app/index.tsx.example +89 -0
  48. package/templates/app-expo/app/list.tsx.example +32 -0
  49. package/templates/app-expo/app/profile.tsx.example +76 -0
  50. package/templates/app-expo/app/signin.tsx.example +53 -0
  51. package/templates/app-expo/app.json.example +39 -0
  52. package/templates/app-expo/assets/adaptive-icon.png +0 -0
  53. package/templates/app-expo/assets/favicon.png +0 -0
  54. package/templates/app-expo/assets/icon.png +0 -0
  55. package/templates/app-expo/assets/splash.png +0 -0
  56. package/templates/app-expo/babel.config.js.example +10 -0
  57. package/templates/app-expo/eas.json.example +20 -0
  58. package/templates/app-expo/expo-env.d.ts.example +4 -0
  59. package/templates/app-expo/metro.config.js.example +20 -0
  60. package/templates/app-expo/service-account-key.json.example +12 -0
  61. package/templates/app-expo/src/config/app.ts.example +46 -0
  62. package/templates/app-expo/src/config/providers.ts.example +7 -0
  63. package/templates/app-expo/tsconfig.json.example +19 -0
  64. package/templates/app-next/.env.example +4 -33
  65. package/templates/app-next/src/app/ClientLayout.tsx.example +2 -0
  66. package/templates/app-next/src/app/layout.tsx.example +7 -6
  67. package/templates/app-next/src/config/providers.ts.example +7 -0
  68. package/templates/app-next/src/globals.css.example +2 -11
  69. package/templates/app-next/src/pages/HomePage.tsx.example +1 -1
  70. package/templates/app-next/src/themes.css.example +10 -13
  71. package/templates/app-vite/.env.example +3 -32
  72. package/templates/app-vite/index.html.example +2 -24
  73. package/templates/app-vite/src/App.tsx.example +2 -0
  74. package/templates/app-vite/src/config/providers.ts.example +7 -0
  75. package/templates/app-vite/src/globals.css.example +2 -12
  76. package/templates/app-vite/src/pages/FormPageExample.tsx.example +1 -2
  77. package/templates/app-vite/src/pages/HomePage.tsx.example +2 -2
  78. package/templates/app-vite/src/themes.css.example +109 -79
  79. package/templates/app-vite/vercel.json.example +11 -0
  80. package/templates/functions-firebase/README.md.example +1 -1
  81. package/templates/functions-firebase/build.mjs.example +2 -72
  82. package/templates/functions-firebase/functions-firebase/.env.example.example +24 -26
  83. package/templates/functions-firebase/functions-firebase/README.md.example +1 -1
  84. package/templates/functions-firebase/functions-firebase/build.mjs.example +2 -72
  85. package/templates/functions-firebase/functions-firebase/tsconfig.json.example +1 -1
  86. package/templates/functions-firebase/functions.config.js.example +1 -1
  87. package/templates/functions-supabase/supabase/config.toml.example +59 -0
  88. package/templates/functions-supabase/supabase/functions/.env.example +13 -0
  89. package/templates/functions-supabase/supabase/functions/cancel-subscription/index.ts.example +7 -0
  90. package/templates/functions-supabase/supabase/functions/change-plan/index.ts.example +11 -0
  91. package/templates/functions-supabase/supabase/functions/create-checkout-session/index.ts.example +11 -0
  92. package/templates/functions-supabase/supabase/functions/create-customer-portal/index.ts.example +7 -0
  93. package/templates/functions-supabase/supabase/functions/crud/index.ts.example +16 -0
  94. package/templates/functions-supabase/supabase/functions/delete-account/index.ts.example +7 -0
  95. package/templates/functions-supabase/supabase/functions/deno.json.example +8 -0
  96. package/templates/functions-supabase/supabase/functions/get-custom-claims/index.ts.example +7 -0
  97. package/templates/functions-supabase/supabase/functions/get-user-auth-status/index.ts.example +7 -0
  98. package/templates/functions-supabase/supabase/functions/refresh-subscription-status/index.ts.example +7 -0
  99. package/templates/functions-supabase/supabase/functions/remove-custom-claims/index.ts.example +7 -0
  100. package/templates/functions-supabase/supabase/functions/set-custom-claims/index.ts.example +7 -0
  101. package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +24 -0
  102. package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +22 -0
  103. package/templates/functions-supabase/supabase/migrations/20250101000002_cleanup_jobs.sql +28 -0
  104. package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +28 -0
  105. package/templates/functions-vercel/functions-vercel/tsconfig.json.example +1 -1
  106. package/templates/functions-vercel/functions-vercel/vercel.json.example +1 -1
  107. package/templates/functions-vercel/vercel.json.example +1 -1
  108. package/templates/github/github/workflows/firebase-deploy.yml.example +1 -1
  109. package/templates/github/workflows/firebase-deploy.yml.example +1 -1
  110. package/templates/overlay-firebase/env.fragment.example +34 -0
  111. package/templates/overlay-firebase/env.fragment.expo.example +34 -0
  112. package/templates/overlay-firebase/env.fragment.nextjs.example +34 -0
  113. package/templates/overlay-firebase/src/config/providers.expo.ts.example +49 -0
  114. package/templates/overlay-firebase/src/config/providers.ts.example +23 -0
  115. package/templates/overlay-supabase/env.fragment.example +12 -0
  116. package/templates/overlay-supabase/env.fragment.expo.example +12 -0
  117. package/templates/overlay-supabase/env.fragment.nextjs.example +12 -0
  118. package/templates/overlay-supabase/src/config/providers.expo.ts.example +35 -0
  119. package/templates/overlay-supabase/src/config/providers.ts.example +33 -0
  120. package/templates/overlay-supabase/vercel.headers.example +23 -0
  121. package/templates/overlay-supabase/vercel.json.example +22 -0
  122. package/templates/overlay-vercel/env.fragment.example +34 -0
  123. package/templates/overlay-vercel/env.fragment.nextjs.example +34 -0
  124. package/templates/overlay-vercel/src/config/providers.ts.example +24 -0
  125. package/templates/root-consumer/.claude/agents/architect.md.example +2 -310
  126. package/templates/root-consumer/.claude/agents/builder.md.example +2 -326
  127. package/templates/root-consumer/.claude/agents/coder.md.example +2 -83
  128. package/templates/root-consumer/.claude/agents/extractor.md.example +2 -231
  129. package/templates/root-consumer/.claude/agents/polisher.md.example +2 -132
  130. package/templates/root-consumer/.claude/agents/prompt-engineer.md.example +2 -81
  131. package/templates/root-consumer/.claude/commands/grill.md.example +30 -0
  132. package/templates/root-consumer/.claude/commands/techdebt.md.example +28 -0
  133. package/templates/root-consumer/.clinerules.example +1 -0
  134. package/templates/root-consumer/.cursor/rules/no-docs.mdc.example +15 -0
  135. package/templates/root-consumer/.cursorrules.example +1 -0
  136. package/templates/root-consumer/.github/copilot-instructions.md.example +1 -0
  137. package/templates/root-consumer/.windsurfrules.example +1 -0
  138. package/templates/root-consumer/AI.md.example +44 -123
  139. package/templates/root-consumer/CLAUDE.md.example +1 -134
  140. package/templates/root-consumer/CONVENTIONS.md.example +1 -0
  141. package/templates/root-consumer/GEMINI.md.example +1 -0
  142. package/templates/root-consumer/firebase.json.example +1 -1
  143. package/templates/root-consumer/guides/dndev/AGENT_START_HERE.md.example +22 -2
  144. package/templates/root-consumer/guides/dndev/COMPONENTS_ADV.md.example +0 -18
  145. package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +1 -1
  146. package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +101 -32
  147. package/templates/root-consumer/guides/dndev/INDEX.md.example +4 -2
  148. package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +3 -3
  149. package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +241 -12
  150. package/templates/root-consumer/guides/dndev/SETUP_FIREBASE.md.example +13 -7
  151. package/templates/root-consumer/guides/dndev/SETUP_OAUTH_PROVIDERS.md.example +60 -0
  152. package/templates/root-consumer/guides/dndev/SETUP_SOC2.md.example +234 -0
  153. package/templates/root-consumer/guides/dndev/SETUP_STRIPE.md.example +62 -0
  154. package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +124 -0
  155. package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +6 -2
  156. package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +176 -0
  157. package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +5 -9
  158. package/templates/root-consumer/guides/dndev/essences_reference.css.example +174 -0
  159. package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +7 -8
  160. package/templates/root-consumer/guides/wai-way/agents/builder.md.example +10 -0
  161. package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +25 -5
  162. package/templates/root-consumer/guides/wai-way/agents/polisher.md.example +13 -2
  163. package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +2 -2
  164. package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +55 -15
  165. package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +15 -4
  166. package/templates/root-consumer/guides/wai-way/spec_template.md.example +7 -6
  167. package/dist/bin/commands/lint.d.ts +0 -11
  168. package/dist/bin/commands/lint.d.ts.map +0 -1
  169. package/dist/bin/commands/lint.js.map +0 -1
  170. package/dist/bin/commands/staging.d.ts +0 -11
  171. package/dist/bin/commands/staging.d.ts.map +0 -1
  172. package/dist/bin/commands/staging.js +0 -12
  173. package/dist/bin/commands/staging.js.map +0 -1
  174. package/templates/app-payload/.env.example +0 -28
  175. package/templates/app-payload/README.md.example +0 -233
  176. package/templates/app-payload/collections/Company.ts.example +0 -125
  177. package/templates/app-payload/collections/Hero.ts.example +0 -62
  178. package/templates/app-payload/collections/Media.ts.example +0 -41
  179. package/templates/app-payload/collections/Products.ts.example +0 -115
  180. package/templates/app-payload/collections/Services.ts.example +0 -104
  181. package/templates/app-payload/collections/Testimonials.ts.example +0 -92
  182. package/templates/app-payload/collections/Users.ts.example +0 -35
  183. package/templates/app-payload/src/server.ts.example +0 -79
  184. package/templates/app-payload/tsconfig.json.example +0 -24
@@ -1,64 +1,38 @@
1
- /* src/themes.css */
1
+ /**
2
+ * src/themes.css — SSOT for visual essence and theme variables.
3
+ * Import this in globals.css; do not set font/color overrides in globals (themes.css only).
4
+ *
5
+ * Default essence = SaaS (Inter, neutral). No class on <html> = SaaS.
6
+ * Optional essences below (.brutalist, .luxury) do NOT apply by default.
7
+ * To use one: set the class on the document root (e.g. document.documentElement.className = 'brutalist')
8
+ * or use the framework theme switcher if your app exposes it.
9
+ */
2
10
 
3
11
  /* ===========================
4
- APP-WIDE SETTINGS
5
- Spacing, radius, shadows, animations - apply to all themes
6
- =========================== */
7
- :root {
8
- /* Routing animations (fade | slide | none) */
9
- /* --routing-animation: fade; */
10
- /* --routing-default-duration: var(--dur-normal); */
11
-
12
- /* Spacing scale */
13
- /* --gap-sm: 0.5rem; */
14
- /* --gap-md: 1rem; */
15
- /* --gap-lg: 2rem; */
16
-
17
- /* Border radius */
18
- /* --radius-interactive: var(--radius-none); */
19
- /* --radius-surface: var(--radius-md); */
20
- /* --radius-floating: var(--radius-none); */
21
- }
22
-
23
- /* ===========================
24
- LIGHT THEME
25
- Zinc-based neutral palette
12
+ LIGHT THEME (SaaS default)
26
13
  =========================== */
27
14
  :root.light {
28
15
  --theme-icon: 'Sun';
29
16
  --theme-label: 'Light';
30
17
  --theme-is-dark: 0;
31
18
 
32
- /* Core colors */
33
19
  --background: #ffffff;
34
20
  --foreground: #09090b;
35
-
36
- /* Surfaces */
37
- --card: #ffffff;
38
- --card-foreground: #09090b;
39
- --popover: #ffffff;
40
- --popover-foreground: #09090b;
41
-
42
- /* Muted (zinc-100 / zinc-500) */
43
- --muted: #f4f4f5;
44
- --muted-foreground: #71717a;
45
-
46
- /* Border & input (zinc-200) */
47
- --border: #e4e4e7;
48
- --input: #e4e4e7;
49
- --ring: var(--primary);
50
-
51
- /* Brand colors - customize these */
52
21
  --primary: #0284c7;
53
22
  --primary-foreground: #ffffff;
54
-
55
23
  --secondary: #f4f4f5;
56
24
  --secondary-foreground: #18181b;
57
-
58
25
  --accent: #ea580c;
59
26
  --accent-foreground: #ffffff;
60
-
61
- /* Status colors */
27
+ --muted: #f4f4f5;
28
+ --muted-foreground: #71717a;
29
+ --border: #e4e4e7;
30
+ --input: #e4e4e7;
31
+ --ring: var(--primary);
32
+ --card: #ffffff;
33
+ --card-foreground: #09090b;
34
+ --popover: #ffffff;
35
+ --popover-foreground: #09090b;
62
36
  --destructive: #dc2626;
63
37
  --destructive-foreground: #ffffff;
64
38
  --success: #16a34a;
@@ -68,44 +42,30 @@
68
42
  }
69
43
 
70
44
  /* ===========================
71
- DARK THEME
72
- Zinc-based dark palette
45
+ DARK THEME (SaaS default)
73
46
  =========================== */
74
47
  :root.dark {
75
48
  --theme-icon: 'Moon';
76
49
  --theme-label: 'Dark';
77
50
  --theme-is-dark: 1;
78
51
 
79
- /* Core colors */
80
52
  --background: #09090b;
81
53
  --foreground: #fafafa;
82
-
83
- /* Surfaces */
84
- --card: #09090b;
85
- --card-foreground: #fafafa;
86
- --popover: #18181b;
87
- --popover-foreground: #fafafa;
88
-
89
- /* Muted (zinc-800 / zinc-400) */
90
- --muted: #27272a;
91
- --muted-foreground: #a1a1aa;
92
-
93
- /* Border & input (zinc-800) */
94
- --border: #27272a;
95
- --input: #27272a;
96
- --ring: var(--primary);
97
-
98
- /* Brand colors - customize these */
99
54
  --primary: #0ea5e9;
100
55
  --primary-foreground: #ffffff;
101
-
102
56
  --secondary: #27272a;
103
57
  --secondary-foreground: #fafafa;
104
-
105
58
  --accent: #f97316;
106
59
  --accent-foreground: #ffffff;
107
-
108
- /* Status colors */
60
+ --muted: #27272a;
61
+ --muted-foreground: #a1a1aa;
62
+ --border: #27272a;
63
+ --input: #27272a;
64
+ --ring: var(--primary);
65
+ --card: #09090b;
66
+ --card-foreground: #fafafa;
67
+ --popover: #18181b;
68
+ --popover-foreground: #fafafa;
109
69
  --destructive: #dc2626;
110
70
  --destructive-foreground: #ffffff;
111
71
  --success: #16a34a;
@@ -115,17 +75,87 @@
115
75
  }
116
76
 
117
77
  /* ===========================
118
- CUSTOM THEMES
119
- Add your brand themes below
78
+ OPTIONAL ESSENCES
79
+ Do not apply by default. Apply by setting class on <html> (e.g. class="brutalist").
80
+ Fonts: Space Grotesk (Brutalist), Playfair Display (Luxury) are in @donotdev/ui.
120
81
  =========================== */
121
82
 
122
- /* Example:
123
- :root.brand {
124
- --theme-icon: 'Zap';
125
- --theme-label: 'Brand';
83
+ /** Brutalist — Industrial, grid, Space Grotesk, orange/black. Does not apply by default. */
84
+ .brutalist {
85
+ --theme-icon: 'Construction';
86
+ --theme-label: 'Brutalist';
87
+ --theme-is-dark: 1;
88
+ --background: #000000;
89
+ --foreground: #ffffff;
90
+ --primary: #f97316;
91
+ --secondary: #1a1a1a;
92
+ --accent: #f97316;
93
+ --muted: #111111;
94
+ --muted-foreground: #888888;
95
+ --border: #ffffff;
96
+ --input: #111111;
97
+ --ring: #f97316;
98
+ --card: #000000;
99
+ --card-foreground: #ffffff;
100
+ --popover: #000000;
101
+ --popover-foreground: #ffffff;
102
+ --primary-foreground: #ffffff;
103
+ --secondary-foreground: #ffffff;
104
+ --accent-foreground: #ffffff;
105
+ --success: #22c55e;
106
+ --warning: #f97316;
107
+ --destructive: #dc2626;
108
+ --success-foreground: #ffffff;
109
+ --warning-foreground: #ffffff;
110
+ --destructive-foreground: #ffffff;
111
+ --radius-interactive: 0;
112
+ --radius-surface: 0;
113
+ --radius-floating: 0;
114
+ --font-family: 'Space Grotesk', var(--font-sans);
115
+ --font-headline: 'Space Grotesk', var(--font-sans);
116
+ --border-width: 2px;
117
+ --border-huge: 4px;
118
+ --shadow-sm: 4px 4px 0px 0px var(--primary);
119
+ --shadow-md: 8px 8px 0px 0px var(--primary);
120
+ --shadow-xl: 12px 12px 0px 0px var(--primary);
121
+ }
122
+
123
+ /** Luxury — Serif headlines (Playfair), gold/cream/dark. Does not apply by default. */
124
+ .luxury {
125
+ --theme-icon: 'Gem';
126
+ --theme-label: 'Luxury';
126
127
  --theme-is-dark: 0;
127
- --background: #your-color;
128
- --foreground: #your-color;
129
- ...
128
+ --background: #faf8f5;
129
+ --foreground: #1c1917;
130
+ --primary: #b45309;
131
+ --secondary: #fef3c7;
132
+ --accent: #92400e;
133
+ --muted: #fef9c3;
134
+ --muted-foreground: #78716c;
135
+ --border: #e7e5e4;
136
+ --input: #ffffff;
137
+ --ring: #b45309;
138
+ --card: #ffffff;
139
+ --card-foreground: #1c1917;
140
+ --popover: #ffffff;
141
+ --popover-foreground: #1c1917;
142
+ --primary-foreground: #ffffff;
143
+ --secondary-foreground: #1c1917;
144
+ --accent-foreground: #ffffff;
145
+ --success: #15803d;
146
+ --warning: #b45309;
147
+ --destructive: #b91c1c;
148
+ --success-foreground: #ffffff;
149
+ --warning-foreground: #1c1917;
150
+ --destructive-foreground: #ffffff;
151
+ --font-family: var(--font-sans);
152
+ --font-headline: 'Playfair Display', var(--font-serif);
153
+ --radius-interactive: 0.375rem;
154
+ --radius-surface: 0.5rem;
155
+ --radius-floating: 0.5rem;
130
156
  }
131
- */
157
+
158
+ /* ===========================
159
+ CUSTOM THEMES
160
+ Add your brand themes below (same pattern: class + --theme-label, --theme-icon, --theme-is-dark).
161
+ =========================== */
@@ -0,0 +1,11 @@
1
+ {
2
+ "buildCommand": "bun run build",
3
+ "outputDirectory": "dist",
4
+ "installCommand": "bun install",
5
+ "rewrites": [
6
+ {
7
+ "source": "/(.*)",
8
+ "destination": "/index.html"
9
+ }
10
+ ]
11
+ }
@@ -76,7 +76,7 @@ GITHUB_REPO_NAME=your-repo
76
76
 
77
77
  # Firebase Configuration
78
78
  FIREBASE_PROJECT_ID=your-project-id
79
- FIREBASE_REGION=us-central1
79
+ FIREBASE_REGION={{YOUR_REGION}}
80
80
  ```
81
81
 
82
82
  ### Setup Instructions
@@ -1,75 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * @fileoverview Build script for {{APP_NAME}} functions
4
- * @description Bundles @donotdev/types and imports framework functions
5
- */
6
-
7
- import { build } from 'esbuild';
8
- import { writeFileSync } from 'fs';
9
- import { createAppFunctionsConfig, generateFunctionsYamlWithInfo, filterEnvSecrets } from '@donotdev/core/functions';
2
+ import { buildFunctions } from '@donotdev/core/functions';
10
3
  import { functionsConfig } from './functions.config.js';
11
4
 
12
- async function buildFunctions() {
13
- console.log('🔨 Building {{APP_NAME}} functions...');
14
-
15
- try {
16
- const config = createAppFunctionsConfig({
17
- entry: 'src/index.ts',
18
- outDir: 'lib',
19
- minify: process.env.NODE_ENV === 'production',
20
- sourcemap: true,
21
- });
22
-
23
- console.log('📦 Bundling @donotdev/types and importing framework functions...');
24
-
25
- const result = await build(config);
26
-
27
- if (result.errors.length > 0) {
28
- console.error('❌ Build errors:', result.errors);
29
- process.exit(1);
30
- }
31
-
32
- if (result.warnings.length > 0) {
33
- console.warn('⚠️ Build warnings:', result.warnings);
34
- }
35
-
36
- console.log('✅ {{APP_NAME}} functions built successfully!');
37
- console.log('📁 Output directory: lib/');
38
-
39
- // Generate functions.yaml from config + auto-detection
40
- // Auto-detects: exported functions from src/index.ts + secrets from .env
41
- const { yaml, staticFunctions, crudFunctions, autoDetected, autoSecrets } = generateFunctionsYamlWithInfo(
42
- functionsConfig,
43
- { entryFile: 'src/index.ts', envPath: '.env' }
44
- );
45
- writeFileSync('functions.yaml', yaml);
46
- console.log(`📄 Generated functions.yaml: ${staticFunctions.length} static + ${crudFunctions.length} CRUD functions`);
47
- if (autoDetected.length > 0) {
48
- console.log(`🔍 Auto-detected ${autoDetected.length} function(s) from src/index.ts: ${autoDetected.join(', ')}`);
49
- }
50
- if (autoSecrets.length > 0) {
51
- console.log(`🔑 Auto-detected ${autoSecrets.length} secret(s) from .env: ${autoSecrets.join(', ')}`);
52
- }
53
-
54
- // Filter .env: move secret keys to .env.local (emulator-only, never deployed)
55
- const { stripped } = filterEnvSecrets(functionsConfig);
56
- if (stripped.length > 0) {
57
- console.log(`🔒 Filtered ${stripped.length} secret(s) from .env → .env.local`);
58
- }
59
-
60
- // Log bundle info if metafile is available
61
- if (result.metafile) {
62
- const { analyzeMetafile } = await import('esbuild');
63
- const analysis = await analyzeMetafile(result.metafile);
64
- console.log('\n📊 Bundle analysis:');
65
- console.log(analysis);
66
- }
67
-
68
- } catch (error) {
69
- console.error('❌ Build failed:', error);
70
- process.exit(1);
71
- }
72
- }
73
-
74
- // Run the build
75
- buildFunctions();
5
+ buildFunctions(functionsConfig);
@@ -1,45 +1,43 @@
1
1
  # =============================================================================
2
- # {{APP_NAME}} Firebase Functions Environment Variables
2
+ # {{APP_NAME}} Server-Side Environment Variables
3
3
  # =============================================================================
4
- # Copy this file to .env in the functions directory and update with your values
4
+ # Copy this file to .env in the functions directory and fill in your values.
5
+ #
6
+ # IMPORTANT: These are SECRET keys. Never put them in VITE_* or NEXT_PUBLIC_*
7
+ # variables. Never commit this file to git.
8
+ #
9
+ # Sync to runtime: dndev sync-secrets
10
+ # Sync to GitHub: dndev sync-secrets --target github
5
11
 
6
12
  # =============================================================================
7
13
  # Stripe Configuration
14
+ # Get keys from: https://dashboard.stripe.com/apikeys
8
15
  # =============================================================================
9
- # Stripe Secret Key (server-side only)
10
- STRIPE_SECRET_KEY=sk_test_1234567890abcdef
16
+ STRIPE_SECRET_KEY=sk_test_...
17
+ STRIPE_WEBHOOK_SECRET=whsec_...
11
18
 
12
- # Stripe Webhook Secret (for webhook signature verification)
13
- STRIPE_WEBHOOK_SECRET=whsec_1234567890abcdef
19
+ # =============================================================================
20
+ # Supabase (server-side only — if using Supabase backend)
21
+ # Get from: https://supabase.com/dashboard → Settings → API
22
+ # =============================================================================
23
+ # SUPABASE_SERVICE_ROLE_KEY=eyJ...
14
24
 
15
25
  # =============================================================================
16
26
  # GitHub Configuration
17
- # =============================================================================
18
- # GitHub Personal Access Token (for repository access management)
27
+ # Get token from: https://github.com/settings/tokens
19
28
  # Required scopes: repo (full control of private repositories)
20
- GITHUB_PERSONAL_ACCESS_TOKEN=ghp_1234567890abcdef
21
-
22
- # GitHub Repository Configuration
23
- GITHUB_REPO_OWNER=your-org
24
- GITHUB_REPO_NAME=your-repo
29
+ # =============================================================================
30
+ # GITHUB_PERSONAL_ACCESS_TOKEN=ghp_...
31
+ # GITHUB_REPO_OWNER=your-org
32
+ # GITHUB_REPO_NAME=your-repo
25
33
 
26
34
  # =============================================================================
27
- # Firebase Configuration
35
+ # Firebase Configuration (auto-detected, rarely needed manually)
28
36
  # =============================================================================
29
- # Firebase Project ID (usually auto-detected from Firebase Admin SDK)
30
37
  FIREBASE_PROJECT_ID=your-project-id
31
-
32
- # Firebase Region (default: us-central1)
33
- FIREBASE_REGION=us-central1
38
+ FIREBASE_REGION={{YOUR_REGION}}
34
39
 
35
40
  # =============================================================================
36
- # Development Configuration
41
+ # Development
37
42
  # =============================================================================
38
- # Node Environment
39
43
  NODE_ENV=development
40
-
41
- # =============================================================================
42
- # Setup Instructions
43
- # =============================================================================
44
- # 1. Get Stripe keys from: https://dashboard.stripe.com/apikeys
45
- # 2. Get GitHub token from: https://github.com/settings/tokens
@@ -49,7 +49,7 @@ GITHUB_REPO_NAME=your-repo
49
49
 
50
50
  # Firebase Configuration
51
51
  FIREBASE_PROJECT_ID=your-project-id
52
- FIREBASE_REGION=us-central1
52
+ FIREBASE_REGION={{YOUR_REGION}}
53
53
  ```
54
54
 
55
55
  ### Setup Instructions
@@ -1,75 +1,5 @@
1
1
  #!/usr/bin/env node
2
- /**
3
- * @fileoverview Build script for {{APP_NAME}} functions
4
- * @description Bundles @donotdev/types and imports framework functions
5
- */
6
-
7
- import { build } from 'esbuild';
8
- import { writeFileSync } from 'fs';
9
- import { createAppFunctionsConfig, generateFunctionsYamlWithInfo, filterEnvSecrets } from '@donotdev/core/functions';
2
+ import { buildFunctions } from '@donotdev/core/functions';
10
3
  import { functionsConfig } from './functions.config.js';
11
4
 
12
- async function buildFunctions() {
13
- console.log('🔨 Building {{APP_NAME}} functions...');
14
-
15
- try {
16
- const config = createAppFunctionsConfig({
17
- entry: 'src/index.ts',
18
- outDir: 'lib',
19
- minify: process.env.NODE_ENV === 'production',
20
- sourcemap: true,
21
- });
22
-
23
- console.log('📦 Bundling @donotdev/types and importing framework functions...');
24
-
25
- const result = await build(config);
26
-
27
- if (result.errors.length > 0) {
28
- console.error('❌ Build errors:', result.errors);
29
- process.exit(1);
30
- }
31
-
32
- if (result.warnings.length > 0) {
33
- console.warn('⚠️ Build warnings:', result.warnings);
34
- }
35
-
36
- console.log('✅ {{APP_NAME}} functions built successfully!');
37
- console.log('📁 Output directory: lib/');
38
-
39
- // Generate functions.yaml from config + auto-detection
40
- // Auto-detects: exported functions from src/index.ts + secrets from .env
41
- const { yaml, staticFunctions, crudFunctions, autoDetected, autoSecrets } = generateFunctionsYamlWithInfo(
42
- functionsConfig,
43
- { entryFile: 'src/index.ts', envPath: '.env' }
44
- );
45
- writeFileSync('functions.yaml', yaml);
46
- console.log(`📄 Generated functions.yaml: ${staticFunctions.length} static + ${crudFunctions.length} CRUD functions`);
47
- if (autoDetected.length > 0) {
48
- console.log(`🔍 Auto-detected ${autoDetected.length} function(s) from src/index.ts: ${autoDetected.join(', ')}`);
49
- }
50
- if (autoSecrets.length > 0) {
51
- console.log(`🔑 Auto-detected ${autoSecrets.length} secret(s) from .env: ${autoSecrets.join(', ')}`);
52
- }
53
-
54
- // Filter .env: move secret keys to .env.local (emulator-only, never deployed)
55
- const { stripped } = filterEnvSecrets(functionsConfig);
56
- if (stripped.length > 0) {
57
- console.log(`🔒 Filtered ${stripped.length} secret(s) from .env → .env.local`);
58
- }
59
-
60
- // Log bundle info if metafile is available
61
- if (result.metafile) {
62
- const { analyzeMetafile } = await import('esbuild');
63
- const analysis = await analyzeMetafile(result.metafile);
64
- console.log('\n📊 Bundle analysis:');
65
- console.log(analysis);
66
- }
67
-
68
- } catch (error) {
69
- console.error('❌ Build failed:', error);
70
- process.exit(1);
71
- }
72
- }
73
-
74
- // Run the build
75
- buildFunctions();
5
+ buildFunctions(functionsConfig);
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
2
+ "extends": "../../../../tsconfig.functions.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "./lib",
5
5
  "rootDir": "./src",
@@ -14,7 +14,7 @@
14
14
 
15
15
  export const functionsConfig = {
16
16
  defaults: {
17
- region: ['us-central1'],
17
+ region: ['{{YOUR_REGION}}'],
18
18
  platform: 'gcfv2',
19
19
  labels: { app: '{{APP_NAME}}' },
20
20
  },
@@ -0,0 +1,59 @@
1
+ # For detailed configuration reference documentation, visit:
2
+ # https://supabase.com/docs/guides/local-development/cli/config
3
+ project_id = "{{projectName}}"
4
+
5
+ [api]
6
+ enabled = true
7
+ port = 54321
8
+ schemas = ["public", "graphql_public"]
9
+ extra_search_path = ["public", "extensions"]
10
+ max_rows = 1000
11
+
12
+ [db]
13
+ port = 54322
14
+ shadow_port = 54320
15
+ major_version = 17
16
+
17
+ [db.pooler]
18
+ enabled = false
19
+ port = 54329
20
+ pool_mode = "transaction"
21
+ default_pool_size = 20
22
+ max_client_conn = 100
23
+
24
+ [db.migrations]
25
+ enabled = true
26
+
27
+ [db.seed]
28
+ enabled = true
29
+ sql_paths = ["./seed.sql"]
30
+
31
+ [auth]
32
+ enabled = true
33
+ site_url = "http://127.0.0.1:3000"
34
+ additional_redirect_urls = ["https://127.0.0.1:3000"]
35
+ jwt_expiry = 3600
36
+ enable_refresh_token_rotation = true
37
+ refresh_token_reuse_interval = 10
38
+ enable_signup = true
39
+ enable_anonymous_sign_ins = false
40
+ minimum_password_length = 6
41
+
42
+ [auth.email]
43
+ enable_signup = true
44
+ double_confirm_changes = true
45
+ enable_confirmations = false
46
+
47
+ [storage]
48
+ enabled = true
49
+ file_size_limit = "50MiB"
50
+
51
+ [edge_runtime]
52
+ enabled = true
53
+ policy = "per_worker"
54
+ inspector_port = 8083
55
+
56
+ [analytics]
57
+ enabled = true
58
+ port = 54327
59
+ backend = "postgres"
@@ -0,0 +1,13 @@
1
+ # =============================================================================
2
+ # Supabase Edge Functions — Secret Keys (DO NOT COMMIT)
3
+ # =============================================================================
4
+ # Get these from: https://supabase.com/dashboard > your project > Settings
5
+ #
6
+ # Secret key: Settings > API > service_role key (or "Secret key" on new projects)
7
+ # DB URL: Settings > Database > Connection string > URI
8
+ #
9
+ # These are SERVER-SIDE ONLY. Never expose in client code.
10
+ # =============================================================================
11
+
12
+ SUPABASE_SECRET_KEY=
13
+ SUPABASE_DB_URL=
@@ -0,0 +1,7 @@
1
+ // supabase/functions/cancel-subscription/index.ts
2
+ // Supabase Edge Function — Cancel Subscription
3
+ // Deploy: supabase functions deploy cancel-subscription
4
+
5
+ import { createCancelSubscription } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createCancelSubscription());
@@ -0,0 +1,11 @@
1
+ // supabase/functions/change-plan/index.ts
2
+ // Supabase Edge Function — Change Subscription Plan
3
+ // Deploy: supabase functions deploy change-plan
4
+
5
+ import { createChangePlan } from '@donotdev/functions/supabase';
6
+
7
+ // Import your billing config
8
+ // import { billingConfig } from '../_shared/billingConfig.ts';
9
+ const billingConfig = {}; // TODO: Replace with your StripeBackConfig
10
+
11
+ Deno.serve(createChangePlan(billingConfig));
@@ -0,0 +1,11 @@
1
+ // supabase/functions/create-checkout-session/index.ts
2
+ // Supabase Edge Function — Stripe Checkout Session
3
+ // Deploy: supabase functions deploy create-checkout-session
4
+
5
+ import { createCheckoutSession } from '@donotdev/functions/supabase';
6
+
7
+ // Import your billing config
8
+ // import { billingConfig } from '../_shared/billingConfig.ts';
9
+ const billingConfig = {}; // TODO: Replace with your StripeBackConfig
10
+
11
+ Deno.serve(createCheckoutSession(billingConfig));
@@ -0,0 +1,7 @@
1
+ // supabase/functions/create-customer-portal/index.ts
2
+ // Supabase Edge Function — Stripe Customer Portal
3
+ // Deploy: supabase functions deploy create-customer-portal
4
+
5
+ import { createCustomerPortal } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createCustomerPortal());
@@ -0,0 +1,16 @@
1
+ // supabase/functions/crud/index.ts
2
+ // Supabase Edge Function — CRUD Operations
3
+ // Deploy: supabase functions deploy crud
4
+ //
5
+ // This single Edge Function handles all CRUD operations for all entities.
6
+ // The SupabaseCallableProvider automatically routes CRUD calls here.
7
+
8
+ import { createSupabaseCrudFunctions } from '@donotdev/functions/supabase';
9
+
10
+ // Import your entities
11
+ // import * as entities from '../_shared/entities.ts';
12
+ const entities = {}; // TODO: Replace with your entity imports
13
+
14
+ const { serve } = createSupabaseCrudFunctions(entities);
15
+
16
+ Deno.serve(serve);
@@ -0,0 +1,7 @@
1
+ // supabase/functions/delete-account/index.ts
2
+ // Supabase Edge Function — Account Deletion
3
+ // Deploy: supabase functions deploy delete-account
4
+
5
+ import { createDeleteAccount } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createDeleteAccount());
@@ -0,0 +1,8 @@
1
+ {
2
+ "imports": {
3
+ "@donotdev/functions/supabase": "npm:@donotdev/functions/supabase",
4
+ "@donotdev/core/server": "npm:@donotdev/core/server",
5
+ "@supabase/supabase-js": "npm:@supabase/supabase-js",
6
+ "valibot": "npm:valibot"
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ // supabase/functions/get-custom-claims/index.ts
2
+ // Supabase Edge Function — Get Custom Claims (app_metadata)
3
+ // Deploy: supabase functions deploy get-custom-claims
4
+
5
+ import { createGetCustomClaims } from '@donotdev/functions/supabase';
6
+
7
+ Deno.serve(createGetCustomClaims());