create-questpie 2.0.3 → 2.1.0

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 (153) hide show
  1. package/dist/index.mjs +544 -87
  2. package/package.json +2 -3
  3. package/templates/elysia/AGENTS.md +56 -0
  4. package/templates/elysia/CLAUDE.md +39 -0
  5. package/templates/elysia/Dockerfile +24 -0
  6. package/templates/elysia/README.md +148 -0
  7. package/templates/elysia/docker/init-extensions.sql +11 -0
  8. package/templates/elysia/docker-compose.yml +21 -0
  9. package/templates/elysia/env.example +16 -0
  10. package/templates/elysia/gitignore +6 -0
  11. package/templates/elysia/package.json +47 -0
  12. package/templates/elysia/questpie.config.ts +12 -0
  13. package/templates/elysia/src/index.ts +21 -0
  14. package/templates/elysia/src/lib/auth-client.ts +32 -0
  15. package/templates/elysia/src/lib/client.ts +13 -0
  16. package/templates/elysia/src/lib/env.ts +24 -0
  17. package/templates/elysia/src/lib/query-client.ts +18 -0
  18. package/templates/elysia/src/lib/query.ts +18 -0
  19. package/templates/elysia/src/questpie/server/.generated/context.gen.ts +200 -0
  20. package/templates/elysia/src/questpie/server/.generated/entities.gen.ts +84 -0
  21. package/templates/elysia/src/questpie/server/.generated/factories.ts +65 -0
  22. package/templates/elysia/src/questpie/server/.generated/index.ts +131 -0
  23. package/templates/elysia/src/questpie/server/.generated/names.gen.ts +25 -0
  24. package/templates/elysia/src/questpie/server/app.ts +10 -0
  25. package/templates/elysia/src/questpie/server/collections/index.ts +1 -0
  26. package/templates/elysia/src/questpie/server/collections/posts.collection.ts +10 -0
  27. package/templates/elysia/src/questpie/server/config/auth.ts +8 -0
  28. package/templates/elysia/src/questpie/server/config/openapi.ts +10 -0
  29. package/templates/elysia/src/questpie/server/globals/index.ts +1 -0
  30. package/templates/elysia/src/questpie/server/globals/site-settings.global.ts +10 -0
  31. package/templates/elysia/src/questpie/server/modules.ts +8 -0
  32. package/templates/elysia/src/questpie/server/questpie.config.ts +21 -0
  33. package/templates/elysia/tsconfig.json +28 -0
  34. package/templates/hono/AGENTS.md +56 -0
  35. package/templates/hono/CLAUDE.md +39 -0
  36. package/templates/hono/Dockerfile +24 -0
  37. package/templates/hono/README.md +148 -0
  38. package/templates/hono/docker/init-extensions.sql +11 -0
  39. package/templates/hono/docker-compose.yml +21 -0
  40. package/templates/hono/env.example +16 -0
  41. package/templates/hono/gitignore +6 -0
  42. package/templates/hono/package.json +47 -0
  43. package/templates/hono/questpie.config.ts +12 -0
  44. package/templates/hono/src/index.ts +30 -0
  45. package/templates/hono/src/lib/auth-client.ts +32 -0
  46. package/templates/hono/src/lib/client.ts +13 -0
  47. package/templates/hono/src/lib/env.ts +24 -0
  48. package/templates/hono/src/lib/query-client.ts +18 -0
  49. package/templates/hono/src/lib/query.ts +18 -0
  50. package/templates/hono/src/questpie/server/.generated/context.gen.ts +200 -0
  51. package/templates/hono/src/questpie/server/.generated/entities.gen.ts +84 -0
  52. package/templates/hono/src/questpie/server/.generated/factories.ts +65 -0
  53. package/templates/hono/src/questpie/server/.generated/index.ts +131 -0
  54. package/templates/hono/src/questpie/server/.generated/names.gen.ts +25 -0
  55. package/templates/hono/src/questpie/server/app.ts +10 -0
  56. package/templates/hono/src/questpie/server/collections/index.ts +1 -0
  57. package/templates/hono/src/questpie/server/collections/posts.collection.ts +10 -0
  58. package/templates/hono/src/questpie/server/config/auth.ts +8 -0
  59. package/templates/hono/src/questpie/server/config/openapi.ts +10 -0
  60. package/templates/hono/src/questpie/server/globals/index.ts +1 -0
  61. package/templates/hono/src/questpie/server/globals/site-settings.global.ts +10 -0
  62. package/templates/hono/src/questpie/server/modules.ts +8 -0
  63. package/templates/hono/src/questpie/server/questpie.config.ts +21 -0
  64. package/templates/hono/tsconfig.json +28 -0
  65. package/templates/next/AGENTS.md +55 -0
  66. package/templates/next/CLAUDE.md +39 -0
  67. package/templates/next/Dockerfile +25 -0
  68. package/templates/next/README.md +148 -0
  69. package/templates/next/components.json +22 -0
  70. package/templates/next/docker/init-extensions.sql +11 -0
  71. package/templates/next/docker-compose.yml +21 -0
  72. package/templates/next/env.example +16 -0
  73. package/templates/next/gitignore +10 -0
  74. package/templates/next/next-env.d.ts +5 -0
  75. package/templates/next/next.config.ts +20 -0
  76. package/templates/next/package.json +54 -0
  77. package/templates/next/postcss.config.mjs +8 -0
  78. package/templates/next/public/.gitkeep +0 -0
  79. package/templates/next/questpie.config.ts +12 -0
  80. package/templates/next/src/app/admin/[[...all]]/page.tsx +34 -0
  81. package/templates/next/src/app/admin/admin.css +4 -0
  82. package/templates/next/src/app/admin/layout.tsx +63 -0
  83. package/templates/next/src/app/api/[...all]/route.ts +24 -0
  84. package/templates/next/src/app/layout.tsx +24 -0
  85. package/templates/next/src/app/not-found.tsx +18 -0
  86. package/templates/next/src/app/page.tsx +74 -0
  87. package/templates/next/src/app/providers.tsx +11 -0
  88. package/templates/next/src/lib/auth-client.ts +12 -0
  89. package/templates/next/src/lib/client.ts +13 -0
  90. package/templates/next/src/lib/env.ts +24 -0
  91. package/templates/next/src/lib/query-client.ts +18 -0
  92. package/templates/next/src/lib/query.ts +18 -0
  93. package/templates/next/src/questpie/admin/.generated/client.ts +13 -0
  94. package/templates/next/src/questpie/admin/admin.ts +9 -0
  95. package/templates/next/src/questpie/admin/modules.ts +3 -0
  96. package/templates/next/src/questpie/server/.generated/context.gen.ts +204 -0
  97. package/templates/next/src/questpie/server/.generated/entities.gen.ts +100 -0
  98. package/templates/next/src/questpie/server/.generated/factories.ts +204 -0
  99. package/templates/next/src/questpie/server/.generated/index.ts +139 -0
  100. package/templates/next/src/questpie/server/.generated/names.gen.ts +31 -0
  101. package/templates/next/src/questpie/server/app.ts +10 -0
  102. package/templates/next/src/questpie/server/collections/index.ts +1 -0
  103. package/templates/next/src/questpie/server/collections/posts.collection.ts +58 -0
  104. package/templates/next/src/questpie/server/config/admin.ts +80 -0
  105. package/templates/next/src/questpie/server/config/auth.ts +8 -0
  106. package/templates/next/src/questpie/server/config/openapi.ts +10 -0
  107. package/templates/next/src/questpie/server/globals/index.ts +1 -0
  108. package/templates/next/src/questpie/server/globals/site-settings.global.ts +19 -0
  109. package/templates/next/src/questpie/server/modules.ts +9 -0
  110. package/templates/next/src/questpie/server/questpie.config.ts +21 -0
  111. package/templates/next/src/styles.css +125 -0
  112. package/templates/next/tsconfig.json +37 -0
  113. package/templates/tanstack-start/AGENTS.md +35 -600
  114. package/templates/tanstack-start/CLAUDE.md +26 -127
  115. package/templates/tanstack-start/README.md +20 -7
  116. package/templates/tanstack-start/docker/init-extensions.sql +11 -0
  117. package/templates/tanstack-start/docker-compose.yml +1 -0
  118. package/templates/tanstack-start/package.json +1 -0
  119. package/templates/tanstack-start/src/lib/auth-client.ts +1 -1
  120. package/templates/tanstack-start/src/lib/client.ts +1 -1
  121. package/templates/tanstack-start/src/lib/query.ts +18 -0
  122. package/templates/tanstack-start/src/questpie/admin/modules.ts +3 -1
  123. package/templates/tanstack-start/src/questpie/server/.generated/factories.ts +10 -9
  124. package/templates/tanstack-start/src/questpie/server/collections/index.ts +1 -1
  125. package/templates/tanstack-start/src/questpie/server/config/auth.ts +1 -1
  126. package/templates/tanstack-start/src/questpie/server/globals/index.ts +1 -1
  127. package/templates/tanstack-start/src/questpie/server/modules.ts +4 -5
  128. package/templates/tanstack-start/src/questpie/server/questpie.config.ts +3 -2
  129. package/templates/tanstack-start/src/routes/__root.tsx +31 -1
  130. package/templates/tanstack-start/src/routes/api/$.ts +2 -3
  131. package/templates/tanstack-start/src/routes/index.tsx +97 -0
  132. package/templates/tanstack-start/vite.config.ts +2 -2
  133. package/skills/questpie/AGENTS.md +0 -2670
  134. package/skills/questpie/SKILL.md +0 -260
  135. package/skills/questpie/references/auth.md +0 -121
  136. package/skills/questpie/references/business-logic.md +0 -550
  137. package/skills/questpie/references/codegen-plugin-api.md +0 -382
  138. package/skills/questpie/references/crud-api.md +0 -378
  139. package/skills/questpie/references/data-modeling.md +0 -493
  140. package/skills/questpie/references/extend.md +0 -557
  141. package/skills/questpie/references/field-types.md +0 -386
  142. package/skills/questpie/references/infrastructure-adapters.md +0 -545
  143. package/skills/questpie/references/multi-tenancy.md +0 -364
  144. package/skills/questpie/references/production.md +0 -475
  145. package/skills/questpie/references/query-operators.md +0 -125
  146. package/skills/questpie/references/quickstart.md +0 -564
  147. package/skills/questpie/references/rules.md +0 -389
  148. package/skills/questpie/references/tanstack-query.md +0 -520
  149. package/skills/questpie-admin/AGENTS.md +0 -1508
  150. package/skills/questpie-admin/SKILL.md +0 -436
  151. package/skills/questpie-admin/references/blocks.md +0 -331
  152. package/skills/questpie-admin/references/custom-ui.md +0 -305
  153. package/skills/questpie-admin/references/views.md +0 -449
