@donotdev/cli 0.0.20 → 0.0.21
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/README.md +31 -0
- package/dependencies-matrix.json +86 -19
- package/dist/bin/commands/agent-setup.js +2 -2
- package/dist/bin/commands/build.js +6 -6
- package/dist/bin/commands/bump.js +491 -69
- package/dist/bin/commands/cacheout.js +6 -6
- package/dist/bin/commands/coach.js +6 -6
- package/dist/bin/commands/create-app.js +23 -15
- package/dist/bin/commands/create-project.js +101 -16
- package/dist/bin/commands/db.js +142136 -0
- package/dist/bin/commands/deploy.js +336 -126
- package/dist/bin/commands/dev.js +6 -6
- package/dist/bin/commands/doctor.js +140 -33
- package/dist/bin/commands/emu.js +6 -6
- package/dist/bin/commands/format.js +6 -6
- package/dist/bin/commands/get-demo.js +11 -6
- package/dist/bin/commands/make-admin.js +14210 -13770
- package/dist/bin/commands/preview.js +6 -6
- package/dist/bin/commands/seed.js +142426 -0
- package/dist/bin/commands/setup-cicd.js +8904 -0
- package/dist/bin/commands/setup.js +256 -212
- package/dist/bin/commands/staging.js +343 -127
- package/dist/bin/commands/sync-secrets.js +55 -33
- package/dist/bin/commands/type-check.js +6 -6
- package/dist/bin/commands/wai.js +6 -6
- package/dist/bin/dndev.js +76 -11
- package/dist/bin/donotdev.js +21 -12
- package/dist/index.js +437 -142
- package/package.json +1 -1
- package/templates/app-demo/.env.example +1 -0
- package/templates/{root-consumer → app-demo}/entities/ExampleEntity.ts.example +15 -9
- package/templates/app-demo/index.html.example +1 -1
- package/templates/app-dndev/index.html.example +164 -0
- package/templates/app-dndev/public/logo.svg.example +1 -0
- package/templates/app-dndev/public/manifest.json.example +10 -0
- package/templates/app-dndev/src/App.tsx.example +35 -0
- package/templates/app-dndev/src/components/CockpitLayout.css.example +181 -0
- package/templates/app-dndev/src/components/CockpitLayout.tsx.example +209 -0
- package/templates/app-dndev/src/components/Kanban.css.example +385 -0
- package/templates/app-dndev/src/components/ModeToggle.tsx.example +32 -0
- package/templates/app-dndev/src/components/OverlaySlot.tsx.example +68 -0
- package/templates/app-dndev/src/components/TerminalPanel.css.example +228 -0
- package/templates/app-dndev/src/components/TerminalPanel.tsx.example +714 -0
- package/templates/app-dndev/src/components/markdown-prose.css.example +49 -0
- package/templates/app-dndev/src/components/phases/CaptainLog.tsx.example +107 -0
- package/templates/app-dndev/src/components/phases/ContextTabs.tsx.example +352 -0
- package/templates/app-dndev/src/components/phases/PhaseCard.tsx.example +126 -0
- package/templates/app-dndev/src/components/phases/PhaseDetail.tsx.example +147 -0
- package/templates/app-dndev/src/components/phases/ReviewPanel.tsx.example +115 -0
- package/templates/app-dndev/src/components/phases/phaseData.ts.example +366 -0
- package/templates/app-dndev/src/config/app.ts.example +103 -0
- package/templates/app-dndev/src/config/commands.ts.example +171 -0
- package/templates/app-dndev/src/config/legal.ts.example +170 -0
- package/templates/app-dndev/src/config/providers.ts.example +7 -0
- package/templates/app-dndev/src/globals.css.example +10 -0
- package/templates/app-dndev/src/hooks/useDndevFile.ts.example +144 -0
- package/templates/app-dndev/src/main.tsx.example +21 -0
- package/templates/app-dndev/src/pages/BoardPage.tsx.example +640 -0
- package/templates/app-dndev/src/pages/GrillPage.tsx.example +658 -0
- package/templates/app-dndev/src/pages/HomePage.tsx.example +347 -0
- package/templates/app-dndev/src/pages/NotFoundPage.tsx.example +33 -0
- package/templates/app-dndev/src/pages/PhasesPage.tsx.example +137 -0
- package/templates/app-dndev/src/pages/SettingsPage.tsx.example +64 -0
- package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +75 -0
- package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +69 -0
- package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +71 -0
- package/templates/app-dndev/src/stores/dndevStore.ts.example +386 -0
- package/templates/app-dndev/src/themes.css.example +161 -0
- package/templates/app-dndev/terminal-sidecar.cjs.example +341 -0
- package/templates/app-dndev/tsconfig.json.example +9 -0
- package/templates/app-dndev/vite.config.ts.example +24 -0
- package/templates/app-next/src/locales/home_en.json.example +6 -6
- package/templates/app-vite/index.html.example +1 -1
- package/templates/app-vite/src/locales/home_en.json.example +6 -6
- package/templates/functions-supabase/supabase/functions/.env.example +0 -2
- package/templates/root-consumer/.claude/commands/grill.md.example +86 -8
- package/templates/root-consumer/.dndev.secrets.example +32 -0
- package/templates/root-consumer/.gitignore.example +3 -0
- package/templates/root-consumer/AI.md.example +4 -0
- package/templates/root-consumer/entities/index.ts.example +2 -5
- package/templates/root-consumer/guides/dndev/COMPONENTS_ATOMIC.md.example +4 -0
- package/templates/root-consumer/guides/dndev/ENV_SETUP.md.example +23 -20
- package/templates/root-consumer/guides/dndev/INDEX.md.example +1 -0
- package/templates/root-consumer/guides/dndev/SETUP_BILLING.md.example +3 -7
- package/templates/root-consumer/guides/dndev/SETUP_CICD.md.example +115 -0
- package/templates/root-consumer/guides/dndev/SETUP_CRUD.md.example +41 -0
- package/templates/root-consumer/guides/dndev/SETUP_SUPABASE.md.example +13 -18
- package/templates/root-consumer/guides/dndev/SETUP_VERCEL.md.example +17 -12
- package/templates/root-consumer/guides/dndev/advanced/COOKIE_REFERENCE.md.example +252 -252
- package/templates/root-consumer/guides/dndev/advanced/VERSION_CONTROL.md.example +174 -174
- package/templates/root-consumer/guides/wai-way/WAI_WAY_CLI.md.example +185 -251
- package/templates/root-consumer/guides/wai-way/agents/extractor.md.example +26 -8
- package/templates/root-consumer/guides/wai-way/blueprints/0_brainstorm.md.example +66 -49
- package/templates/root-consumer/guides/wai-way/blueprints/1_scaffold.md.example +6 -5
- package/templates/root-consumer/guides/wai-way/blueprints/2_entities.md.example +9 -9
- package/templates/root-consumer/guides/wai-way/blueprints/3_compose.md.example +1 -1
- package/templates/root-consumer/guides/wai-way/blueprints/4_configure.md.example +7 -6
- package/templates/root-consumer/guides/wai-way/context_map.json.example +51 -20
- package/templates/root-consumer/guides/wai-way/hld_template.md.example +138 -0
- package/templates/root-consumer/guides/wai-way/lld_template.md.example +103 -0
- package/templates/root-consumer/guides/wai-way/prd_template.md.example +140 -0
- /package/templates/{root-consumer → app-demo}/entities/Contact.ts.example +0 -0
- /package/templates/{root-consumer → app-demo}/entities/demo.ts.example +0 -0
|
@@ -58,9 +58,9 @@ dndev coach
|
|
|
58
58
|
|
|
59
59
|
Prints a numbered checklist: which dashboard to visit, what to copy, where to paste it. No automation, no prompts.
|
|
60
60
|
|
|
61
|
-
### 2. Fill in
|
|
61
|
+
### 2. Fill in credentials
|
|
62
62
|
|
|
63
|
-
Follow the coach checklist. Paste credentials
|
|
63
|
+
Follow the coach checklist. Paste **public** credentials into `apps/<app>/.env`, and **secret** keys into `.dndev.secrets` at project root.
|
|
64
64
|
|
|
65
65
|
### 3. Run setup
|
|
66
66
|
|
|
@@ -126,16 +126,19 @@ These are safe to share, shipped in your client JS bundle. We ask for them durin
|
|
|
126
126
|
| Supabase anon key (public JWT) | `apps/<app>/.env` as `VITE_SUPABASE_ANON_KEY` |
|
|
127
127
|
| Stripe publishable key | `apps/<app>/.env` as `VITE_STRIPE_PUBLISHABLE_KEY` |
|
|
128
128
|
|
|
129
|
-
### Tier 2: Secret Keys --
|
|
129
|
+
### Tier 2: Secret Keys -- One File, Project Root
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
All secret keys go in **`.dndev.secrets`** at project root (gitignored). One file, every secret.
|
|
132
132
|
|
|
133
|
-
| Key |
|
|
134
|
-
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
133
|
+
| Key | How To Get It |
|
|
134
|
+
|-----|---------------|
|
|
135
|
+
| `VERCEL_TOKEN` | https://vercel.com/account/tokens |
|
|
136
|
+
| `SUPABASE_SECRET_KEY` | Supabase Dashboard → Settings → API |
|
|
137
|
+
| `SUPABASE_ACCESS_TOKEN` | https://supabase.com/dashboard/account/tokens |
|
|
138
|
+
| `STRIPE_SECRET_KEY` | https://dashboard.stripe.com/apikeys |
|
|
139
|
+
| `STRIPE_WEBHOOK_SECRET` | Stripe Dashboard → Webhooks |
|
|
140
|
+
|
|
141
|
+
Resolution order: `process.env` (CI) → `.dndev.secrets` (local) → legacy paths (with warning).
|
|
139
142
|
|
|
140
143
|
Then sync to your runtime:
|
|
141
144
|
|
|
@@ -157,25 +160,25 @@ These files are `.gitignored`. Never commit them. For CI/CD, upload the file con
|
|
|
157
160
|
|
|
158
161
|
## Environment Variables
|
|
159
162
|
|
|
160
|
-
**
|
|
163
|
+
**Public config** lives in each app's `.env`. **Secrets** live in `.dndev.secrets` at project root.
|
|
161
164
|
|
|
162
165
|
```
|
|
163
166
|
my-project/
|
|
164
|
-
+-- .
|
|
167
|
+
+-- .dndev.secrets <-- ALL secrets (gitignored)
|
|
168
|
+
+-- .dndev.secrets.example <-- Template (committed)
|
|
165
169
|
+-- apps/
|
|
166
170
|
| +-- my-app/
|
|
167
|
-
| +-- .env <--
|
|
168
|
-
| +-- .env.local <-- Overrides .env (gitignored)
|
|
171
|
+
| +-- .env <-- Public keys: VITE_*, VERCEL_ORG_ID, VERCEL_PROJECT_ID
|
|
169
172
|
| +-- .env.staging <-- Used by dndev staging
|
|
170
173
|
| +-- .env.production <-- Production overrides
|
|
171
|
-
+--
|
|
172
|
-
+-- .env <-- Server secrets (Stripe, OAuth, service_role)
|
|
174
|
+
| +-- service-account-key.json <-- Firebase SA (gitignored)
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
**Rules:**
|
|
176
|
-
- `VITE_*` / `NEXT_PUBLIC_*` vars
|
|
177
|
-
-
|
|
178
|
-
-
|
|
178
|
+
- `VITE_*` / `NEXT_PUBLIC_*` vars → `apps/<app>/.env` (public, shipped to browser)
|
|
179
|
+
- `VERCEL_ORG_ID` / `VERCEL_PROJECT_ID` → `apps/<app>/.env` (public, per-app)
|
|
180
|
+
- All secret keys → `.dndev.secrets` at project root (one file, gitignored)
|
|
181
|
+
- Service account files → app root, gitignored
|
|
179
182
|
|
|
180
183
|
---
|
|
181
184
|
|
|
@@ -190,7 +193,7 @@ my-project/
|
|
|
190
193
|
| `dndev doctor` | Check project health (providers, .env) |
|
|
191
194
|
| `dndev deploy` | **Firebase:** hosting + functions + rules. **Supabase:** deploys frontend to [Vercel](https://vercel.com) (via scaffolded vercel.json) and Edge Functions to Supabase. Set `VITE_SUPABASE_*` in Vercel project env. |
|
|
192
195
|
| `dndev staging` | Deploy to staging environment |
|
|
193
|
-
| `dndev sync-secrets` | Push
|
|
196
|
+
| `dndev sync-secrets` | Push .dndev.secrets to runtime (Firebase/Vercel) |
|
|
194
197
|
| `dndev sync-secrets --target github` | Push secrets to GitHub Secrets (CI/CD) |
|
|
195
198
|
| `bun test` | Run tests (after Phase 4) |
|
|
196
199
|
| `bun run type-check` | TypeScript validation |
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- [SETUP_FIREBASE.md](./SETUP_FIREBASE.md) - Firebase project setup (`dndev coach` → `dndev setup`)
|
|
15
15
|
- [SETUP_SUPABASE.md](./SETUP_SUPABASE.md) - Supabase project setup (`dndev coach` → `dndev setup`)
|
|
16
16
|
- [SETUP_TESTING.md](./SETUP_TESTING.md) - Test generation (Phase 4)
|
|
17
|
+
- [SETUP_CICD.md](./SETUP_CICD.md) - CI/CD setup (`dndev setup-cicd` → GitHub Actions)
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
@@ -8,16 +8,12 @@
|
|
|
8
8
|
|
|
9
9
|
**Environment:**
|
|
10
10
|
```bash
|
|
11
|
-
#
|
|
11
|
+
# apps/<app>/.env (frontend, public)
|
|
12
12
|
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
|
|
13
13
|
|
|
14
|
-
#
|
|
14
|
+
# .dndev.secrets (project root, gitignored)
|
|
15
15
|
STRIPE_SECRET_KEY=sk_test_xxx
|
|
16
|
-
STRIPE_WEBHOOK_SECRET=whsec_xxx # From 'stripe listen'
|
|
17
|
-
|
|
18
|
-
# functions/.env (production)
|
|
19
|
-
STRIPE_SECRET_KEY=sk_live_xxx
|
|
20
|
-
STRIPE_WEBHOOK_SECRET=whsec_xxx
|
|
16
|
+
STRIPE_WEBHOOK_SECRET=whsec_xxx # From 'stripe listen' or Stripe Dashboard → Webhooks
|
|
21
17
|
```
|
|
22
18
|
|
|
23
19
|
**Stripe Dashboard:** Create products, copy Price IDs (`price_...`)
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Setup: CI/CD
|
|
2
|
+
|
|
3
|
+
**One command to set up GitHub Actions: secrets, workflows, staging.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Prerequisites
|
|
8
|
+
|
|
9
|
+
1. **GitHub CLI** installed and authenticated:
|
|
10
|
+
```bash
|
|
11
|
+
gh auth login
|
|
12
|
+
```
|
|
13
|
+
2. **Git remote** pointing to your GitHub repository
|
|
14
|
+
3. **`.dndev.secrets`** at project root with private tokens:
|
|
15
|
+
```env
|
|
16
|
+
GH_PAT=ghp_your_personal_access_token
|
|
17
|
+
VERCEL_TOKEN=your_vercel_token # if using Vercel
|
|
18
|
+
SUPABASE_ACCESS_TOKEN=your_token # if using Supabase
|
|
19
|
+
```
|
|
20
|
+
4. **Service account key** (Firebase projects):
|
|
21
|
+
- `service-account-key.json` in your app directory
|
|
22
|
+
- `service-account-key.staging.json` for staging (optional)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
dndev setup-cicd
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The command will:
|
|
33
|
+
1. Detect your app and providers (Firebase, Vercel, Supabase)
|
|
34
|
+
2. Show a plan of secrets to upload and workflows to generate
|
|
35
|
+
3. Upload all secrets to GitHub
|
|
36
|
+
4. Write `.github/workflows/ci.yml`, `deploy.yml`, and optionally `deploy-staging.yml`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Options
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
dndev setup-cicd --app web # Target specific app
|
|
44
|
+
dndev setup-cicd --dry-run # Preview without uploading or writing
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## What Gets Created
|
|
50
|
+
|
|
51
|
+
### Secrets (uploaded to GitHub)
|
|
52
|
+
|
|
53
|
+
| Secret | Source | When |
|
|
54
|
+
|--------|--------|------|
|
|
55
|
+
| `GH_PAT` | `.dndev.secrets` | Always (private dndev checkout) |
|
|
56
|
+
| `FIREBASE_SERVICE_ACCOUNT` | `service-account-key.json` (base64) | Firebase projects |
|
|
57
|
+
| `FIREBASE_SERVICE_ACCOUNT_STAGING` | `service-account-key.staging.json` (base64) | If staging detected |
|
|
58
|
+
| `VERCEL_TOKEN` | `.dndev.secrets` | Vercel projects |
|
|
59
|
+
| `VERCEL_ORG_ID` | `.env` | Vercel projects |
|
|
60
|
+
| `VERCEL_PROJECT_ID` | `.env` | Vercel projects |
|
|
61
|
+
| `SUPABASE_ACCESS_TOKEN` | `.dndev.secrets` | Supabase projects |
|
|
62
|
+
| `SUPABASE_PROJECT_REF` | Extracted from `VITE_SUPABASE_URL` | Supabase projects |
|
|
63
|
+
| `VITE_*` / `NEXT_PUBLIC_*` | `.env` | Public build vars |
|
|
64
|
+
|
|
65
|
+
### Workflows
|
|
66
|
+
|
|
67
|
+
| File | Trigger | What it does |
|
|
68
|
+
|------|---------|-------------|
|
|
69
|
+
| `ci.yml` | Push + PR to main | Checkout, install, typecheck, test |
|
|
70
|
+
| `deploy.yml` | Push to main | Build + deploy to detected providers |
|
|
71
|
+
| `deploy-staging.yml` | Push to staging/develop | Same as deploy, using staging credentials |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Staging Support
|
|
76
|
+
|
|
77
|
+
Staging is auto-detected if:
|
|
78
|
+
- `.firebaserc` contains a `staging` project alias
|
|
79
|
+
- `service-account-key.staging.json` exists
|
|
80
|
+
|
|
81
|
+
To enable staging manually:
|
|
82
|
+
|
|
83
|
+
1. Add staging alias to `.firebaserc`:
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"projects": {
|
|
87
|
+
"default": "my-app-prod",
|
|
88
|
+
"staging": "my-app-staging"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
2. Download the staging service account key as `service-account-key.staging.json`
|
|
93
|
+
3. Re-run `dndev setup-cicd`
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Troubleshooting
|
|
98
|
+
|
|
99
|
+
**"Could not detect GitHub repository"**
|
|
100
|
+
→ Ensure `git remote -v` shows a GitHub URL.
|
|
101
|
+
|
|
102
|
+
**Missing secrets warning**
|
|
103
|
+
→ Add the missing values to `.dndev.secrets` or `.env` and re-run.
|
|
104
|
+
|
|
105
|
+
**"gh: not found"**
|
|
106
|
+
→ Install GitHub CLI: https://cli.github.com/
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## See Also
|
|
111
|
+
|
|
112
|
+
- [SETUP_FIREBASE.md](./SETUP_FIREBASE.md) — Firebase setup
|
|
113
|
+
- [SETUP_VERCEL.md](./SETUP_VERCEL.md) — Vercel setup
|
|
114
|
+
- [SETUP_SUPABASE.md](./SETUP_SUPABASE.md) — Supabase setup
|
|
115
|
+
- [ENV_SETUP.md](./ENV_SETUP.md) — Environment variables
|
|
@@ -164,6 +164,47 @@ See `lookup_symbol("registerScopeProvider")`.
|
|
|
164
164
|
|
|
165
165
|
---
|
|
166
166
|
|
|
167
|
+
## 7. Data Fetching & Pagination
|
|
168
|
+
|
|
169
|
+
### Default: Auto Mode (zero config)
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
<EntityList entity={productEntity} />
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
That's it. The framework handles pagination automatically:
|
|
176
|
+
|
|
177
|
+
1. **First fetch** — loads up to 1000 items client-side (instant search, sort, filter in the browser)
|
|
178
|
+
2. **If total > 1000** — auto-switches to server pagination (fetches one page at a time via cursor)
|
|
179
|
+
|
|
180
|
+
You never need to configure pagination mode. It just works.
|
|
181
|
+
|
|
182
|
+
### Forcing a Mode (rare)
|
|
183
|
+
|
|
184
|
+
| Mode | Behavior | When to force |
|
|
185
|
+
|------|----------|---------------|
|
|
186
|
+
| `pagination='auto'` (default) | Client-side up to 1000, auto-switches to server if more | Never — this is the default |
|
|
187
|
+
| `pagination='client'` | Always client-side, fetches all | You know the dataset is small and want instant filters |
|
|
188
|
+
| `pagination='server'` | Always server-side, cursor pagination | You know the dataset is huge and want minimal fetch |
|
|
189
|
+
|
|
190
|
+
```tsx
|
|
191
|
+
// Force server pagination with custom page size
|
|
192
|
+
<EntityList entity={productEntity} pagination="server" pageSize={50} />
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### What Changes When Auto-Switches to Server
|
|
196
|
+
|
|
197
|
+
| Feature | Client mode (< 1000) | Server mode (> 1000) |
|
|
198
|
+
|---------|----------------------|----------------------|
|
|
199
|
+
| Search | Instant (in-memory) | Re-fetches per query |
|
|
200
|
+
| Sort | Instant | Re-fetches |
|
|
201
|
+
| Filters | Instant | Re-fetches |
|
|
202
|
+
| Page navigation | Instant | Fetches next page |
|
|
203
|
+
|
|
204
|
+
Server mode fetches only `pageSize` items per request — not the whole collection.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
167
208
|
## What's Available
|
|
168
209
|
|
|
169
210
|
### Components (`@donotdev/ui`)
|
|
@@ -12,9 +12,12 @@ dndev coach
|
|
|
12
12
|
|
|
13
13
|
This prints a numbered checklist of what to configure. For Supabase, you'll need:
|
|
14
14
|
- **Project URL** and **public key** → paste into your app's `.env`
|
|
15
|
-
- **service_role key** → paste into `
|
|
15
|
+
- **service_role key** → paste into `.dndev.secrets` at project root
|
|
16
|
+
- **Access token** → paste into `.dndev.secrets` (needed for DB migrations via Management API)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
Where to get them:
|
|
19
|
+
- URL + public key + service_role key: [Supabase Dashboard](https://supabase.com/dashboard) → your project → **Settings → API**
|
|
20
|
+
- Access token: [supabase.com/dashboard/account/tokens](https://supabase.com/dashboard/account/tokens) (account-level, not project-level)
|
|
18
21
|
|
|
19
22
|
Then run setup to validate and automate:
|
|
20
23
|
|
|
@@ -22,7 +25,7 @@ Then run setup to validate and automate:
|
|
|
22
25
|
dndev setup
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
Setup validates your
|
|
28
|
+
Setup validates your credentials, generates SQL migrations from entities, and pushes them via the Supabase Management API (HTTPS — no CLI needed).
|
|
26
29
|
|
|
27
30
|
---
|
|
28
31
|
|
|
@@ -49,19 +52,11 @@ Output is written to `supabase/migrations/` as a timestamped `.sql` file.
|
|
|
49
52
|
|
|
50
53
|
## Step 3: Apply Migrations
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
`dndev setup` pushes migrations automatically via the Supabase Management API. No CLI needed.
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
If you prefer to apply manually:
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
supabase db push
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
(or `supabase migration up` if you manage migrations locally)
|
|
61
|
-
|
|
62
|
-
**Option B — Dashboard**
|
|
63
|
-
|
|
64
|
-
Copy the contents of the generated migration file into the SQL Editor in the Supabase Dashboard and run it.
|
|
59
|
+
**Dashboard SQL Editor** — Copy the generated `.sql` file contents from `supabase/migrations/` into the SQL Editor in the Supabase Dashboard and run it.
|
|
65
60
|
|
|
66
61
|
---
|
|
67
62
|
|
|
@@ -162,7 +157,7 @@ You never set timestamps in app code — the DB owns them.
|
|
|
162
157
|
| `VITE_SUPABASE_URL` | Project URL (public) |
|
|
163
158
|
| `VITE_SUPABASE_PUBLIC_KEY` | Public key (safe in bundle) |
|
|
164
159
|
|
|
165
|
-
**Server (Edge Functions, API routes):** use the same URL and `
|
|
160
|
+
**Server (Edge Functions, API routes):** use the same URL and `SUPABASE_SECRET_KEY` for admin operations. Never expose the service_role key to the client. Put it in `.dndev.secrets` at project root (or your host's env for production).
|
|
166
161
|
|
|
167
162
|
See [ENV_SETUP.md](./ENV_SETUP.md) for the full secrets policy.
|
|
168
163
|
|
|
@@ -205,16 +200,16 @@ Or install the [Supabase CLI](https://supabase.com/docs/guides/cli) and run `sup
|
|
|
205
200
|
## Troubleshooting
|
|
206
201
|
|
|
207
202
|
**"Table not found" / "relation does not exist"**
|
|
208
|
-
→ Run `dndev setup`
|
|
203
|
+
→ Run `dndev setup` — it generates SQL and pushes via Management API. Or copy the SQL from `supabase/migrations/` into the Dashboard SQL Editor.
|
|
209
204
|
|
|
210
205
|
**"Permission denied" / RLS errors**
|
|
211
206
|
→ Check RLS policies in Supabase Dashboard → Database → Policies
|
|
212
207
|
→ Generated migrations include default policies — verify they were applied
|
|
213
208
|
|
|
214
209
|
**"Service role key" errors in functions**
|
|
215
|
-
→ Put `
|
|
210
|
+
→ Put `SUPABASE_SECRET_KEY` in `.dndev.secrets` at project root (never in `VITE_*` vars)
|
|
216
211
|
→ Get it from Supabase Dashboard → Settings → API
|
|
217
212
|
|
|
218
213
|
---
|
|
219
214
|
|
|
220
|
-
**`dndev coach` → fill
|
|
215
|
+
**`dndev coach` → fill `.env` + `.dndev.secrets` → `dndev setup` → `dndev dev`. The adapter normalizes everything automatically.**
|
|
@@ -29,24 +29,28 @@ The framework scaffolds `vercel.json` with CSP headers, rewrites, and caching ru
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
## Step 2: Add Credentials
|
|
32
|
+
## Step 2: Add Credentials
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
**Secret (shared across apps):** add to `.dndev.secrets` at project root:
|
|
35
35
|
|
|
36
36
|
```env
|
|
37
|
-
# Vercel Deployment Credentials (gitignored — never commit these)
|
|
38
37
|
VERCEL_TOKEN=your_vercel_token
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Per-app (public):** add to `apps/<your-app>/.env`:
|
|
41
|
+
|
|
42
|
+
```env
|
|
39
43
|
VERCEL_ORG_ID=your_team_id
|
|
40
44
|
VERCEL_PROJECT_ID=your_project_id
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
**Where to find them:**
|
|
44
48
|
|
|
45
|
-
| Variable | Where |
|
|
46
|
-
|
|
47
|
-
| `VERCEL_TOKEN` | [vercel.com/account/tokens](https://vercel.com/account/tokens) — scope to your team |
|
|
48
|
-
| `VERCEL_ORG_ID` | Vercel Dashboard → Settings → General → **Team ID** |
|
|
49
|
-
| `VERCEL_PROJECT_ID` | Vercel Dashboard → Your Project → Settings → General → **Project ID** |
|
|
49
|
+
| Variable | Where | File |
|
|
50
|
+
|----------|-------|------|
|
|
51
|
+
| `VERCEL_TOKEN` | [vercel.com/account/tokens](https://vercel.com/account/tokens) — scope to your team | `.dndev.secrets` |
|
|
52
|
+
| `VERCEL_ORG_ID` | Vercel Dashboard → Settings → General → **Team ID** | `apps/<app>/.env` |
|
|
53
|
+
| `VERCEL_PROJECT_ID` | Vercel Dashboard → Your Project → Settings → General → **Project ID** | `apps/<app>/.env` |
|
|
50
54
|
|
|
51
55
|
That's it. No `vercel login`, no `vercel link`, no interactive prompts.
|
|
52
56
|
|
|
@@ -156,8 +160,8 @@ Available: auth (claims, status, delete account), billing (checkout, cancel, por
|
|
|
156
160
|
|
|
157
161
|
| File | What Goes Here | Loaded By |
|
|
158
162
|
|------|---------------|-----------|
|
|
159
|
-
| `
|
|
160
|
-
| `apps/<app>/.env
|
|
163
|
+
| `.dndev.secrets` | `VERCEL_TOKEN` (gitignored) | `dndev deploy` |
|
|
164
|
+
| `apps/<app>/.env` | Public keys + `VERCEL_ORG_ID`, `VERCEL_PROJECT_ID` | Vite/Next.js + `dndev deploy` |
|
|
161
165
|
| `apps/<app>/.env.production` | Production overrides | Vite/Next.js (build --mode production) |
|
|
162
166
|
| Vercel Dashboard | All production env vars (client + server) | Vercel runtime |
|
|
163
167
|
|
|
@@ -193,7 +197,8 @@ dndev emu start
|
|
|
193
197
|
## Troubleshooting
|
|
194
198
|
|
|
195
199
|
**"Missing Vercel credentials"**
|
|
196
|
-
→ Check `
|
|
200
|
+
→ Check `VERCEL_TOKEN` is in `.dndev.secrets` at project root
|
|
201
|
+
→ Check `VERCEL_ORG_ID` and `VERCEL_PROJECT_ID` are in `apps/<app>/.env`
|
|
197
202
|
→ Run `dndev setup` to validate
|
|
198
203
|
|
|
199
204
|
**"Build fails on Vercel"**
|
|
@@ -211,4 +216,4 @@ dndev emu start
|
|
|
211
216
|
|
|
212
217
|
---
|
|
213
218
|
|
|
214
|
-
**
|
|
219
|
+
**Token in `.dndev.secrets` + IDs in `.env` → `dndev deploy` → done.**
|