create-questpie 2.0.0 → 2.0.2

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 (45) hide show
  1. package/README.md +10 -6
  2. package/dist/index.mjs +140 -25
  3. package/package.json +5 -3
  4. package/skills/questpie/AGENTS.md +2664 -0
  5. package/skills/questpie/SKILL.md +181 -0
  6. package/skills/questpie/references/auth.md +121 -0
  7. package/skills/questpie/references/business-logic.md +550 -0
  8. package/skills/questpie/references/codegen-plugin-api.md +382 -0
  9. package/skills/questpie/references/crud-api.md +378 -0
  10. package/skills/questpie/references/data-modeling.md +489 -0
  11. package/skills/questpie/references/extend.md +493 -0
  12. package/skills/questpie/references/field-types.md +386 -0
  13. package/skills/questpie/references/infrastructure-adapters.md +545 -0
  14. package/skills/questpie/references/multi-tenancy.md +364 -0
  15. package/skills/questpie/references/production.md +475 -0
  16. package/skills/questpie/references/query-operators.md +125 -0
  17. package/skills/questpie/references/quickstart.md +549 -0
  18. package/skills/questpie/references/rules.md +327 -0
  19. package/skills/questpie/references/tanstack-query.md +520 -0
  20. package/skills/questpie-admin/AGENTS.md +1442 -0
  21. package/skills/questpie-admin/SKILL.md +410 -0
  22. package/skills/questpie-admin/references/blocks.md +307 -0
  23. package/skills/questpie-admin/references/custom-ui.md +305 -0
  24. package/skills/questpie-admin/references/views.md +433 -0
  25. package/templates/tanstack-start/AGENTS.md +71 -62
  26. package/templates/tanstack-start/CLAUDE.md +26 -23
  27. package/templates/tanstack-start/README.md +32 -20
  28. package/templates/tanstack-start/env.example +1 -1
  29. package/templates/tanstack-start/package.json +20 -6
  30. package/templates/tanstack-start/src/lib/client.ts +2 -2
  31. package/templates/tanstack-start/src/lib/env.ts +1 -1
  32. package/templates/tanstack-start/src/questpie/admin/.generated/client.ts +13 -0
  33. package/templates/tanstack-start/src/questpie/admin/modules.ts +1 -0
  34. package/templates/tanstack-start/src/questpie/server/.generated/factories.ts +117 -241
  35. package/templates/tanstack-start/src/questpie/server/.generated/index.ts +129 -81
  36. package/templates/tanstack-start/src/questpie/server/app.ts +1 -1
  37. package/templates/tanstack-start/src/questpie/server/config/admin.ts +27 -30
  38. package/templates/tanstack-start/src/questpie/server/globals/site-settings.global.ts +1 -1
  39. package/templates/tanstack-start/src/questpie/server/questpie.config.ts +1 -1
  40. package/templates/tanstack-start/src/routeTree.gen.ts +138 -0
  41. package/templates/tanstack-start/src/routes/__root.tsx +0 -2
  42. package/templates/tanstack-start/src/routes/admin.tsx +8 -1
  43. package/templates/tanstack-start/src/tanstack-start.d.ts +1 -0
  44. package/templates/tanstack-start/src/vite-env.d.ts +1 -0
  45. package/templates/tanstack-start/vite.config.ts +1 -3
@@ -115,11 +115,11 @@ src/
115
115
  - **`src/questpie/server/questpie.config.ts`** — App config: `runtimeConfig({ db, app, ... })`.
116
116
  - **`src/questpie/server/modules.ts`** — Module dependencies: `export default [adminModule, openApiModule] as const`.
117
117
  - **`src/questpie/server/config/auth.ts`** — Auth config via `authConfig()` factory.
118
- - **`src/questpie/server/config/app.ts`** — App config (locale, access, hooks, context) via `appConfig()` factory.
119
118
  - **`src/questpie/server/config/admin.ts`** — Admin config (sidebar, dashboard, branding, locale) via `adminConfig()` factory.
119
+ - **`src/questpie/server/config/app.ts`** — _(optional, not scaffolded)_ App config (locale, access, hooks, context) via `appConfig()`. Create when needed.
120
120
  - **`src/questpie/server/config/openapi.ts`** — OpenAPI config via `openApiConfig()` factory.
