@donotdev/cli 0.0.37 → 0.1.1
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.
- package/LICENSE.md +21 -48
- package/dependencies-matrix.json +108 -58
- package/dist/bin/commands/agent-setup.js +7196 -123
- package/dist/bin/commands/build.js +3341 -207
- package/dist/bin/commands/bump.js +268 -24
- package/dist/bin/commands/cacheout.js +262 -13
- package/dist/bin/commands/coach.js +365 -61
- package/dist/bin/commands/create-app.js +261 -14
- package/dist/bin/commands/create-project.js +270 -15
- package/dist/bin/commands/db.js +10743 -2346
- package/dist/bin/commands/deploy.js +4202 -776
- package/dist/bin/commands/dev.js +353 -38
- package/dist/bin/commands/doctor.js +412 -108
- package/dist/bin/commands/emu.js +392 -57
- package/dist/bin/commands/format.js +250 -15
- package/dist/bin/commands/get-demo.js +261 -14
- package/dist/bin/commands/make-admin.js +10022 -1552
- package/dist/bin/commands/preview.js +353 -38
- package/dist/bin/commands/seed.js +10743 -2346
- package/dist/bin/commands/setup-cicd.js +456 -133
- package/dist/bin/commands/setup.js +428 -125
- package/dist/bin/commands/staging.js +4202 -776
- package/dist/bin/commands/sync-secrets.js +250 -14
- package/dist/bin/commands/type-check.js +249 -13
- package/dist/bin/commands/wai.js +249 -13
- package/dist/bin/dndev.js +33 -4
- package/dist/bin/donotdev.js +33 -4
- package/dist/index.js +4278 -856
- package/{templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example → guidelines/VERSION_CONTROL.md} +7 -11
- package/package.json +3 -2
- package/templates/app-demo/src/themes.css.example +21 -0
- package/templates/app-dndev/index.html.example +0 -3
- package/templates/app-dndev/src/themes.css.example +21 -0
- package/templates/app-next/src/app/layout.tsx.example +13 -4
- package/templates/app-next/src/themes.css.example +21 -0
- package/templates/app-vite/csp.example.json +44 -0
- package/templates/app-vite/index.html.example +0 -3
- package/templates/app-vite/src/themes.css.example +21 -0
- package/templates/functions-supabase/supabase/functions/.env.example +12 -0
- package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/migrations/20250101000000_idempotency.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000001_rate_limits.sql +3 -0
- package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql +3 -0
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
- package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
- package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
- package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
- package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
- package/templates/root-consumer/.claude/hooks/framework-compliance.sh.example +56 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +61 -0
- package/templates/root-consumer/.claude/hooks/guard-files.sh.example +46 -0
- package/templates/root-consumer/.claude/hooks/guard-mcp.sh.example +91 -0
- package/templates/root-consumer/.claude/hooks/guard-secrets.sh.example +67 -0
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +89 -0
- package/templates/root-consumer/.claude/hooks/session-start.sh.example +50 -0
- package/templates/root-consumer/.claude/hooks/track-mcp-lookup.sh.example +20 -0
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +18 -0
- package/templates/root-consumer/.claude/rules/consumer-ux.md.example +32 -0
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +32 -0
- package/templates/root-consumer/.claude/rules/framework.md.example +39 -0
- package/templates/root-consumer/.claude/rules/git.md.example +14 -0
- package/templates/root-consumer/.claude/rules/security.md.example +13 -0
- package/templates/root-consumer/.claude/settings.json.example +123 -1
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +103 -25
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +33 -16
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +50 -37
- package/templates/root-consumer/AI.md.example +2 -2
- package/templates/root-consumer/CLAUDE.md.example +33 -1
- package/templates/root-consumer/guides/dndev/INDEX.md.example +23 -27
- package/templates/root-consumer/guides/dndev/SETUP_AUTH.md.example +3 -2
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +12 -6
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +50 -3
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +13 -15
- package/templates/app-demo/public/manifest.json.example +0 -10
- package/templates/app-dndev/public/manifest.json.example +0 -10
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +0 -147
- package/templates/root-consumer/.claude/commands/build.md.example +0 -131
- package/templates/root-consumer/.claude/commands/design.md.example +0 -153
- package/templates/root-consumer/.claude/commands/grill.md.example +0 -108
- package/templates/root-consumer/.claude/commands/polish.md.example +0 -146
- package/templates/root-consumer/.claude/commands/techdebt.md.example +0 -28
- package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +0 -180
- package/templates/root-consumer/guides/dndev/COMPONENTS_CRUD.md.example +0 -234
- package/templates/root-consumer/guides/dndev/COMPONENTS_UI.md.example +0 -136
- package/templates/root-consumer/guides/dndev/COMPONENT_API.md.example +0 -195
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +0 -219
- package/templates/root-consumer/guides/dndev/GOTCHAS.md.example +0 -197
- package/templates/root-consumer/guides/dndev/SETUP_APP_CONFIG.md.example +0 -132
- package/templates/root-consumer/guides/dndev/SETUP_BLOG.md.example +0 -280
- package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +0 -115
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +0 -334
- package/templates/root-consumer/guides/dndev/SETUP_FUNCTIONS.md.example +0 -9
- package/templates/root-consumer/guides/dndev/SETUP_I18N.md.example +0 -233
- package/templates/root-consumer/guides/dndev/SETUP_LAYOUTS.md.example +0 -158
- package/templates/root-consumer/guides/dndev/SETUP_PAGES.md.example +0 -205
- package/templates/root-consumer/guides/dndev/SETUP_PWA.md.example +0 -213
- package/templates/root-consumer/guides/dndev/SETUP_TESTING.md.example +0 -184
- package/templates/root-consumer/guides/dndev/SETUP_THEMES.md.example +0 -111
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +0 -260
- package/templates/root-consumer/guides/dndev/USE_ROUTING.md.example +0 -499
- package/templates/root-consumer/guides/dndev/essences_reference.css.example +0 -288
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Version Control
|
|
1
|
+
# Version Control
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
How to upgrade DoNotDev framework packages in consumer projects.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -26,22 +26,22 @@ dndev bump --dry-run
|
|
|
26
26
|
**Patch versions (0.0.x):**
|
|
27
27
|
- Handled automatically by `bun install`
|
|
28
28
|
- No action needed - `^` ranges allow automatic patch updates
|
|
29
|
-
- Example: `^0.0.2`
|
|
29
|
+
- Example: `^0.0.2` - `0.0.3`, `0.0.4`, etc.
|
|
30
30
|
|
|
31
31
|
**Minor versions (0.x.y):**
|
|
32
32
|
- Handled automatically by `dndev bump`
|
|
33
33
|
- **RISK FREE:** All changes are backward compatible via deprecation
|
|
34
34
|
- No breaking changes in 0.x.y range
|
|
35
|
-
- Example: `^0.0.2`
|
|
35
|
+
- Example: `^0.0.2` - `^0.1.0` (auto-updated, safe)
|
|
36
36
|
|
|
37
37
|
### Manual Validation Required
|
|
38
38
|
|
|
39
|
-
**Major versions (0.*.*
|
|
39
|
+
**Major versions (0.*.* - 1.x.y):**
|
|
40
40
|
- `dndev bump` detects major version changes
|
|
41
41
|
- Shows migration guide with breaking changes
|
|
42
42
|
- **You must validate manually** before updating
|
|
43
43
|
- **Only place where breaking changes occur**
|
|
44
|
-
- Example: `^0.1.0`
|
|
44
|
+
- Example: `^0.1.0` - `^1.0.0` (requires validation)
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -126,7 +126,7 @@ When upgrading major versions, migration guides are provided:
|
|
|
126
126
|
|
|
127
127
|
**Example:**
|
|
128
128
|
```
|
|
129
|
-
|
|
129
|
+
Warning: Major version update detected: @donotdev/core 0.1.0 - 1.0.0
|
|
130
130
|
|
|
131
131
|
Migration guide: docs/migration/v0.1-to-v1.0.md
|
|
132
132
|
|
|
@@ -168,7 +168,3 @@ Review the migration guide before updating.
|
|
|
168
168
|
3. **Review major changes:** Always read migration guides for major versions
|
|
169
169
|
4. **Use `--dry-run`:** Preview changes before applying
|
|
170
170
|
5. **Commit changes:** Commit updated `package.json` files after successful updates
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
**Keep your dependencies up to date. Stay secure. Stay compatible.**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Command-line interface for DoNotDev Framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
21
21
|
"templates",
|
|
22
|
+
"guidelines",
|
|
22
23
|
"dependencies-matrix.json",
|
|
23
24
|
"README.md",
|
|
24
25
|
"LICENSE.md"
|
|
@@ -50,7 +51,7 @@
|
|
|
50
51
|
"scaffolding"
|
|
51
52
|
],
|
|
52
53
|
"author": "AMBROISE PARK Consulting",
|
|
53
|
-
"license": "
|
|
54
|
+
"license": "MIT",
|
|
54
55
|
"engines": {
|
|
55
56
|
"node": ">=20.0.0"
|
|
56
57
|
},
|
|
@@ -332,3 +332,24 @@
|
|
|
332
332
|
background: transparent;
|
|
333
333
|
box-shadow: none;
|
|
334
334
|
}
|
|
335
|
+
|
|
336
|
+
/* ===========================
|
|
337
|
+
INTERACTION EFFECTS
|
|
338
|
+
Micro-interactions for buttons. Set to 0/1 to disable.
|
|
339
|
+
=========================== */
|
|
340
|
+
/*
|
|
341
|
+
:root {
|
|
342
|
+
--hover-lift: -2px;
|
|
343
|
+
--click-scale: 0.97;
|
|
344
|
+
--ripple-opacity: 0.2;
|
|
345
|
+
}
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
/* Disable all effects (flat/minimal style) */
|
|
349
|
+
/*
|
|
350
|
+
:root {
|
|
351
|
+
--hover-lift: 0;
|
|
352
|
+
--click-scale: 1;
|
|
353
|
+
--ripple-opacity: 0;
|
|
354
|
+
}
|
|
355
|
+
*/
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
<!-- ✅ DnDev: Asset manifest injection point -->
|
|
14
14
|
<!-- window.__DNDEV_ASSETS__ and __DNDEV_ASSET_MANIFEST__ injected here -->
|
|
15
15
|
|
|
16
|
-
<!-- ✅ PWA: Manifest link (if exists) -->
|
|
17
|
-
<link rel="manifest" href="/manifest.json" />
|
|
18
|
-
|
|
19
16
|
<!-- Fonts: Inter, Space Grotesk, Playfair, Roboto loaded via @donotdev/ui/dndev.css (bundled). -->
|
|
20
17
|
<!-- DNDEV_FONT_PRELOADS -->
|
|
21
18
|
|
|
@@ -156,6 +156,27 @@
|
|
|
156
156
|
--radius-floating: 0.5rem;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
/* ===========================
|
|
160
|
+
INTERACTION EFFECTS
|
|
161
|
+
Micro-interactions for buttons. Set to 0/1 to disable.
|
|
162
|
+
=========================== */
|
|
163
|
+
/*
|
|
164
|
+
:root {
|
|
165
|
+
--hover-lift: -2px;
|
|
166
|
+
--click-scale: 0.97;
|
|
167
|
+
--ripple-opacity: 0.2;
|
|
168
|
+
}
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/* Disable all effects (flat/minimal style) */
|
|
172
|
+
/*
|
|
173
|
+
:root {
|
|
174
|
+
--hover-lift: 0;
|
|
175
|
+
--click-scale: 1;
|
|
176
|
+
--ripple-opacity: 0;
|
|
177
|
+
}
|
|
178
|
+
*/
|
|
179
|
+
|
|
159
180
|
/* ===========================
|
|
160
181
|
CUSTOM THEMES
|
|
161
182
|
Add your brand themes below (same pattern: class + --theme-label, --theme-icon, --theme-is-dark).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Metadata } from 'next';
|
|
2
2
|
|
|
3
|
+
import { getMetadataForPath } from '@donotdev/core/next';
|
|
3
4
|
import { FontPreloadLinks } from '@donotdev/ui/next';
|
|
4
5
|
|
|
5
6
|
import '../globals.css';
|
|
@@ -10,10 +11,18 @@ import { ClientLayout } from './ClientLayout';
|
|
|
10
11
|
* Font preload links are injected at build time; FontPreloadLinks reads the manifest for SSR.
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Dynamic metadata generation from PageMeta exports.
|
|
16
|
+
* Same PageMeta convention works in Vite (AutoMetaTags) and Next.js (this function).
|
|
17
|
+
* Priority: i18n meta.fullTitle > seo.fullTitle > i18n title | siteName > siteName
|
|
18
|
+
*
|
|
19
|
+
* For dynamic pages with runtime data, use <Seo> component instead.
|
|
20
|
+
*/
|
|
21
|
+
export async function generateMetadata(): Promise<Metadata> {
|
|
22
|
+
// Root layout handles the home page metadata
|
|
23
|
+
// Other pages override via their own generateMetadata or <Seo> component
|
|
24
|
+
return getMetadataForPath('/');
|
|
25
|
+
}
|
|
17
26
|
|
|
18
27
|
/**
|
|
19
28
|
* Root layout for Next.js App Router
|
|
@@ -125,6 +125,27 @@
|
|
|
125
125
|
See guides/dndev/essences_reference.css for full .brutalist and .luxury blocks.
|
|
126
126
|
=========================== */
|
|
127
127
|
|
|
128
|
+
/* ===========================
|
|
129
|
+
INTERACTION EFFECTS
|
|
130
|
+
Micro-interactions for buttons. Set to 0/1 to disable.
|
|
131
|
+
=========================== */
|
|
132
|
+
/*
|
|
133
|
+
:root {
|
|
134
|
+
--hover-lift: -2px;
|
|
135
|
+
--click-scale: 0.97;
|
|
136
|
+
--ripple-opacity: 0.2;
|
|
137
|
+
}
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/* Disable all effects (flat/minimal style) */
|
|
141
|
+
/*
|
|
142
|
+
:root {
|
|
143
|
+
--hover-lift: 0;
|
|
144
|
+
--click-scale: 1;
|
|
145
|
+
--ripple-opacity: 0;
|
|
146
|
+
}
|
|
147
|
+
*/
|
|
148
|
+
|
|
128
149
|
/* ===========================
|
|
129
150
|
CUSTOM THEMES
|
|
130
151
|
=========================== */
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Content Security Policy baseline for DoNotDev apps. Copy the relevant directives into your hosting config (vercel.json headers, netlify _headers, etc.).",
|
|
3
|
+
|
|
4
|
+
"default-src": "'self'",
|
|
5
|
+
"script-src": "'self'",
|
|
6
|
+
"style-src": "'self' 'unsafe-inline'",
|
|
7
|
+
"img-src": "'self' data: blob: https:",
|
|
8
|
+
"font-src": "'self' https://fonts.gstatic.com",
|
|
9
|
+
"object-src": "'none'",
|
|
10
|
+
"base-uri": "'self'",
|
|
11
|
+
"form-action": "'self'",
|
|
12
|
+
|
|
13
|
+
"_supabase": {
|
|
14
|
+
"_comment": "Add these if your app uses Supabase",
|
|
15
|
+
"connect-src": "'self' https://*.supabase.co wss://*.supabase.co",
|
|
16
|
+
"frame-src": "https://*.supabase.co"
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
"_firebase": {
|
|
20
|
+
"_comment": "Add these if your app uses Firebase",
|
|
21
|
+
"connect-src": "'self' https://*.firebaseio.com https://*.googleapis.com wss://*.firebaseio.com",
|
|
22
|
+
"frame-src": "https://*.firebaseapp.com"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
"_google_maps": {
|
|
26
|
+
"_comment": "Add these if your app uses Google Maps (AddressField)",
|
|
27
|
+
"script-src": "'self' https://maps.googleapis.com",
|
|
28
|
+
"connect-src": "'self' https://maps.googleapis.com",
|
|
29
|
+
"img-src": "'self' data: blob: https: https://*.googleapis.com https://*.gstatic.com"
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
"_google_oauth": {
|
|
33
|
+
"_comment": "Add these if your app uses Google OAuth",
|
|
34
|
+
"connect-src": "'self' https://accounts.google.com https://oauth2.googleapis.com https://www.googleapis.com",
|
|
35
|
+
"frame-src": "https://accounts.google.com"
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
"_rules": [
|
|
39
|
+
"NEVER mix 'none' with URLs in the same directive (e.g., frame-src 'none' https://... is invalid)",
|
|
40
|
+
"NEVER use 'unsafe-eval' — Vite HMR works without it in dev, production never needs it",
|
|
41
|
+
"Merge connect-src values from all providers you use into a single directive",
|
|
42
|
+
"credentials: 'omit' is set by the framework on cross-origin fetches — CSP does not need to allow cookies for these"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
<!-- ✅ DnDev: Asset manifest injection point -->
|
|
14
14
|
<!-- window.__DNDEV_ASSETS__ and __DNDEV_ASSET_MANIFEST__ injected here -->
|
|
15
15
|
|
|
16
|
-
<!-- ✅ PWA: Manifest link (if exists) -->
|
|
17
|
-
<link rel="manifest" href="/manifest.json" />
|
|
18
|
-
|
|
19
16
|
<!-- Fonts: Inter, Space Grotesk, Playfair, Roboto loaded via @donotdev/ui/dndev.css (bundled). -->
|
|
20
17
|
<!-- DNDEV_FONT_PRELOADS -->
|
|
21
18
|
|
|
@@ -156,6 +156,27 @@
|
|
|
156
156
|
--radius-floating: 0.5rem;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
/* ===========================
|
|
160
|
+
INTERACTION EFFECTS
|
|
161
|
+
Micro-interactions for buttons. Set to 0/1 to disable.
|
|
162
|
+
=========================== */
|
|
163
|
+
/*
|
|
164
|
+
:root {
|
|
165
|
+
--hover-lift: -2px;
|
|
166
|
+
--click-scale: 0.97;
|
|
167
|
+
--ripple-opacity: 0.2;
|
|
168
|
+
}
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/* Disable all effects (flat/minimal style) */
|
|
172
|
+
/*
|
|
173
|
+
:root {
|
|
174
|
+
--hover-lift: 0;
|
|
175
|
+
--click-scale: 1;
|
|
176
|
+
--ripple-opacity: 0;
|
|
177
|
+
}
|
|
178
|
+
*/
|
|
179
|
+
|
|
159
180
|
/* ===========================
|
|
160
181
|
CUSTOM THEMES
|
|
161
182
|
Add your brand themes below (same pattern: class + --theme-label, --theme-icon, --theme-is-dark).
|
|
@@ -9,3 +9,15 @@
|
|
|
9
9
|
# =============================================================================
|
|
10
10
|
|
|
11
11
|
SUPABASE_SECRET_KEY=
|
|
12
|
+
|
|
13
|
+
# =============================================================================
|
|
14
|
+
# OAuth Provider Credentials (server-side only)
|
|
15
|
+
# =============================================================================
|
|
16
|
+
# Add credentials for each OAuth provider you use.
|
|
17
|
+
# Get these from each provider's developer console.
|
|
18
|
+
# =============================================================================
|
|
19
|
+
|
|
20
|
+
# OAUTH_GITHUB_CLIENT_ID=
|
|
21
|
+
# OAUTH_GITHUB_CLIENT_SECRET=
|
|
22
|
+
# OAUTH_GOOGLE_CLIENT_ID=
|
|
23
|
+
# OAUTH_GOOGLE_CLIENT_SECRET=
|
|
@@ -13,6 +13,9 @@ CREATE TABLE IF NOT EXISTS idempotency (
|
|
|
13
13
|
expires_at TIMESTAMPTZ NOT NULL -- TTL for cleanup (default: 24h)
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
+
-- Only service_role accesses this table; lock out anon/authenticated keys
|
|
17
|
+
ALTER TABLE idempotency ENABLE ROW LEVEL SECURITY;
|
|
18
|
+
|
|
16
19
|
-- Indexes for efficient lookups
|
|
17
20
|
CREATE INDEX IF NOT EXISTS idx_idempotency_expires ON idempotency(expires_at);
|
|
18
21
|
CREATE INDEX IF NOT EXISTS idx_idempotency_key ON idempotency(idempotency_key);
|
|
@@ -11,6 +11,9 @@ CREATE TABLE IF NOT EXISTS rate_limits (
|
|
|
11
11
|
last_updated TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
12
12
|
);
|
|
13
13
|
|
|
14
|
+
-- Only service_role accesses this table; lock out anon/authenticated keys
|
|
15
|
+
ALTER TABLE rate_limits ENABLE ROW LEVEL SECURITY;
|
|
16
|
+
|
|
14
17
|
-- Indexes for efficient lookups and cleanup
|
|
15
18
|
CREATE INDEX IF NOT EXISTS idx_rate_limits_window ON rate_limits(window_start);
|
|
16
19
|
CREATE INDEX IF NOT EXISTS idx_rate_limits_block ON rate_limits(block_until) WHERE block_until IS NOT NULL;
|
package/templates/functions-supabase/supabase/migrations/20250101000003_operation_metrics.sql
CHANGED
|
@@ -15,6 +15,9 @@ CREATE TABLE IF NOT EXISTS operation_metrics (
|
|
|
15
15
|
error_message TEXT -- If status = 'failed'
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
+
-- Only service_role accesses this table; lock out anon/authenticated keys
|
|
19
|
+
ALTER TABLE operation_metrics ENABLE ROW LEVEL SECURITY;
|
|
20
|
+
|
|
18
21
|
-- Indexes for efficient queries
|
|
19
22
|
CREATE INDEX IF NOT EXISTS idx_metrics_operation ON operation_metrics(operation, timestamp DESC);
|
|
20
23
|
CREATE INDEX IF NOT EXISTS idx_metrics_user ON operation_metrics(user_id, timestamp DESC) WHERE user_id IS NOT NULL;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Admin Dashboard - Overview with stats, activity, and quick actions.
|
|
3
|
+
*
|
|
4
|
+
* Replace mock data with real data from your backend.
|
|
5
|
+
* Connect stats to useCrudList or custom hooks for live metrics.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
LayoutDashboard,
|
|
12
|
+
Users,
|
|
13
|
+
DollarSign,
|
|
14
|
+
FolderOpen,
|
|
15
|
+
TrendingUp,
|
|
16
|
+
UserPlus,
|
|
17
|
+
BarChart3,
|
|
18
|
+
Settings,
|
|
19
|
+
Download,
|
|
20
|
+
Clock,
|
|
21
|
+
CheckCircle,
|
|
22
|
+
AlertCircle,
|
|
23
|
+
XCircle,
|
|
24
|
+
} from 'lucide-react';
|
|
25
|
+
|
|
26
|
+
import { Section, Card, Grid, Stack, Text, Badge, List } from '@donotdev/components';
|
|
27
|
+
import { useTranslation } from '@donotdev/core';
|
|
28
|
+
import type { PageMeta } from '@donotdev/core';
|
|
29
|
+
import { useAuth } from '@donotdev/auth';
|
|
30
|
+
import { PageContainer, Link } from '@donotdev/ui';
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// PAGE METADATA
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
export const NAMESPACE = 'dashboard';
|
|
37
|
+
|
|
38
|
+
export const meta: PageMeta = {
|
|
39
|
+
namespace: NAMESPACE,
|
|
40
|
+
icon: <LayoutDashboard />,
|
|
41
|
+
auth: { required: true, role: 'admin' },
|
|
42
|
+
preset: 'admin',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// ============================================================================
|
|
46
|
+
// MOCK DATA - Replace with real data hooks
|
|
47
|
+
// ============================================================================
|
|
48
|
+
|
|
49
|
+
const stats = [
|
|
50
|
+
{
|
|
51
|
+
title: 'Total Users',
|
|
52
|
+
value: '2,847',
|
|
53
|
+
trend: '+12.5% from last month',
|
|
54
|
+
icon: <Users />,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
title: 'Revenue',
|
|
58
|
+
value: '$48,290',
|
|
59
|
+
trend: '+8.2% from last month',
|
|
60
|
+
icon: <DollarSign />,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: 'Active Projects',
|
|
64
|
+
value: '184',
|
|
65
|
+
trend: '+3 new this week',
|
|
66
|
+
icon: <FolderOpen />,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
title: 'Conversion',
|
|
70
|
+
value: '3.24%',
|
|
71
|
+
trend: '+0.4% from last month',
|
|
72
|
+
icon: <TrendingUp />,
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const recentActivity = [
|
|
77
|
+
{ text: 'New user registered: alice@example.com', status: 'success', time: '2 min ago' },
|
|
78
|
+
{ text: 'Payment received: $199.00 from Acme Corp', status: 'success', time: '15 min ago' },
|
|
79
|
+
{ text: 'Failed login attempt: bob@example.com', status: 'error', time: '32 min ago' },
|
|
80
|
+
{ text: 'Project "Dashboard Redesign" updated', status: 'info', time: '1 hour ago' },
|
|
81
|
+
{ text: 'Export completed: Q1 Financial Report', status: 'success', time: '2 hours ago' },
|
|
82
|
+
{ text: 'System backup completed successfully', status: 'info', time: '3 hours ago' },
|
|
83
|
+
{ text: 'API rate limit warning: 85% capacity', status: 'warning', time: '4 hours ago' },
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
const quickActions = [
|
|
87
|
+
{ title: 'Add User', icon: <UserPlus />, path: '/users/new' },
|
|
88
|
+
{ title: 'View Reports', icon: <BarChart3 />, path: '/reports' },
|
|
89
|
+
{ title: 'System Settings', icon: <Settings />, path: '/settings' },
|
|
90
|
+
{ title: 'Export Data', icon: <Download />, path: '/reports' },
|
|
91
|
+
];
|
|
92
|
+
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// STATUS BADGE HELPER
|
|
95
|
+
// ============================================================================
|
|
96
|
+
|
|
97
|
+
function statusBadge(status: string) {
|
|
98
|
+
const variants: Record<string, string> = {
|
|
99
|
+
success: 'success',
|
|
100
|
+
error: 'destructive',
|
|
101
|
+
warning: 'warning',
|
|
102
|
+
info: 'default',
|
|
103
|
+
};
|
|
104
|
+
return <Badge variant={variants[status] || 'default'}>{status}</Badge>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// ============================================================================
|
|
108
|
+
// PAGE COMPONENT
|
|
109
|
+
// ============================================================================
|
|
110
|
+
|
|
111
|
+
export default function DashboardPage() {
|
|
112
|
+
const { t } = useTranslation(NAMESPACE);
|
|
113
|
+
const user = useAuth('user');
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<PageContainer>
|
|
117
|
+
{/* Welcome */}
|
|
118
|
+
<Section title={`${t('welcome')}, ${user?.displayName || t('admin')}`}>
|
|
119
|
+
<Text level="body">
|
|
120
|
+
{t('dashboardOverview', { appName: '{{appName}}' })}
|
|
121
|
+
</Text>
|
|
122
|
+
</Section>
|
|
123
|
+
|
|
124
|
+
{/* Stats Row */}
|
|
125
|
+
<Section title={t('overview')}>
|
|
126
|
+
<Grid cols={[1, 2, 4, 4]} gap="medium">
|
|
127
|
+
{stats.map((stat) => (
|
|
128
|
+
<Card
|
|
129
|
+
key={stat.title}
|
|
130
|
+
icon={stat.icon}
|
|
131
|
+
title={stat.title}
|
|
132
|
+
content={[stat.value, stat.trend]}
|
|
133
|
+
elevated
|
|
134
|
+
/>
|
|
135
|
+
))}
|
|
136
|
+
</Grid>
|
|
137
|
+
</Section>
|
|
138
|
+
|
|
139
|
+
{/* Recent Activity */}
|
|
140
|
+
<Section title={t('recentActivity')}>
|
|
141
|
+
<Stack gap="tight">
|
|
142
|
+
{recentActivity.map((activity, index) => (
|
|
143
|
+
<Card
|
|
144
|
+
key={index}
|
|
145
|
+
content={
|
|
146
|
+
<Stack direction="row" align="center" justify="space-between">
|
|
147
|
+
<Stack direction="row" align="center" gap="medium">
|
|
148
|
+
{statusBadge(activity.status)}
|
|
149
|
+
<Text level="body">{activity.text}</Text>
|
|
150
|
+
</Stack>
|
|
151
|
+
<Text level="small" variant="muted">{activity.time}</Text>
|
|
152
|
+
</Stack>
|
|
153
|
+
}
|
|
154
|
+
/>
|
|
155
|
+
))}
|
|
156
|
+
</Stack>
|
|
157
|
+
</Section>
|
|
158
|
+
|
|
159
|
+
{/* Quick Actions */}
|
|
160
|
+
<Section title={t('quickActions')}>
|
|
161
|
+
<Grid cols={[2, 2, 4, 4]} gap="medium">
|
|
162
|
+
{quickActions.map((action) => (
|
|
163
|
+
<Link key={action.title} path={action.path}>
|
|
164
|
+
<Card
|
|
165
|
+
icon={action.icon}
|
|
166
|
+
title={action.title}
|
|
167
|
+
clickable
|
|
168
|
+
elevated
|
|
169
|
+
/>
|
|
170
|
+
</Link>
|
|
171
|
+
))}
|
|
172
|
+
</Grid>
|
|
173
|
+
</Section>
|
|
174
|
+
</PageContainer>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// ============================================================================
|
|
179
|
+
// i18n KEYS NEEDED (add to locales/dashboard_en.json)
|
|
180
|
+
// ============================================================================
|
|
181
|
+
//
|
|
182
|
+
// {
|
|
183
|
+
// "welcome": "Welcome back",
|
|
184
|
+
// "admin": "Admin",
|
|
185
|
+
// "dashboardOverview": "Here's what's happening with {{appName}} today.",
|
|
186
|
+
// "overview": "Overview",
|
|
187
|
+
// "recentActivity": "Recent Activity",
|
|
188
|
+
// "quickActions": "Quick Actions"
|
|
189
|
+
// }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Generic CRUD Entity Management Page
|
|
3
|
+
*
|
|
4
|
+
* COPY THIS FILE for each entity you want to manage in the admin panel.
|
|
5
|
+
* Rename the file and component to match your entity (e.g., ProductsPage, OrdersPage).
|
|
6
|
+
*
|
|
7
|
+
* HOW IT WORKS:
|
|
8
|
+
* 1. Import your entity definition
|
|
9
|
+
* 2. EntityList handles everything: data fetching, columns, search, sort,
|
|
10
|
+
* pagination, create/edit/delete actions, and role-based visibility
|
|
11
|
+
* 3. Routing is automatic: edit -> /<entity>/:id, create -> /<entity>/new
|
|
12
|
+
*
|
|
13
|
+
* For the detail/form page, see FormPageExample.tsx.example in app-vite templates.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { Package } from 'lucide-react';
|
|
17
|
+
|
|
18
|
+
import { useAuth } from '@donotdev/auth';
|
|
19
|
+
import type { PageMeta } from '@donotdev/core';
|
|
20
|
+
import { PageContainer, EntityList } from '@donotdev/ui';
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// ENTITY IMPORT
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
// Import your entity from root-level entities folder:
|
|
27
|
+
// import { productEntity } from 'entities/Product';
|
|
28
|
+
|
|
29
|
+
// Placeholder - replace with your entity import
|
|
30
|
+
const yourEntity = null as any;
|
|
31
|
+
|
|
32
|
+
// ============================================================================
|
|
33
|
+
// PAGE METADATA
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
// Change NAMESPACE to match your entity (e.g., 'products', 'orders', 'customers')
|
|
37
|
+
export const NAMESPACE = 'entities';
|
|
38
|
+
|
|
39
|
+
export const meta: PageMeta = {
|
|
40
|
+
namespace: NAMESPACE,
|
|
41
|
+
icon: <Package />,
|
|
42
|
+
route: '/entities', // Change to your entity route (e.g., '/products')
|
|
43
|
+
auth: { required: true, role: 'admin' },
|
|
44
|
+
preset: 'admin',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// PAGE COMPONENT
|
|
49
|
+
// ============================================================================
|
|
50
|
+
|
|
51
|
+
export default function EntityPage() {
|
|
52
|
+
const user = useAuth('user');
|
|
53
|
+
|
|
54
|
+
// EntityList provides zero-config CRUD management:
|
|
55
|
+
// - Fetches data using entity's listFields (optimized query)
|
|
56
|
+
// - Renders columns based on field definitions
|
|
57
|
+
// - Applies visibility rules based on user role
|
|
58
|
+
// - Includes search, sort, pagination
|
|
59
|
+
// - Add/Edit/Delete buttons with proper permissions
|
|
60
|
+
// - Automatic routing to detail/form pages
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<PageContainer>
|
|
64
|
+
<EntityList
|
|
65
|
+
entity={yourEntity}
|
|
66
|
+
userRole={user?.role}
|
|
67
|
+
/>
|
|
68
|
+
</PageContainer>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// NEXT STEPS
|
|
74
|
+
// ============================================================================
|
|
75
|
+
//
|
|
76
|
+
// 1. Create your entity definition in src/entities/YourEntity.ts
|
|
77
|
+
// See the entity docs or use WAI-WAY Phase 2 to generate it.
|
|
78
|
+
//
|
|
79
|
+
// 2. Create a detail/form page for create/edit operations.
|
|
80
|
+
// Copy FormPageExample.tsx.example and adapt it.
|
|
81
|
+
//
|
|
82
|
+
// 3. Update NAMESPACE, meta.route, and meta.icon to match your entity.
|
|
83
|
+
//
|
|
84
|
+
// 4. Add i18n keys for your entity labels and field names.
|