@@ -1,140 +1,39 @@
1
1
  # CLAUDE.md
2
2
 
3
- This is a [QUESTPIE](https://questpie.com) project scaffolded with `create-questpie`.
3
+ This is a [QUESTPIE](https://questpie.com) project. See **`AGENTS.md`** for the
4
+ full agent guide — it is the source of truth and this file mirrors it.
4
5
 
5
- ## Quick Reference
6
+ ## Use the QUESTPIE skills
6
7
 
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 |
8
+ - **`questpie`** — collections, globals, routes, jobs, codegen, auth, business
9
+ logic, typed client + TanStack Query.
10
+ - **`questpie-admin`** admin UI: views, blocks, custom fields, branding,
11
+ dashboard, live preview.
22
12
 
23
- ## Project Architecture
13
+ Invoke skills by name (the `/skill` convention); don't work from memory.
24
14
 
25
- This project follows QUESTPIE's **server-first** philosophy:
15
+ **If they aren't installed**, install them and then trim this file to a pointer:
26
16
 
27
- - **Server** defines WHAT (schema, validation, access, hooks, jobs)
28
- - **Client** defines HOW (rendering, themes, custom components)
29
-
30
- ```
31
- src/questpie/
32
- server/ ← WHAT: data contracts and behavior
33
- questpie.config.ts ← App config: runtimeConfig({ db, app, ... })
34
- modules.ts ← Module dependencies (adminModule, openApiModule, etc.)
35
- config/ ← Typed configuration files
36
- auth.ts ← authConfig({...}) — Better Auth options
37
- admin.ts ← adminConfig({ sidebar, dashboard, branding, locale })
38
- openapi.ts ← openApiConfig({ info, scalar })
39
- app.ts ← (optional) appConfig({ locale, access, hooks, context })
40
- .generated/ ← Codegen output (app instance + App type)
41
- index.ts
42
- collections/ ← One file per collection (auto-discovered)
43
- globals/ ← One file per global (auto-discovered)
44
- routes/ ← Server routes via route() (auto-discovered)
45
- jobs/ ← Background job definitions (auto-discovered)
46
- blocks/ ← Block definitions (auto-discovered)
47
- admin/ ← HOW: UI rendering concerns
48
- admin.ts ← Re-exports generated admin config
49
- .generated/ ← Codegen output (admin client config)
50
- client.ts
17
+ ```bash
18
+ bunx skills add questpie/questpie
51
19
  ```
52
20
 
53
- ## Key Files
54
-
55
- - **`src/questpie/server/questpie.config.ts`** — App config: `runtimeConfig({ db, app, ... })`.
56
- - **`src/questpie/server/modules.ts`** — Module dependencies: `export default [adminModule, openApiModule] as const`.
57
- - **`src/questpie/server/config/auth.ts`** — Auth config via `authConfig()` factory.
58
- - **`src/questpie/server/config/admin.ts`** — Admin config (sidebar, dashboard, branding, locale) via `adminConfig()` factory.
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.
61
- - **`src/lib/env.ts`** — Type-safe env variables via `@t3-oss/env-core`. Add new env vars here with Zod schemas.
62
- - **`questpie.config.ts`** — CLI config (migration directory, app reference).
63
- - **`src/routes/api/$.ts`** — API catch-all handler. Serves REST + OpenAPI docs at `/api/docs`.
64
-
65
- ## Environment Variables
66
-
67
- Defined in `src/lib/env.ts` with runtime validation. See `.env.example` for all available variables.
68
-
69
- Required:
70
-
71
- - `DATABASE_URL` — PostgreSQL connection string
72
-
73
- Optional (with defaults):
74
-
75
- - `APP_URL` — Application URL (default: `http://localhost:3000`)
76
- - `BETTER_AUTH_SECRET` — Auth secret key
77
- - `MAIL_ADAPTER` — `console` or `smtp`
78
-
79
- ## Common Tasks
80
-
81
- ### Add a new collection
82
-
83
- Preferred workflow:
84
-
85
- 1. Run `bun questpie add collection my-thing`
86
- 2. The CLI creates the file and auto-runs codegen
87
- 3. Run `bun run migrate:create`
21
+ ## Docs for LLMs
88
22
 
89
- Manual workflow:
23
+ - https://questpie.com/llms.txt — doc sitemap
24
+ - https://questpie.com/llms-full.txt — full docs in one LLM-optimized file
25
+ - http://localhost:3000/api/docs — live API reference (dev server running)
90
26
 
91
- 1. Create `src/questpie/server/collections/my-thing.ts` with a named export:
92
- ```ts
93
- import { collection } from "#questpie/factories";
94
- export const myThing = collection("my-thing").fields(({ f }) => ({ ... }));
95
- ```
96
- 2. Run `bun run questpie:generate` to regenerate `.generated/index.ts`
97
- 3. Run `bun run migrate:create` to generate migration
27
+ ## This project
98
28
 
99
- Collections are auto-discovered by codegen no manual registration needed.
29
+ - **Runtime**: TanStack Start + Vite + Nitro, package manager **Bun**
30
+ - **Database**: PostgreSQL (Drizzle ORM)
31
+ - **Auth**: Better Auth — extend the admin `user` collection, never replace it
32
+ - **Validation**: Zod **v4**
100
33
 
101
- ### Add a new global
102
-
103
- Preferred workflow:
104
-
105
- 1. Run `bun questpie add global my-global`
106
- 2. The CLI creates the file and auto-runs codegen
107
- 3. Run `bun run migrate:create`
108
-
109
- Manual workflow:
110
-
111
- 1. Create `src/questpie/server/globals/my-global.ts` with a named export
112
- 2. Run `bun run questpie:generate`
113
- 3. Run `bun run migrate:create`
114
-
115
- ### Add a server route (end-to-end type-safe)
116
-
117
- 1. Create `src/questpie/server/routes/my-function.ts`:
118
-
119
- ```ts
120
- import { route } from "questpie";
121
- import { z } from "zod";
122
-
123
- export default route()
124
- .post()
125
- .schema(z.object({ id: z.string() }))
126
- .handler(async ({ input, collections }) => {
127
- // input: typed from Zod schema; collections, db, session, etc. from AppContext
128
- return { name: "result" };
129
- });
130
- ```
131
-
132
- 2. Run `bun run questpie:generate` — route is auto-discovered and available at `/api/my-function`
133
-
134
- See AGENTS.md for detailed route patterns, access control, and TanStack Query integration.
135
-
136
- ## Documentation
137
-
138
- - **QUESTPIE Docs**: https://questpie.com/docs
139
- - **Getting Started**: https://questpie.com/docs/getting-started
140
- - **API Reference (local)**: http://localhost:3000/api/docs (Scalar UI, available when dev server is running)
34
+ ```bash
35
+ bun dev # Dev server (port 3000)
36
+ bun run scaffold:verify # Regenerate codegen + type-check
37
+ bun run db:push # Push schema to local dev DB
38
+ bun questpie add collection <name> # Scaffold an entity (auto-runs codegen)
39
+ ```
@@ -12,14 +12,14 @@ A [QUESTPIE](https://questpie.com) app built with TanStack Start.
12
12
  ### Setup
13
13
 
14
14
  ```bash
15
- # 1) Start PostgreSQL
15
+ # 1) Start PostgreSQL (also provisions required extensions for local dev)
16
16
  docker compose up -d
17
17
 
18
18
  # 2) Regenerate codegen and type-check
19
19
  bun run scaffold:verify
20
20
 
21
- # 3) Run migrations
22
- bun run migrate
21
+ # 3) Create local database tables
22
+ bun run db:push
23
23
 
24
24
  # 4) Start development server
25
25
  bun run dev
@@ -28,6 +28,18 @@ bun run dev
28
28
  - Admin panel: `http://localhost:3000/admin`
29
29
  - API docs (Scalar): `http://localhost:3000/api/docs`
30
30
 
31
+ ### Database extensions
32
+
33
+ QUESTPIE is drizzle-native and does **not** auto-create Postgres extensions. The
34
+ starter's full-text search relies on `pg_trgm` (trigram matching).
35
+
36
+ - **Local dev:** `docker compose up` provisions `pg_trgm` via
37
+ `docker/init-extensions.sql`, mounted into the postgres container's
38
+ `/docker-entrypoint-initdb.d/` and run once on first cluster init — so
39
+ `db:push` works out of the box.
40
+ - **Managed Postgres:** enable required extensions through your provider before
41
+ deploying. See [the QUESTPIE docs](https://questpie.com/docs) for details.
42
+
31
43
  ## Project Structure
32
44
 
33
45
  ```text
@@ -75,6 +87,7 @@ migrations/
75
87
  | `bun run routes:generate` | Regenerate TanStack Router route tree |
76
88
  | `bun run questpie:generate` | Regenerate `src/questpie/server/.generated/*` |
77
89
  | `bun questpie add <type> <name>` | Scaffold entity files (auto-runs codegen) |
90
+ | `bun run db:push` | Push schema directly to local dev database |
78
91
  | `bun run migrate` | Run migrations |
79
92
  | `bun run migrate:create` | Create migration |
80
93
 
@@ -84,14 +97,14 @@ Preferred workflow:
84
97
 
85
98
  1. Run `bun questpie add collection products`.
86
99
  2. The CLI creates the file and runs codegen automatically.
87
- 3. Run `bun run migrate:create`.
100
+ 3. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
88
101
 
89
102
  Manual workflow (when you create files by hand):
90
103
 
91
104
  1. Create a file in `src/questpie/server/collections/`.
92
105
  2. Export a collection builder from that file.
93
106
  3. Run `bun run questpie:generate`.
94
- 4. Run `bun run migrate:create`.
107
+ 4. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
95
108
 
96
109
  Collections are discovered automatically by codegen. No manual `app.ts` registration is required.
97
110
 
@@ -101,13 +114,13 @@ Preferred workflow:
101
114
 
102
115
  1. Run `bun questpie add global marketing`.
103
116
  2. The CLI creates the file and runs codegen automatically.
104
- 3. Run `bun run migrate:create`.
117
+ 3. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
105
118
 
106
119
  Manual workflow (when you create files by hand):
107
120
 
108
121
  1. Create a file in `src/questpie/server/globals/`.
109
122
  2. Export a global builder from that file.
110
123
  3. Run `bun run questpie:generate`.
111
- 4. Run `bun run migrate:create`.
124
+ 4. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
112
125
 
113
126
  Globals are discovered automatically by codegen. No manual `app.ts` registration is required.
@@ -0,0 +1,11 @@
1
+ -- Postgres extensions provisioned for local development.
2
+ -- Mounted into the postgres container at /docker-entrypoint-initdb.d/ and run
3
+ -- once, on first cluster init, before the app connects.
4
+ --
5
+ -- QUESTPIE is drizzle-native: the app does NOT auto-create extensions. The
6
+ -- starter's full-text search uses pg_trgm (trigram matching), so we provision
7
+ -- it here to keep `db:push` working out-of-the-box while you prototype.
8
+ --
9
+ -- On managed Postgres, enable required extensions via your provider instead.
10
+ -- See https://questpie.com/docs for details.
11
+ CREATE EXTENSION IF NOT EXISTS "pg_trgm";
@@ -10,6 +10,7 @@ services:
10
10
  - "5432:5432"
11
11
  volumes:
12
12
  - postgres_data:/var/lib/postgresql/data
13
+ - ./docker/init-extensions.sql:/docker-entrypoint-initdb.d/init-extensions.sql:ro
13
14
  healthcheck:
14
15
  test: ["CMD-SHELL", "pg_isready -U {{databaseUser}}"]
15
16
  interval: 5s
@@ -15,6 +15,7 @@
15
15
  "routes:generate": "tsr generate",
16
16
  "questpie:generate": "questpie generate -c src/questpie/server/questpie.config.ts",
17
17
  "scaffold:generate": "bun run routes:generate && bun run questpie:generate",
18
+ "db:push": "questpie push -c questpie.config.ts",
18
19
  "migrate": "questpie migrate -c questpie.config.ts",
19
20
  "migrate:create": "questpie migrate:create -c questpie.config.ts",
20
21
  "migrate:status": "questpie migrate:status -c questpie.config.ts",
@@ -1,4 +1,4 @@
1
- import type { AppConfig } from "@/questpie/server/app.js";
1
+ import type { AppConfig } from "@/questpie/server/app";
2
2
  import { createAdminAuthClient } from "@questpie/admin/client";
3
3
 
4
4
  export const authClient = createAdminAuthClient<AppConfig>({
@@ -1,6 +1,6 @@
1
1
  import { createClient } from "questpie/client";
2
2
 
3
- import type { AppConfig } from "@/questpie/server/app.js";
3
+ import type { AppConfig } from "@/questpie/server/app";
4
4
 
5
5
  export const client = createClient<AppConfig>({
6
6
  baseURL:
@@ -0,0 +1,18 @@
1
+ import { createQuestpieQueryOptions } from "@questpie/tanstack-query";
2
+
3
+ import { client } from "@/lib/client";
4
+
5
+ /**
6
+ * Typed TanStack Query option builders for this project.
7
+ *
8
+ * `q.collections.*`, `q.globals.*`, and `q.routes.*` return `queryOptions()` /
9
+ * `mutationOptions()` objects you pass straight into `useQuery` / `useMutation`.
10
+ * Full type inference flows from the server schema via `AppConfig`.
11
+ *
12
+ * @example
13
+ * const { data } = useQuery(q.collections.posts.find({ limit: 10 }));
14
+ * const create = useMutation(q.collections.posts.create());
15
+ */
16
+ export const q = createQuestpieQueryOptions(client);
17
+
18
+ export type QueryOptions = typeof q;
@@ -1 +1,3 @@
1
- export { default } from "@questpie/admin/client-module";
1
+ import { adminClientModule } from "@questpie/admin/client/modules/admin";
2
+
3
+ export default [adminClientModule] as const;
@@ -3,10 +3,10 @@
3
3
  // Typed factory functions with plugin extensions. Regenerate with: questpie generate
4
4
 
5
5
  // ── Core Imports ───────────────────────────────────────────
6
- import { CollectionBuilder, GlobalBuilder, wrapBuilderWithExtensions, builtinFields, type EmptyCollectionState, type EmptyGlobalState, type BuiltinFields, Field } from "questpie";
6
+ import { CollectionBuilder, GlobalBuilder, wrapBuilderWithExtensions, builtinFields, type EmptyCollectionState, type EmptyGlobalState, type BuiltinFields, Field } from "questpie/builders";
7
7
 
8
8
  // ── Runtime Field Imports ──────────────────────────────────
9
- import { adminFields } from "@questpie/admin/server";
9
+ import { adminFields } from "@questpie/admin/fields";
10
10
 
11
11
  const _fieldExt: Record<string, { stateKey: string; resolve: (v: any) => any }> = {
12
12
  admin: { stateKey: "admin", resolve: (v: any) => v },
@@ -32,8 +32,9 @@ const _allFieldDefs = Object.fromEntries(
32
32
  ) as unknown as typeof _rawFieldDefs;
33
33
 
34
34
  // ── Plugin Imports ─────────────────────────────────────────
35
- import { type AdminCollectionConfig, type AdminConfigContext, type ListViewConfig, type ListViewConfigContext, type FilterViewsByKind, type FormViewConfig, type FormViewConfigContext, type PreviewConfig, type ServerActionsConfig, type ActionsConfigContext, type AdminGlobalConfig, type AdminConfigInput, createViewCallbackProxy, createComponentCallbackProxy, createActionCallbackProxy } from "@questpie/admin/server";
36
- import { type AppConfigInput, type AuthConfig, createFieldNameProxy } from "questpie";
35
+ import { type AdminCollectionConfig, type AdminConfigContext, type ListViewConfig, type ListViewConfigContext, type FilterViewsByKind, type FormViewConfig, type FormViewConfigContext, type PreviewConfig, type ServerActionsConfig, type ActionsConfigContext, type AdminGlobalConfig, type AdminConfigInput, createViewCallbackProxy, createComponentCallbackProxy, createActionCallbackProxy } from "@questpie/admin/factories";
36
+ import { type AppConfigInput, type AuthConfig } from "questpie/types";
37
+ import { createFieldNameProxy } from "questpie/builders";
37
38
  import { type OpenApiModuleConfig } from "@questpie/openapi";
38
39
 
39
40
  // ════════════════════════════════════════════════════════════
@@ -67,7 +68,7 @@ declare module "questpie" {
67
68
  }
68
69
  interface Field<TState> {
69
70
  admin(config: unknown): Field<TState>;
70
- form(configFn: (ctx: { f: Record<string, string> }) => { fields: import('@questpie/admin/server').FieldLayoutItem[] }): Field<TState>;
71
+ form(configFn: (ctx: { f: Record<string, string> }) => { fields: import('@questpie/admin/factories').FieldLayoutItem[] }): Field<TState>;
71
72
  }
72
73
  }
73
74
 
@@ -78,7 +79,7 @@ declare global {
78
79
  }
79
80
  }
80
81
 
81
- declare module "@questpie/admin/server" {
82
+ declare module "@questpie/admin/factories" {
82
83
  interface ComponentTypeRegistry extends Record<_ComponentsNames_Strict, {}> {}
83
84
  }
84
85
 
@@ -97,7 +98,7 @@ const _collExt: Record<string, { stateKey: string; resolve: (v: any) => any }> =
97
98
  list: {
98
99
  stateKey: "adminList",
99
100
  resolve(configOrFn: any) {
100
- const resolved = typeof configOrFn === 'function' ? configOrFn({ v: createViewCallbackProxy(), f: createFieldNameProxy(), a: createActionCallbackProxy() }) : configOrFn;
101
+ const resolved = typeof configOrFn === 'function' ? configOrFn({ v: createViewCallbackProxy(), f: createFieldNameProxy(), a: createActionCallbackProxy(), c: createComponentCallbackProxy() }) : configOrFn;
101
102
  return { ...{"view":"collection-table","showSearch":true,"showFilters":true,"showToolbar":true}, ...resolved };
102
103
  },
103
104
  },
@@ -167,11 +168,11 @@ export function global<TName extends string>(name: TName): GlobalBuilder<EmptyGl
167
168
  // Builder factory functions (plugin-contributed)
168
169
  // ════════════════════════════════════════════════════════════
169
170
 
170
- import { BlockBuilder } from "@questpie/admin/server";
171
+ import { BlockBuilder } from "@questpie/admin/factories";
171
172
  /**
172
173
  * Create a typed block builder with wrapped field defs.
173
174
  */
174
- export function block<TName extends string>(name: TName): import('@questpie/admin/server').BlockBuilder<{ name: TName }> {
175
+ export function block<TName extends string>(name: TName): import('@questpie/admin/factories').BlockBuilder<{ name: TName }> {
175
176
  return BlockBuilder.create(name, _allFieldDefs) as any;
176
177
  }
177
178
 
@@ -1 +1 @@
1
- export { posts } from "./posts.collection.js";
1
+ export { posts } from "./posts.collection";
@@ -1,4 +1,4 @@
1
- import { authConfig } from "questpie";
1
+ import { authConfig } from "questpie/app";
2
2
 
3
3
  export default authConfig({
4
4
  emailAndPassword: {
@@ -1 +1 @@
1
- export { siteSettings } from "./site-settings.global.js";
1
+ export { siteSettings } from "./site-settings.global";
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * Modules — static module dependencies for this project.
3
3
  */
4
- import { adminModule } from "@questpie/admin/server";
4
+ import { adminModule } from "@questpie/admin/modules/admin";
5
5
  import { openApiModule } from "@questpie/openapi";
6
6
 
7
- export default [
8
- adminModule,
9
- openApiModule,
10
- ] as const;
7
+ const modules = [adminModule, openApiModule] as const;
8
+
9
+ export default modules;
@@ -6,9 +6,10 @@
6
6
  * Admin sidebar, dashboard, and branding live in config/admin.ts.
7
7
  */
8
8
 
9
- import { ConsoleAdapter, runtimeConfig } from "questpie";
9
+ import { runtimeConfig } from "questpie/app";
10
+ import { ConsoleAdapter } from "questpie/adapters/console";
10
11
 
11
- import { env } from "@/lib/env.js";
12
+ import { env } from "@/lib/env";
12
13
 
13
14
  export default runtimeConfig({
14
15
  app: { url: env.APP_URL },
@@ -1,4 +1,11 @@
1
- import { createRootRoute } from "@tanstack/react-router";
1
+ import {
2
+ createRootRoute,
3
+ HeadContent,
4
+ Link,
5
+ Scripts,
6
+ } from "@tanstack/react-router";
7
+
8
+ import appCss from "../styles.css?url";
2
9
 
3
10
  export const Route = createRootRoute({
4
11
  head: () => ({
@@ -7,7 +14,30 @@ export const Route = createRootRoute({
7
14
  { name: "viewport", content: "width=device-width, initial-scale=1" },
8
15
  { title: "{{projectName}}" },
9
16
  ],
17
+ links: [{ rel: "stylesheet", href: appCss }],
10
18
  }),
19
+ notFoundComponent: () => (
20
+ <html lang="en">
21
+ <head>
22
+ <HeadContent />
23
+ </head>
24
+ <body className="bg-background text-foreground min-h-screen antialiased">
25
+ <main className="mx-auto flex min-h-screen max-w-md flex-col items-center justify-center px-6 text-center">
26
+ <h1 className="text-3xl font-bold tracking-tight">Page not found</h1>
27
+ <p className="text-muted-foreground mt-3">
28
+ The page you are looking for does not exist.
29
+ </p>
30
+ <Link
31
+ to="/"
32
+ className="text-primary mt-6 inline-block text-sm font-medium hover:underline"
33
+ >
34
+ Back to homepage
35
+ </Link>
36
+ </main>
37
+ <Scripts />
38
+ </body>
39
+ </html>
40
+ ),
11
41
  shellComponent: RootDocument,
12
42
  });
13
43
 
@@ -1,7 +1,6 @@
1
1
  import { createFileRoute } from "@tanstack/react-router";
2
- import { createFetchHandler } from "questpie";
3
-
4
- import { app } from "@/questpie/server/app.js";
2
+ import { createFetchHandler } from "questpie/http";
3
+ import { app } from "@/questpie/server/app";
5
4
 
6
5
  const handler = createFetchHandler(app, {
7
6
  basePath: "/api",
@@ -0,0 +1,97 @@
1
+ import {
2
+ createFileRoute,
3
+ HeadContent,
4
+ Link,
5
+ Scripts,
6
+ } from "@tanstack/react-router";
7
+
8
+ import appCss from "@/styles.css?url";
9
+
10
+ export const Route = createFileRoute("/")({
11
+ head: () => ({
12
+ title: "{{projectName}}",
13
+ links: [{ rel: "stylesheet", href: appCss }],
14
+ }),
15
+ component: Home,
16
+ });
17
+
18
+ function Home() {
19
+ return (
20
+ <html lang="en">
21
+ <head>
22
+ <HeadContent />
23
+ </head>
24
+ <body className="bg-background text-foreground min-h-screen antialiased">
25
+ <main className="mx-auto flex min-h-screen max-w-3xl flex-col items-center justify-center px-6 py-16 text-center">
26
+ <span className="text-muted-foreground mb-4 text-xs font-medium uppercase tracking-widest">
27
+ Powered by QUESTPIE
28
+ </span>
29
+ <h1 className="text-4xl font-bold tracking-tight sm:text-5xl">
30
+ {"{{projectName}}"}
31
+ </h1>
32
+ <p className="text-muted-foreground mt-4 text-lg">
33
+ Your QUESTPIE app is running. Here is where to go next.
34
+ </p>
35
+
36
+ <div className="mt-12 grid w-full grid-cols-1 gap-4 text-left sm:grid-cols-3">
37
+ <Link
38
+ to="/admin"
39
+ className="group hover:border-primary/30 block rounded-lg border p-5 transition-all hover:shadow-md"
40
+ >
41
+ <h2 className="group-hover:text-primary font-semibold transition-colors">
42
+ Admin panel
43
+ </h2>
44
+ <p className="text-muted-foreground mt-1 text-sm">
45
+ Manage your content and settings.
46
+ </p>
47
+ <span className="text-primary mt-3 inline-block text-sm font-medium">
48
+ Open /admin →
49
+ </span>
50
+ </Link>
51
+
52
+ <a
53
+ href="/api/docs"
54
+ className="group hover:border-primary/30 block rounded-lg border p-5 transition-all hover:shadow-md"
55
+ >
56
+ <h2 className="group-hover:text-primary font-semibold transition-colors">
57
+ API docs
58
+ </h2>
59
+ <p className="text-muted-foreground mt-1 text-sm">
60
+ Explore the REST API in Scalar.
61
+ </p>
62
+ <span className="text-primary mt-3 inline-block text-sm font-medium">
63
+ Open /api/docs →
64
+ </span>
65
+ </a>
66
+
67
+ <a
68
+ href="https://questpie.com/docs"
69
+ target="_blank"
70
+ rel="noreferrer"
71
+ className="group hover:border-primary/30 block rounded-lg border p-5 transition-all hover:shadow-md"
72
+ >
73
+ <h2 className="group-hover:text-primary font-semibold transition-colors">
74
+ Documentation
75
+ </h2>
76
+ <p className="text-muted-foreground mt-1 text-sm">
77
+ Learn the framework and patterns.
78
+ </p>
79
+ <span className="text-primary mt-3 inline-block text-sm font-medium">
80
+ questpie.com/docs →
81
+ </span>
82
+ </a>
83
+ </div>
84
+
85
+ <p className="text-muted-foreground mt-12 text-sm">
86
+ Edit{" "}
87
+ <code className="bg-muted rounded px-1.5 py-0.5 font-mono text-xs">
88
+ src/routes/index.tsx
89
+ </code>{" "}
90
+ to change this page.
91
+ </p>
92
+ </main>
93
+ <Scripts />
94
+ </body>
95
+ </html>
96
+ );
97
+ }
@@ -3,13 +3,13 @@ import { devtools } from "@tanstack/devtools-vite";
3
3
  import { tanstackStart } from "@tanstack/react-start/plugin/vite";
4
4
  import viteReact from "@vitejs/plugin-react";
5
5
  import { nitro } from "nitro/vite";
6
- import { defineConfig } from "vite";
6
+ import { defineConfig, type PluginOption } from "vite";
7
7
  import viteTsConfigPaths from "vite-tsconfig-paths";
8
8
 
9
9
  export default defineConfig({
10
10
  plugins: [
11
11
  devtools(),
12
- nitro({ preset: "bun" }) as any,
12
+ nitro({ preset: "bun" }) as unknown as PluginOption,
13
13
  viteTsConfigPaths({ projects: ["./tsconfig.json"] }),
14
14
  tailwindcss(),
15
15
  tanstackStart(),