121
- - **`src/questpie/server/.generated/index.ts`** — Codegen output. Exports typed `app` instance and `App` type. Run `bunx questpie generate` to regenerate.
122
- - **`src/questpie/admin/.generated/client.ts`** — Codegen output: pre-built admin client config. Run `bunx questpie generate` to regenerate.
121
+ - **`src/questpie/server/.generated/index.ts`** — Codegen output. Exports typed `app` instance and `App` type. Run `bun run questpie:generate` to regenerate.
122
+ - **`src/questpie/admin/.generated/client.ts`** — Codegen output: pre-built admin client config. Run `bun run questpie:generate` to regenerate.
123
123
  - **`src/lib/env.ts`** — Type-safe env variables via `@t3-oss/env-core`. Add new env vars here with Zod schemas.
124
124
  - **`questpie.config.ts`** — CLI config (migration directory, app reference).
125
125
  - **`src/routes/api/$.ts`** — API catch-all handler. Serves REST + OpenAPI docs at `/api/docs`.
@@ -132,7 +132,7 @@ Keep the entire builder chain in one file — single source of truth per entity:
132
132
 
133
133
  ```ts
134
134
  // src/questpie/server/collections/posts.ts
135
- import { collection } from "questpie";
135
+ import { collection } from "#questpie/factories";
136
136
 
137
137
  export const posts = collection("posts")
138
138
  .fields(({ f }) => ({
@@ -154,10 +154,13 @@ export const posts = collection("posts")
154
154
  content: f.richText().label("Content"),
155
155
  published: f.boolean().label("Published").default(false),
156
156
  category: f
157
- .select()
157
+ .select([
158
+ { value: "news", label: "News" },
159
+ { value: "blog", label: "Blog" },
160
+ { value: "tutorial", label: "Tutorial" },
161
+ ])
158
162
  .label("Category")
159
- .options(["news", "blog", "tutorial"]),
160
- author: f.relation().label("Author").to("users"),
163
+ author: f.relation("users").label("Author"),
161
164
  image: f.upload().label("Cover Image"),
162
165
  }))
163
166
  .title(({ f }) => f.title)
@@ -191,12 +194,12 @@ Then (preferred):
191
194
 
192
195
  1. Use `bun questpie add collection <name>` to scaffold files
193
196
  2. Codegen runs automatically
194
- 3. Run `bun questpie migrate:create` to generate migration
197
+ 3. Run `bun run migrate:create` to generate migration
195
198
 
196
199
  Manual workflow (if you create files yourself):
197
200
 
198
- 1. Run `bunx questpie generate` to regenerate `.generated/index.ts`
199
- 2. Run `bun questpie migrate:create` to generate migration
201
+ 1. Run `bun run questpie:generate` to regenerate `.generated/index.ts`
202
+ 2. Run `bun run migrate:create` to generate migration
200
203
 
201
204
  Collections are auto-discovered by codegen — no manual registration needed.
202
205
 
@@ -209,9 +212,9 @@ Collections are auto-discovered by codegen — no manual registration needed.
209
212
 
210
213
  ```ts
211
214
  // src/questpie/server/globals/site-settings.ts
212
- import { global } from "questpie";
215
+ import { global } from "#questpie/factories";
213
216
 
214
- export const siteSettings = global("site_settings")
217
+ export const siteSettings = global("siteSettings")
215
218
  .fields(({ f }) => ({
216
219
  siteName: f.text(255).label("Site Name").required(),
217
220
  description: f.textarea().label("Description"),
@@ -230,12 +233,12 @@ Then (preferred):
230
233
 
231
234
  1. Use `bun questpie add global <name>` to scaffold files
232
235
  2. Codegen runs automatically
233
- 3. Run `bun questpie migrate:create`
236
+ 3. Run `bun run migrate:create`
234
237
 
235
238
  Manual workflow (if you create files yourself):
236
239
 
237
- 1. Run `bunx questpie generate` to regenerate `.generated/index.ts`
238
- 2. Run `bun questpie migrate:create`
240
+ 1. Run `bun run questpie:generate` to regenerate `.generated/index.ts`
241
+ 2. Run `bun run migrate:create`
239
242
 
240
243
  Globals are auto-discovered by codegen — no manual registration needed.
241
244
 
@@ -267,7 +270,7 @@ export default route()
267
270
  **Step 2 — Run codegen:**
268
271
 
269
272
  ```bash
270
- bunx questpie generate
273
+ bun run questpie:generate
271
274
  ```
272
275
 
273
276
  The route is auto-discovered and available at `/api/get-stats`.
@@ -390,10 +393,9 @@ All reactive handlers run **server-side** with access to `ctx.db`, `ctx.user`, `
390
393
 
391
394
  ```ts
392
395
  fields: ({ f }) => ({
393
- country: f.relation().to("countries").label("Country"),
396
+ country: f.relation("countries").label("Country"),
394
397
  city: f
395
- .relation()
396
- .to("cities")
398
+ .relation("cities")
397
399
  .label("City")
398
400
  .admin({
399
401
  options: {
@@ -409,9 +411,12 @@ fields: ({ f }) => ({
409
411
  },
410
412
  }),
411
413
  status: f
412
- .select()
414
+ .select([
415
+ { value: "draft", label: "Draft" },
416
+ { value: "published", label: "Published" },
417
+ { value: "archived", label: "Archived" },
418
+ ])
413
419
  .label("Status")
414
- .options(["draft", "published", "archived"]),
415
420
  publishedAt: f
416
421
  .datetime()
417
422
  .label("Published At")
@@ -424,7 +429,7 @@ fields: ({ f }) => ({
424
429
  ### Admin Configuration (Client-Side)
425
430
 
426
431
  The admin client config is auto-generated by codegen into `admin/.generated/client.ts`.
427
- No manual builder setup is needed. Run `bunx questpie generate` to regenerate.
432
+ No manual builder setup is needed. Run `bun run questpie:generate` to regenerate.
428
433
 
429
434
  ```ts
430
435
  // src/questpie/admin/admin.ts (re-export for convenience)
@@ -458,7 +463,7 @@ import { app } from "#questpie";
458
463
  const handler = createFetchHandler(app, { basePath: "/api" });
459
464
  ```
460
465
 
461
- OpenAPI is registered as a module in `src/questpie/server/modules.ts` via `openApiModule()` — no wrapper needed in the route handler.
466
+ OpenAPI is registered as a module in `src/questpie/server/modules.ts` via `openApiModule` — no wrapper needed in the route handler.
462
467
 
463
468
  ### Icons
464
469
 
@@ -493,8 +498,12 @@ Optional (with defaults):
493
498
  bun dev # Start dev server
494
499
  bun build # Build for production
495
500
  bun start # Start production server
496
- bun questpie migrate # Run database migrations
497
- bun questpie migrate:create # Create new migration
501
+ bun run migrate # Run database migrations
502
+ bun run migrate:create # Create new migration
503
+ bun run routes:generate # Regenerate TanStack Router route tree
504
+ bun run questpie:generate # Regenerate codegen output
505
+ bun run scaffold:generate # Regenerate route tree and QUESTPIE output
506
+ bun run scaffold:verify # Regenerate codegen and type-check
498
507
  docker compose up -d # Start PostgreSQL
499
508
  ```
500
509
 
@@ -525,15 +534,14 @@ Always use these exact versions — check `package.json` before upgrading:
525
534
 
526
535
  ## Live Preview
527
536
 
528
- QUESTPIE supports live preview with a split-screen editor. The preview architecture uses a direct `postMessage` patch bus for instant feedback — NOT save-driven iframe reloads.
537
+ QUESTPIE supports live preview with a split-screen editor. The current implementation refreshes the preview iframe after save/autosave and uses `postMessage` for field/block focus sync.
529
538
 
530
539
  ### Key Principles
531
540
 
532
- - **Same-tab preview** = direct patch bus via `postMessage` (editor iframe and preview share the same browser tab)
533
- - **Save/autosave** = persistence only, NOT the live transport mechanism
534
- - **Realtime** = extension for detached/shared preview only (e.g., another browser tab or collaborator)
535
- - **Hybrid model**: local draft patches give instant response; server reconciles derived data (slugs, relations, computed fields)
536
- - **Preview wrappers must prevent accidental navigation** inside the iframe
541
+ - **Same-tab preview** = iframe refresh after save/autosave plus `postMessage` focus events
542
+ - **Frontend hook** = `useCollectionPreview({ initialData, onRefresh })`
543
+ - **Field focus** = `PreviewProvider` + `PreviewField`
544
+ - **Block field paths** = `BlockScopeProvider` + `PreviewField`
537
545
 
538
546
  ### Server Config
539
547
 
@@ -541,7 +549,7 @@ Add `.preview()` to a collection to enable the split-screen editor:
541
549
 
542
550
  ```ts
543
551
  // src/questpie/server/collections/pages.ts
544
- import { collection } from "questpie";
552
+ import { collection } from "#questpie/factories";
545
553
 
546
554
  export const pages = collection("pages")
547
555
  .fields(({ f }) => ({
@@ -550,62 +558,63 @@ export const pages = collection("pages")
550
558
  content: f.blocks().label("Content"),
551
559
  }))
552
560
  .preview({
561
+ enabled: true,
562
+ position: "right",
563
+ defaultWidth: 50,
553
564
  url: ({ record }) => {
554
565
  const slug = record.slug as string;
555
566
  return slug === "home" ? "/?preview=true" : `/${slug}?preview=true`;
556
567
  },
557
- watch: ["title", "slug", "content"],
558
- strategy: "hybrid", // "instant" | "server" | "hybrid"
559
568
  });
560
569
  ```
561
570
 
562
- | Strategy | Behavior |
563
- | ----------- | ------------------------------------------------------------------------ |
564
- | `"instant"` | Patches applied locally only — no server round-trip |
565
- | `"server"` | Every change round-trips through the server before preview updates |
566
- | `"hybrid"` | Local patches for instant response + server reconcile for derived fields |
567
-
568
571
  ### Frontend Integration
569
572
 
570
- Use `useQuestpiePreview` in your frontend page components to receive live patches:
573
+ Use `useCollectionPreview` in your frontend page components:
571
574
 
572
575
  ```tsx
573
576
  // src/routes/[slug].tsx
574
- import { useQuestpiePreview } from "@questpie/admin/client";
577
+ import {
578
+ PreviewField,
579
+ PreviewProvider,
580
+ useCollectionPreview,
581
+ } from "@questpie/admin/client";
575
582
 
576
583
  function PageComponent({ initialData }) {
577
584
  const router = useRouter();
578
- const { data } = useQuestpiePreview({
585
+ const preview = useCollectionPreview({
579
586
  initialData,
580
- reconcile: () => router.invalidate(), // called on COMMIT — refetch server data
587
+ onRefresh: () => router.invalidate(),
581
588
  });
582
589
 
583
590
  return (
584
- <PreviewRoot>
585
- <h1>
586
- <PreviewField path="title">{data.title}</PreviewField>
587
- </h1>
588
- <PreviewBlock id="content">{/* block renderers */}</PreviewBlock>
589
- </PreviewRoot>
591
+ <PreviewProvider
592
+ isPreviewMode={preview.isPreviewMode}
593
+ focusedField={preview.focusedField}
594
+ onFieldClick={preview.handleFieldClick}
595
+ >
596
+ <PreviewField field="title" as="h1">
597
+ {preview.data.title}
598
+ </PreviewField>
599
+ </PreviewProvider>
590
600
  );
591
601
  }
592
602
  ```
593
603
 
594
604
  #### Protocol
595
605
 
596
- Each `postMessage` carries a structured envelope:
606
+ The implemented preview messages are simple `postMessage` events:
597
607
 
598
- | Field | Description |
599
- | ----------------- | -------------------------------------- |
600
- | `sessionId` | Unique preview session identifier |
601
- | `seq` | Monotonic sequence number |
602
- | `timestamp` | `Date.now()` at send time (number) |
603
- | `protocolVersion` | Protocol version for forward compat |
604
- | `patches` | Array of field path + value patch ops |
608
+ | Field | Description |
609
+ | ----------------- | --------------------------------------- |
610
+ | `PREVIEW_READY` | Preview iframe tells admin it is ready |
611
+ | `PREVIEW_REFRESH` | Admin asks iframe to refresh data |
612
+ | `FIELD_CLICKED` | Preview asks admin to focus a field |
613
+ | `BLOCK_CLICKED` | Preview asks admin to select a block |
614
+ | `FOCUS_FIELD` | Admin asks preview to highlight a field |
615
+ | `SELECT_BLOCK` | Admin asks preview to highlight a block |
605
616
 
606
617
  ### Anti-Patterns (Preview)
607
618
 
608
- - **Using `router.invalidate()` as the core live-preview mechanism** — this causes full data refetches and visible flicker. Use the patch bus instead.
609
- - **Tying preview freshness to save/autosave** — save is for persistence. Preview updates flow through `postMessage` patches.
610
- - **Using realtime transport for same-tab preview** — realtime (SSE/WebSocket) is for detached or shared preview sessions, not the default same-tab flow.
611
- - **Allowing navigation inside the preview iframe** — preview wrappers must intercept link clicks and route changes to prevent the iframe from navigating away.
619
+ - **Using V2-only APIs in this template** — `useQuestpiePreview`, `PreviewRoot`, and `PreviewBlock` are not exported yet.
620
+ - **Importing `app` inside previewed collection/block files** — use handler `ctx` values to avoid generated-app cycles.
@@ -4,18 +4,21 @@ This is a [QUESTPIE](https://questpie.com) project scaffolded with `create-quest
4
4
 
5
5
  ## Quick Reference
6
6
 
7
- | Command | Purpose |
8
- | ------------------------------------ | ---------------------------------------- |
9
- | `bun dev` | Start dev server (port 3000) |
10
- | `bun build` | Build for production |
11
- | `bun start` | Start production server |
12
- | `bun questpie add <type> <name>` | Scaffold a new entity (collection, seed, etc.) |
13
- | `bun questpie add --list` | List all available scaffold types |
14
- | `bun questpie generate` | Regenerate .generated/index.ts |
15
- | `bun questpie migrate:create` | Generate a migration from schema diff |
16
- | `bun questpie migrate` | Run pending migrations |
17
- | `bun questpie seed` | Run pending seeds |
18
- | `docker compose up -d` | Start PostgreSQL |
7
+ | Command | Purpose |
8
+ | -------------------------------- | ---------------------------------------------- |
9
+ | `bun dev` | Start dev server (port 3000) |
10
+ | `bun build` | Build for production |
11
+ | `bun start` | Start production server |
12
+ | `bun questpie add <type> <name>` | Scaffold a new entity (collection, seed, etc.) |
13
+ | `bun questpie add --list` | List all available scaffold types |
14
+ | `bun run routes:generate` | Regenerate TanStack Router route tree |
15
+ | `bun run questpie:generate` | Regenerate .generated/index.ts |
16
+ | `bun run scaffold:generate` | Regenerate route tree and QUESTPIE output |
17
+ | `bun run scaffold:verify` | Regenerate codegen and type-check |
18
+ | `bun run migrate:create` | Generate a migration from schema diff |
19
+ | `bun run migrate` | Run pending migrations |
20
+ | `bun questpie seed` | Run pending seeds |
21
+ | `docker compose up -d` | Start PostgreSQL |
19
22
 
20
23
  ## Project Architecture
21
24
 
@@ -31,9 +34,9 @@ src/questpie/
31
34
  modules.ts ← Module dependencies (adminModule, openApiModule, etc.)
32
35
  config/ ← Typed configuration files
33
36
  auth.ts ← authConfig({...}) — Better Auth options
34
- app.ts ← appConfig({ locale, access, hooks, context })
35
37
  admin.ts ← adminConfig({ sidebar, dashboard, branding, locale })
36
38
  openapi.ts ← openApiConfig({ info, scalar })
39
+ app.ts ← (optional) appConfig({ locale, access, hooks, context })
37
40
  .generated/ ← Codegen output (app instance + App type)
38
41
  index.ts
39
42
  collections/ ← One file per collection (auto-discovered)
@@ -52,9 +55,9 @@ src/questpie/
52
55
  - **`src/questpie/server/questpie.config.ts`** — App config: `runtimeConfig({ db, app, ... })`.
53
56
  - **`src/questpie/server/modules.ts`** — Module dependencies: `export default [adminModule, openApiModule] as const`.
54
57
  - **`src/questpie/server/config/auth.ts`** — Auth config via `authConfig()` factory.
55
- - **`src/questpie/server/config/app.ts`** — App config (locale, access, hooks, context) via `appConfig()` factory.
56
58
  - **`src/questpie/server/config/admin.ts`** — Admin config (sidebar, dashboard, branding, locale) via `adminConfig()` factory.
57
- - **`src/questpie/server/.generated/index.ts`** — Codegen output. Exports typed `app` instance and `App` type. Run `bunx questpie generate` to regenerate.
59
+ - **`src/questpie/server/config/app.ts`** — _(optional, not scaffolded)_ App config (locale, access, hooks, context) via `appConfig()`. Create when needed.
60
+ - **`src/questpie/server/.generated/index.ts`** — Codegen output. Exports typed `app` instance and `App` type. Run `bun run questpie:generate` to regenerate.
58
61
  - **`src/lib/env.ts`** — Type-safe env variables via `@t3-oss/env-core`. Add new env vars here with Zod schemas.
59
62
  - **`questpie.config.ts`** — CLI config (migration directory, app reference).
60
63
  - **`src/routes/api/$.ts`** — API catch-all handler. Serves REST + OpenAPI docs at `/api/docs`.
@@ -81,17 +84,17 @@ Preferred workflow:
81
84
 
82
85
  1. Run `bun questpie add collection my-thing`
83
86
  2. The CLI creates the file and auto-runs codegen
84
- 3. Run `bun questpie migrate:create`
87
+ 3. Run `bun run migrate:create`
85
88
 
86
89
  Manual workflow:
87
90
 
88
91
  1. Create `src/questpie/server/collections/my-thing.ts` with a named export:
89
92
  ```ts
90
- import { collection } from "questpie";
93
+ import { collection } from "#questpie/factories";
91
94
  export const myThing = collection("my-thing").fields(({ f }) => ({ ... }));
92
95
  ```
93
- 2. Run `bunx questpie generate` to regenerate `.generated/index.ts`
94
- 3. Run `bun questpie migrate:create` to generate migration
96
+ 2. Run `bun run questpie:generate` to regenerate `.generated/index.ts`
97
+ 3. Run `bun run migrate:create` to generate migration
95
98
 
96
99
  Collections are auto-discovered by codegen — no manual registration needed.
97
100
 
@@ -101,13 +104,13 @@ Preferred workflow:
101
104
 
102
105
  1. Run `bun questpie add global my-global`
103
106
  2. The CLI creates the file and auto-runs codegen
104
- 3. Run `bun questpie migrate:create`
107
+ 3. Run `bun run migrate:create`
105
108
 
106
109
  Manual workflow:
107
110
 
108
111
  1. Create `src/questpie/server/globals/my-global.ts` with a named export
109
- 2. Run `bunx questpie generate`
110
- 3. Run `bun questpie migrate:create`
112
+ 2. Run `bun run questpie:generate`
113
+ 3. Run `bun run migrate:create`
111
114
 
112
115
  ### Add a server route (end-to-end type-safe)
113
116
 
@@ -126,7 +129,7 @@ Manual workflow:
126
129
  });
127
130
  ```
128
131
 
129
- 2. Run `bunx questpie generate` — route is auto-discovered and available at `/api/my-function`
132
+ 2. Run `bun run questpie:generate` — route is auto-discovered and available at `/api/my-function`
130
133
 
131
134
  See AGENTS.md for detailed route patterns, access control, and TanStack Query integration.
132
135
 
@@ -15,11 +15,14 @@ A [QUESTPIE](https://questpie.com) app built with TanStack Start.
15
15
  # 1) Start PostgreSQL
16
16
  docker compose up -d
17
17
 
18
- # 2) Run migrations
19
- bun questpie migrate
18
+ # 2) Regenerate codegen and type-check
19
+ bun run scaffold:verify
20
20
 
21
- # 3) Start development server
22
- bun dev
21
+ # 3) Run migrations
22
+ bun run migrate
23
+
24
+ # 4) Start development server
25
+ bun run dev
23
26
  ```
24
27
 
25
28
  - Admin panel: `http://localhost:3000/admin`
@@ -33,6 +36,10 @@ src/
33
36
  server/
34
37
  questpie.config.ts # Runtime config
35
38
  modules.ts # Module list (admin/openapi/...)
39
+ config/
40
+ admin.ts # Admin sidebar/dashboard/branding
41
+ auth.ts # Auth config
42
+ openapi.ts # OpenAPI/Scalar config
36
43
  app.ts # Re-export of generated app
37
44
  .generated/ # Codegen output (do not edit manually)
38
45
  collections/
@@ -41,6 +48,8 @@ src/
41
48
  site-settings.global.ts
42
49
  admin/
43
50
  admin.ts # Re-export of generated admin config
51
+ modules.ts # Admin client module defaults
52
+ .generated/ # Admin client codegen output
44
53
  routes/
45
54
  api/$.ts # QUESTPIE fetch handler mount
46
55
  admin.tsx
@@ -55,16 +64,19 @@ migrations/
55
64
 
56
65
  ## Scripts
57
66
 
58
- | Command | Description |
59
- | ----------------------------- | --------------------------------------------- |
60
- | `bun dev` | Start development server |
61
- | `bun build` | Build for production |
62
- | `bun start` | Start production server |
63
- | `bun check-types` | Type check |
64
- | `bun questpie add <type> <name>` | Scaffold entity files (auto-runs codegen) |
65
- | `bun questpie migrate` | Run migrations |
66
- | `bun questpie migrate:create` | Create migration |
67
- | `bunx questpie generate` | Regenerate `src/questpie/server/.generated/*` |
67
+ | Command | Description |
68
+ | -------------------------------- | --------------------------------------------- |
69
+ | `bun dev` | Start development server |
70
+ | `bun build` | Build for production |
71
+ | `bun start` | Start production server |
72
+ | `bun check-types` | Type check |
73
+ | `bun run scaffold:generate` | Regenerate routes and QUESTPIE codegen |
74
+ | `bun run scaffold:verify` | Regenerate codegen and type-check |
75
+ | `bun run routes:generate` | Regenerate TanStack Router route tree |
76
+ | `bun run questpie:generate` | Regenerate `src/questpie/server/.generated/*` |
77
+ | `bun questpie add <type> <name>` | Scaffold entity files (auto-runs codegen) |
78
+ | `bun run migrate` | Run migrations |
79
+ | `bun run migrate:create` | Create migration |
68
80
 
69
81
  ## Adding a Collection
70
82
 
@@ -72,14 +84,14 @@ Preferred workflow:
72
84
 
73
85
  1. Run `bun questpie add collection products`.
74
86
  2. The CLI creates the file and runs codegen automatically.
75
- 3. Run `bun questpie migrate:create`.
87
+ 3. Run `bun run migrate:create`.
76
88
 
77
89
  Manual workflow (when you create files by hand):
78
90
 
79
91
  1. Create a file in `src/questpie/server/collections/`.
80
92
  2. Export a collection builder from that file.
81
- 3. Run `bunx questpie generate`.
82
- 4. Run `bun questpie migrate:create`.
93
+ 3. Run `bun run questpie:generate`.
94
+ 4. Run `bun run migrate:create`.
83
95
 
84
96
  Collections are discovered automatically by codegen. No manual `app.ts` registration is required.
85
97
 
@@ -89,13 +101,13 @@ Preferred workflow:
89
101
 
90
102
  1. Run `bun questpie add global marketing`.
91
103
  2. The CLI creates the file and runs codegen automatically.
92
- 3. Run `bun questpie migrate:create`.
104
+ 3. Run `bun run migrate:create`.
93
105
 
94
106
  Manual workflow (when you create files by hand):
95
107
 
96
108
  1. Create a file in `src/questpie/server/globals/`.
97
109
  2. Export a global builder from that file.
98
- 3. Run `bunx questpie generate`.
99
- 4. Run `bun questpie migrate:create`.
110
+ 3. Run `bun run questpie:generate`.
111
+ 4. Run `bun run migrate:create`.
100
112
 
101
113
  Globals are discovered automatically by codegen. No manual `app.ts` registration is required.
@@ -6,7 +6,7 @@ APP_URL=http://localhost:3000
6
6
  PORT=3000
7
7
 
8
8
  # Auth (Better Auth)
9
- BETTER_AUTH_SECRET=your-secret-key-change-in-production
9
+ BETTER_AUTH_SECRET={{authSecret}}
10
10
 
11
11
  # Email Adapter (console | smtp)
12
12
  MAIL_ADAPTER=console
@@ -11,9 +11,20 @@
11
11
  "dev": "bun --bun vite dev --port 3000",
12
12
  "build": "vite build",
13
13
  "start": "bun run .output/server/index.mjs",
14
- "check-types": "tsc --noEmit"
14
+ "check-types": "tsc --noEmit",
15
+ "routes:generate": "tsr generate",
16
+ "questpie:generate": "questpie generate -c src/questpie/server/questpie.config.ts",
17
+ "scaffold:generate": "bun run routes:generate && bun run questpie:generate",
18
+ "migrate": "questpie migrate -c questpie.config.ts",
19
+ "migrate:create": "questpie migrate:create -c questpie.config.ts",
20
+ "migrate:status": "questpie migrate:status -c questpie.config.ts",
21
+ "migrate:down": "questpie migrate:down -c questpie.config.ts",
22
+ "migrate:reset": "questpie migrate:reset -c questpie.config.ts",
23
+ "migrate:fresh": "questpie migrate:fresh -c questpie.config.ts",
24
+ "scaffold:verify": "bun run scaffold:generate && bun run check-types"
15
25
  },
16
26
  "dependencies": {
27
+ "@electric-sql/pglite": "^0.3.14",
17
28
  "@questpie/admin": "latest",
18
29
  "@questpie/openapi": "latest",
19
30
  "@questpie/tanstack-query": "latest",
@@ -22,28 +33,31 @@
22
33
  "@tanstack/react-router": "^1.132.0",
23
34
  "@tanstack/react-start": "^1.132.0",
24
35
  "drizzle-orm": "1.0.0-beta.6-4414a19",
36
+ "nodemailer": "^7.0.12",
37
+ "pg": "^8.13.1",
38
+ "pg-boss": "^12.5.4",
25
39
  "questpie": "latest",
26
40
  "react": "^19.0.0",
27
41
  "react-dom": "^19.0.0",
28
42
  "zod": "^4.2.1"
29
43
  },
30
44
  "devDependencies": {
31
- "@iconify/json": ">=2",
32
- "@questpie/vite-plugin-iconify": "latest",
33
45
  "@tailwindcss/vite": "^4.0.0",
34
46
  "@tanstack/devtools-vite": "latest",
35
47
  "@tanstack/react-devtools": "latest",
36
48
  "@tanstack/react-router-devtools": "latest",
49
+ "@tanstack/router-cli": "^1.132.0",
37
50
  "@types/react": "^19.0.0",
38
51
  "@types/react-dom": "^19.0.0",
39
- "@vitejs/plugin-react": "^4.4.1",
52
+ "@vitejs/plugin-react": "^6.0.1",
40
53
  "bun-types": "latest",
41
54
  "drizzle-kit": "1.0.0-beta.6-4414a19",
42
55
  "nitro": "latest",
56
+ "shadcn": "^3.6.1",
43
57
  "tailwindcss": "^4.0.0",
44
58
  "tw-animate-css": "^1.0.0",
45
59
  "typescript": "^5.9.2",
46
- "vite": "^6.3.0",
47
- "vite-tsconfig-paths": "^4.3.2"
60
+ "vite": "^8.0.0",
61
+ "vite-tsconfig-paths": "^6.1.1"
48
62
  }
49
63
  }
@@ -1,8 +1,8 @@
1
1
  import { createClient } from "questpie/client";
2
2
 
3
- import type { AppConfig, AppRpc } from "@/questpie/server/app.js";
3
+ import type { AppConfig } from "@/questpie/server/app.js";
4
4
 
5
- export const client = createClient<AppConfig, AppRpc>({
5
+ export const client = createClient<AppConfig>({
6
6
  baseURL:
7
7
  typeof window !== "undefined"
8
8
  ? window.location.origin
@@ -9,7 +9,7 @@ export const env = createEnv({
9
9
  .string()
10
10
  .transform(Number)
11
11
  .pipe(z.number().int().positive())
12
- .default("3000"),
12
+ .default(3000),
13
13
  BETTER_AUTH_SECRET: z.string().min(1).default("change-me-in-production"),
14
14
  MAIL_ADAPTER: z.enum(["console", "smtp"]).default("console"),
15
15
  SMTP_HOST: z.string().optional(),
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Admin Client Config
3
+ *
4
+ * Auto-generated by questpie codegen — do not edit.
5
+ *
6
+ * Pass this directly to <AdminLayoutProvider admin={admin} />
7
+ */
8
+
9
+ import { default as _modules } from "../modules";
10
+
11
+ const admin = _modules;
12
+
13
+ export default admin;
@@ -0,0 +1 @@
1
+ export { default } from "@questpie/admin/client-module";