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.
- package/dist/index.mjs +544 -87
- package/package.json +2 -3
- package/templates/elysia/AGENTS.md +56 -0
- package/templates/elysia/CLAUDE.md +39 -0
- package/templates/elysia/Dockerfile +24 -0
- package/templates/elysia/README.md +148 -0
- package/templates/elysia/docker/init-extensions.sql +11 -0
- package/templates/elysia/docker-compose.yml +21 -0
- package/templates/elysia/env.example +16 -0
- package/templates/elysia/gitignore +6 -0
- package/templates/elysia/package.json +47 -0
- package/templates/elysia/questpie.config.ts +12 -0
- package/templates/elysia/src/index.ts +21 -0
- package/templates/elysia/src/lib/auth-client.ts +32 -0
- package/templates/elysia/src/lib/client.ts +13 -0
- package/templates/elysia/src/lib/env.ts +24 -0
- package/templates/elysia/src/lib/query-client.ts +18 -0
- package/templates/elysia/src/lib/query.ts +18 -0
- package/templates/elysia/src/questpie/server/.generated/context.gen.ts +200 -0
- package/templates/elysia/src/questpie/server/.generated/entities.gen.ts +84 -0
- package/templates/elysia/src/questpie/server/.generated/factories.ts +65 -0
- package/templates/elysia/src/questpie/server/.generated/index.ts +131 -0
- package/templates/elysia/src/questpie/server/.generated/names.gen.ts +25 -0
- package/templates/elysia/src/questpie/server/app.ts +10 -0
- package/templates/elysia/src/questpie/server/collections/index.ts +1 -0
- package/templates/elysia/src/questpie/server/collections/posts.collection.ts +10 -0
- package/templates/elysia/src/questpie/server/config/auth.ts +8 -0
- package/templates/elysia/src/questpie/server/config/openapi.ts +10 -0
- package/templates/elysia/src/questpie/server/globals/index.ts +1 -0
- package/templates/elysia/src/questpie/server/globals/site-settings.global.ts +10 -0
- package/templates/elysia/src/questpie/server/modules.ts +8 -0
- package/templates/elysia/src/questpie/server/questpie.config.ts +21 -0
- package/templates/elysia/tsconfig.json +28 -0
- package/templates/hono/AGENTS.md +56 -0
- package/templates/hono/CLAUDE.md +39 -0
- package/templates/hono/Dockerfile +24 -0
- package/templates/hono/README.md +148 -0
- package/templates/hono/docker/init-extensions.sql +11 -0
- package/templates/hono/docker-compose.yml +21 -0
- package/templates/hono/env.example +16 -0
- package/templates/hono/gitignore +6 -0
- package/templates/hono/package.json +47 -0
- package/templates/hono/questpie.config.ts +12 -0
- package/templates/hono/src/index.ts +30 -0
- package/templates/hono/src/lib/auth-client.ts +32 -0
- package/templates/hono/src/lib/client.ts +13 -0
- package/templates/hono/src/lib/env.ts +24 -0
- package/templates/hono/src/lib/query-client.ts +18 -0
- package/templates/hono/src/lib/query.ts +18 -0
- package/templates/hono/src/questpie/server/.generated/context.gen.ts +200 -0
- package/templates/hono/src/questpie/server/.generated/entities.gen.ts +84 -0
- package/templates/hono/src/questpie/server/.generated/factories.ts +65 -0
- package/templates/hono/src/questpie/server/.generated/index.ts +131 -0
- package/templates/hono/src/questpie/server/.generated/names.gen.ts +25 -0
- package/templates/hono/src/questpie/server/app.ts +10 -0
- package/templates/hono/src/questpie/server/collections/index.ts +1 -0
- package/templates/hono/src/questpie/server/collections/posts.collection.ts +10 -0
- package/templates/hono/src/questpie/server/config/auth.ts +8 -0
- package/templates/hono/src/questpie/server/config/openapi.ts +10 -0
- package/templates/hono/src/questpie/server/globals/index.ts +1 -0
- package/templates/hono/src/questpie/server/globals/site-settings.global.ts +10 -0
- package/templates/hono/src/questpie/server/modules.ts +8 -0
- package/templates/hono/src/questpie/server/questpie.config.ts +21 -0
- package/templates/hono/tsconfig.json +28 -0
- package/templates/next/AGENTS.md +55 -0
- package/templates/next/CLAUDE.md +39 -0
- package/templates/next/Dockerfile +25 -0
- package/templates/next/README.md +148 -0
- package/templates/next/components.json +22 -0
- package/templates/next/docker/init-extensions.sql +11 -0
- package/templates/next/docker-compose.yml +21 -0
- package/templates/next/env.example +16 -0
- package/templates/next/gitignore +10 -0
- package/templates/next/next-env.d.ts +5 -0
- package/templates/next/next.config.ts +20 -0
- package/templates/next/package.json +54 -0
- package/templates/next/postcss.config.mjs +8 -0
- package/templates/next/public/.gitkeep +0 -0
- package/templates/next/questpie.config.ts +12 -0
- package/templates/next/src/app/admin/[[...all]]/page.tsx +34 -0
- package/templates/next/src/app/admin/admin.css +4 -0
- package/templates/next/src/app/admin/layout.tsx +63 -0
- package/templates/next/src/app/api/[...all]/route.ts +24 -0
- package/templates/next/src/app/layout.tsx +24 -0
- package/templates/next/src/app/not-found.tsx +18 -0
- package/templates/next/src/app/page.tsx +74 -0
- package/templates/next/src/app/providers.tsx +11 -0
- package/templates/next/src/lib/auth-client.ts +12 -0
- package/templates/next/src/lib/client.ts +13 -0
- package/templates/next/src/lib/env.ts +24 -0
- package/templates/next/src/lib/query-client.ts +18 -0
- package/templates/next/src/lib/query.ts +18 -0
- package/templates/next/src/questpie/admin/.generated/client.ts +13 -0
- package/templates/next/src/questpie/admin/admin.ts +9 -0
- package/templates/next/src/questpie/admin/modules.ts +3 -0
- package/templates/next/src/questpie/server/.generated/context.gen.ts +204 -0
- package/templates/next/src/questpie/server/.generated/entities.gen.ts +100 -0
- package/templates/next/src/questpie/server/.generated/factories.ts +204 -0
- package/templates/next/src/questpie/server/.generated/index.ts +139 -0
- package/templates/next/src/questpie/server/.generated/names.gen.ts +31 -0
- package/templates/next/src/questpie/server/app.ts +10 -0
- package/templates/next/src/questpie/server/collections/index.ts +1 -0
- package/templates/next/src/questpie/server/collections/posts.collection.ts +58 -0
- package/templates/next/src/questpie/server/config/admin.ts +80 -0
- package/templates/next/src/questpie/server/config/auth.ts +8 -0
- package/templates/next/src/questpie/server/config/openapi.ts +10 -0
- package/templates/next/src/questpie/server/globals/index.ts +1 -0
- package/templates/next/src/questpie/server/globals/site-settings.global.ts +19 -0
- package/templates/next/src/questpie/server/modules.ts +9 -0
- package/templates/next/src/questpie/server/questpie.config.ts +21 -0
- package/templates/next/src/styles.css +125 -0
- package/templates/next/tsconfig.json +37 -0
- package/templates/tanstack-start/AGENTS.md +35 -600
- package/templates/tanstack-start/CLAUDE.md +26 -127
- package/templates/tanstack-start/README.md +20 -7
- package/templates/tanstack-start/docker/init-extensions.sql +11 -0
- package/templates/tanstack-start/docker-compose.yml +1 -0
- package/templates/tanstack-start/package.json +1 -0
- package/templates/tanstack-start/src/lib/auth-client.ts +1 -1
- package/templates/tanstack-start/src/lib/client.ts +1 -1
- package/templates/tanstack-start/src/lib/query.ts +18 -0
- package/templates/tanstack-start/src/questpie/admin/modules.ts +3 -1
- package/templates/tanstack-start/src/questpie/server/.generated/factories.ts +10 -9
- package/templates/tanstack-start/src/questpie/server/collections/index.ts +1 -1
- package/templates/tanstack-start/src/questpie/server/config/auth.ts +1 -1
- package/templates/tanstack-start/src/questpie/server/globals/index.ts +1 -1
- package/templates/tanstack-start/src/questpie/server/modules.ts +4 -5
- package/templates/tanstack-start/src/questpie/server/questpie.config.ts +3 -2
- package/templates/tanstack-start/src/routes/__root.tsx +31 -1
- package/templates/tanstack-start/src/routes/api/$.ts +2 -3
- package/templates/tanstack-start/src/routes/index.tsx +97 -0
- package/templates/tanstack-start/vite.config.ts +2 -2
- package/skills/questpie/AGENTS.md +0 -2670
- package/skills/questpie/SKILL.md +0 -260
- package/skills/questpie/references/auth.md +0 -121
- package/skills/questpie/references/business-logic.md +0 -550
- package/skills/questpie/references/codegen-plugin-api.md +0 -382
- package/skills/questpie/references/crud-api.md +0 -378
- package/skills/questpie/references/data-modeling.md +0 -493
- package/skills/questpie/references/extend.md +0 -557
- package/skills/questpie/references/field-types.md +0 -386
- package/skills/questpie/references/infrastructure-adapters.md +0 -545
- package/skills/questpie/references/multi-tenancy.md +0 -364
- package/skills/questpie/references/production.md +0 -475
- package/skills/questpie/references/query-operators.md +0 -125
- package/skills/questpie/references/quickstart.md +0 -564
- package/skills/questpie/references/rules.md +0 -389
- package/skills/questpie/references/tanstack-query.md +0 -520
- package/skills/questpie-admin/AGENTS.md +0 -1508
- package/skills/questpie-admin/SKILL.md +0 -436
- package/skills/questpie-admin/references/blocks.md +0 -331
- package/skills/questpie-admin/references/custom-ui.md +0 -305
- package/skills/questpie-admin/references/views.md +0 -449
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for AI agents working in this [QUESTPIE](https://questpie.com) project.
|
|
4
|
+
|
|
5
|
+
## Use the QUESTPIE skills
|
|
6
|
+
|
|
7
|
+
This project is built on QUESTPIE. Do not work from memory — the framework is
|
|
8
|
+
codegen-driven and the APIs evolve. Lean on the installed skills:
|
|
9
|
+
|
|
10
|
+
- **`questpie`** — collections, globals, routes, jobs, codegen, auth, business
|
|
11
|
+
logic, the typed client + TanStack Query. Invoke it for any server/data work.
|
|
12
|
+
- **`questpie-admin`** — admin UI: views, blocks, custom fields, branding,
|
|
13
|
+
dashboard, live preview. Invoke it for any admin panel work.
|
|
14
|
+
|
|
15
|
+
Invoke skills by name (the `/skill` convention) — they are commands, not files
|
|
16
|
+
to read.
|
|
17
|
+
|
|
18
|
+
**If those skills are NOT installed**, install them first, then trim this file:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
bunx skills add questpie/questpie
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
After installing, replace the body of this file with a one-line pointer to the
|
|
25
|
+
skills above — they are the always-current source of truth and this doc should
|
|
26
|
+
not duplicate them.
|
|
27
|
+
|
|
28
|
+
## Docs for LLMs
|
|
29
|
+
|
|
30
|
+
When a skill isn't enough, consult:
|
|
31
|
+
|
|
32
|
+
- https://questpie.com/llms.txt — doc sitemap
|
|
33
|
+
- https://questpie.com/llms-full.txt — full docs in one LLM-optimized file
|
|
34
|
+
- http://localhost:3000/api/docs — live API reference (Scalar, dev server running)
|
|
35
|
+
|
|
36
|
+
## This project
|
|
37
|
+
|
|
38
|
+
- **Runtime**: Next.js (App Router) + React, package manager **Bun**
|
|
39
|
+
- **Database**: PostgreSQL via Drizzle ORM (Postgres extensions are not
|
|
40
|
+
auto-created — see `README.md`)
|
|
41
|
+
- **Auth**: Better Auth (email/password); the `user` collection ships with
|
|
42
|
+
admin — extend it, never replace it
|
|
43
|
+
- **Validation**: Zod **v4** (not v3)
|
|
44
|
+
- **Source layout**: server contracts in `src/questpie/server/`, admin UI in
|
|
45
|
+
`src/questpie/admin/`, HTTP mount in `src/app/api/[...all]/route.ts`, admin
|
|
46
|
+
mount in `src/app/admin/`, typed client in `src/lib/`
|
|
47
|
+
|
|
48
|
+
## Key scripts
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bun dev # Start dev server (port 3000)
|
|
52
|
+
bun run scaffold:verify # Regenerate codegen + type-check
|
|
53
|
+
bun run db:push # Push schema to the local dev database
|
|
54
|
+
bun questpie add collection <name> # Scaffold an entity (auto-runs codegen)
|
|
55
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
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.
|
|
5
|
+
|
|
6
|
+
## Use the QUESTPIE skills
|
|
7
|
+
|
|
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.
|
|
12
|
+
|
|
13
|
+
Invoke skills by name (the `/skill` convention); don't work from memory.
|
|
14
|
+
|
|
15
|
+
**If they aren't installed**, install them and then trim this file to a pointer:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
bunx skills add questpie/questpie
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Docs for LLMs
|
|
22
|
+
|
|
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)
|
|
26
|
+
|
|
27
|
+
## This project
|
|
28
|
+
|
|
29
|
+
- **Runtime**: Next.js (App Router) + React, package manager **Bun**
|
|
30
|
+
- **Database**: PostgreSQL (Drizzle ORM)
|
|
31
|
+
- **Auth**: Better Auth — extend the admin `user` collection, never replace it
|
|
32
|
+
- **Validation**: Zod **v4**
|
|
33
|
+
|
|
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
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM oven/bun:1.3-alpine AS base
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Install dependencies
|
|
6
|
+
FROM base AS deps
|
|
7
|
+
COPY package.json bun.lock* ./
|
|
8
|
+
RUN bun install --frozen-lockfile
|
|
9
|
+
|
|
10
|
+
# Build application
|
|
11
|
+
FROM base AS builder
|
|
12
|
+
COPY --from=deps /app/node_modules ./node_modules
|
|
13
|
+
COPY . .
|
|
14
|
+
RUN bun run build
|
|
15
|
+
|
|
16
|
+
# Production image
|
|
17
|
+
FROM base AS runner
|
|
18
|
+
ENV NODE_ENV=production
|
|
19
|
+
ENV PORT=3000
|
|
20
|
+
COPY --from=builder /app/.next ./.next
|
|
21
|
+
COPY --from=builder /app/public ./public
|
|
22
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
23
|
+
COPY --from=builder /app/package.json ./package.json
|
|
24
|
+
EXPOSE 3000
|
|
25
|
+
CMD ["bun", "run", "start"]
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
A [QUESTPIE](https://questpie.com) app built with Next.js (App Router).
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- [Bun](https://bun.sh) v1.3+
|
|
10
|
+
- [Docker](https://docker.com) (for local PostgreSQL)
|
|
11
|
+
|
|
12
|
+
### Setup
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# 1) Start PostgreSQL (also provisions required extensions for local dev)
|
|
16
|
+
docker compose up -d
|
|
17
|
+
|
|
18
|
+
# 2) Regenerate codegen and type-check
|
|
19
|
+
bun run scaffold:verify
|
|
20
|
+
|
|
21
|
+
# 3) Create local database tables
|
|
22
|
+
bun run db:push
|
|
23
|
+
|
|
24
|
+
# 4) Start development server
|
|
25
|
+
bun run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Admin panel: `http://localhost:3000/admin`
|
|
29
|
+
- API docs (Scalar): `http://localhost:3000/api/docs`
|
|
30
|
+
|
|
31
|
+
## What you get
|
|
32
|
+
|
|
33
|
+
- A typed **admin panel** at `/admin` (views, dashboard, auth, media).
|
|
34
|
+
- A REST API with interactive **Scalar docs** at `/api/docs`.
|
|
35
|
+
- A fully **typed client** (`src/lib/client.ts`) plus TanStack Query option
|
|
36
|
+
builders (`src/lib/query.ts`) — full inference from your server schema.
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
|
|
40
|
+
- [Quickstart](https://questpie.com/docs/quickstart)
|
|
41
|
+
- [Data modeling](https://questpie.com/docs/data-modeling)
|
|
42
|
+
- [Auth](https://questpie.com/docs/auth)
|
|
43
|
+
- [TanStack Query](https://questpie.com/docs/tanstack-query)
|
|
44
|
+
- [Deployment](https://questpie.com/docs/deployment)
|
|
45
|
+
|
|
46
|
+
### Database extensions
|
|
47
|
+
|
|
48
|
+
QUESTPIE is drizzle-native and does **not** auto-create Postgres extensions. The
|
|
49
|
+
starter's full-text search relies on `pg_trgm` (trigram matching).
|
|
50
|
+
|
|
51
|
+
- **Local dev:** `docker compose up` provisions `pg_trgm` via
|
|
52
|
+
`docker/init-extensions.sql`, mounted into the postgres container's
|
|
53
|
+
`/docker-entrypoint-initdb.d/` and run once on first cluster init — so
|
|
54
|
+
`db:push` works out of the box.
|
|
55
|
+
- **Managed Postgres:** enable required extensions through your provider before
|
|
56
|
+
deploying. See [the QUESTPIE docs](https://questpie.com/docs) for details.
|
|
57
|
+
|
|
58
|
+
## Project Structure
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
src/
|
|
62
|
+
app/
|
|
63
|
+
layout.tsx # Root layout + providers
|
|
64
|
+
providers.tsx # QueryClientProvider
|
|
65
|
+
page.tsx # Landing page
|
|
66
|
+
not-found.tsx # 404 page
|
|
67
|
+
api/
|
|
68
|
+
[...all]/route.ts # QUESTPIE fetch handler mount
|
|
69
|
+
admin/
|
|
70
|
+
layout.tsx # AdminLayoutProvider (Next adapter)
|
|
71
|
+
admin.css # Admin Tailwind entry
|
|
72
|
+
[[...all]]/page.tsx # Admin router + login
|
|
73
|
+
questpie/
|
|
74
|
+
server/
|
|
75
|
+
questpie.config.ts # Runtime config
|
|
76
|
+
modules.ts # Module list (admin/openapi/...)
|
|
77
|
+
config/
|
|
78
|
+
admin.ts # Admin sidebar/dashboard/branding
|
|
79
|
+
auth.ts # Auth config
|
|
80
|
+
openapi.ts # OpenAPI/Scalar config
|
|
81
|
+
app.ts # Re-export of generated app
|
|
82
|
+
.generated/ # Codegen output (do not edit manually)
|
|
83
|
+
collections/
|
|
84
|
+
posts.collection.ts
|
|
85
|
+
globals/
|
|
86
|
+
site-settings.global.ts
|
|
87
|
+
admin/
|
|
88
|
+
admin.ts # Re-export of generated admin config
|
|
89
|
+
modules.ts # Admin client module defaults
|
|
90
|
+
.generated/ # Admin client codegen output
|
|
91
|
+
lib/
|
|
92
|
+
env.ts
|
|
93
|
+
client.ts
|
|
94
|
+
auth-client.ts
|
|
95
|
+
query-client.ts
|
|
96
|
+
query.ts
|
|
97
|
+
migrations/
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Scripts
|
|
101
|
+
|
|
102
|
+
| Command | Description |
|
|
103
|
+
| -------------------------------- | --------------------------------------------- |
|
|
104
|
+
| `bun dev` | Start development server |
|
|
105
|
+
| `bun build` | Build for production |
|
|
106
|
+
| `bun start` | Start production server |
|
|
107
|
+
| `bun check-types` | Type check |
|
|
108
|
+
| `bun run scaffold:generate` | Regenerate QUESTPIE codegen |
|
|
109
|
+
| `bun run scaffold:verify` | Regenerate codegen and type-check |
|
|
110
|
+
| `bun run questpie:generate` | Regenerate `src/questpie/server/.generated/*` |
|
|
111
|
+
| `bun questpie add <type> <name>` | Scaffold entity files (auto-runs codegen) |
|
|
112
|
+
| `bun run db:push` | Push schema directly to local dev database |
|
|
113
|
+
| `bun run migrate` | Run migrations |
|
|
114
|
+
| `bun run migrate:create` | Create migration |
|
|
115
|
+
|
|
116
|
+
## Adding a Collection
|
|
117
|
+
|
|
118
|
+
Preferred workflow:
|
|
119
|
+
|
|
120
|
+
1. Run `bun questpie add collection products`.
|
|
121
|
+
2. The CLI creates the file and runs codegen automatically.
|
|
122
|
+
3. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
|
|
123
|
+
|
|
124
|
+
Manual workflow (when you create files by hand):
|
|
125
|
+
|
|
126
|
+
1. Create a file in `src/questpie/server/collections/`.
|
|
127
|
+
2. Export a collection builder from that file.
|
|
128
|
+
3. Run `bun run questpie:generate`.
|
|
129
|
+
4. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
|
|
130
|
+
|
|
131
|
+
Collections are discovered automatically by codegen. No manual `app.ts` registration is required.
|
|
132
|
+
|
|
133
|
+
## Adding a Global
|
|
134
|
+
|
|
135
|
+
Preferred workflow:
|
|
136
|
+
|
|
137
|
+
1. Run `bun questpie add global marketing`.
|
|
138
|
+
2. The CLI creates the file and runs codegen automatically.
|
|
139
|
+
3. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
|
|
140
|
+
|
|
141
|
+
Manual workflow (when you create files by hand):
|
|
142
|
+
|
|
143
|
+
1. Create a file in `src/questpie/server/globals/`.
|
|
144
|
+
2. Export a global builder from that file.
|
|
145
|
+
3. Run `bun run questpie:generate`.
|
|
146
|
+
4. Run `bun run db:push` for local development, or `bun run migrate:create` for production migrations.
|
|
147
|
+
|
|
148
|
+
Globals are discovered automatically by codegen. No manual `app.ts` registration is required.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-lyra",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "hugeicons",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|
|
@@ -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";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
services:
|
|
2
|
+
postgres:
|
|
3
|
+
image: postgres:17
|
|
4
|
+
container_name: {{projectName}}-postgres
|
|
5
|
+
environment:
|
|
6
|
+
POSTGRES_DB: {{databaseName}}
|
|
7
|
+
POSTGRES_USER: {{databaseUser}}
|
|
8
|
+
POSTGRES_PASSWORD: {{databasePassword}}
|
|
9
|
+
ports:
|
|
10
|
+
- "5432:5432"
|
|
11
|
+
volumes:
|
|
12
|
+
- postgres_data:/var/lib/postgresql/data
|
|
13
|
+
- ./docker/init-extensions.sql:/docker-entrypoint-initdb.d/init-extensions.sql:ro
|
|
14
|
+
healthcheck:
|
|
15
|
+
test: ["CMD-SHELL", "pg_isready -U {{databaseUser}}"]
|
|
16
|
+
interval: 5s
|
|
17
|
+
timeout: 5s
|
|
18
|
+
retries: 5
|
|
19
|
+
|
|
20
|
+
volumes:
|
|
21
|
+
postgres_data:
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
DATABASE_URL=postgresql://{{databaseUser}}:{{databasePassword}}@localhost:5432/{{databaseName}}
|
|
3
|
+
|
|
4
|
+
# Application
|
|
5
|
+
APP_URL=http://localhost:3000
|
|
6
|
+
PORT=3000
|
|
7
|
+
|
|
8
|
+
# Auth (Better Auth)
|
|
9
|
+
BETTER_AUTH_SECRET={{authSecret}}
|
|
10
|
+
|
|
11
|
+
# Email Adapter (console | smtp)
|
|
12
|
+
MAIL_ADAPTER=console
|
|
13
|
+
|
|
14
|
+
# SMTP (if using smtp adapter)
|
|
15
|
+
# SMTP_HOST=localhost
|
|
16
|
+
# SMTP_PORT=1025
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
const nextConfig: NextConfig = {
|
|
4
|
+
// QUESTPIE is a server framework: its server graph pulls in optional native
|
|
5
|
+
// deps (the S3 storage adapter's @aws-sdk/*, only needed if you use S3) and a
|
|
6
|
+
// dynamic `import()` in the code-execution adapter. Turbopack bundles route
|
|
7
|
+
// handlers eagerly and would choke on those, so the server-only packages must
|
|
8
|
+
// run via native Node `require` instead of being bundled.
|
|
9
|
+
serverExternalPackages: [
|
|
10
|
+
"questpie",
|
|
11
|
+
"@questpie/openapi",
|
|
12
|
+
"drizzle-kit",
|
|
13
|
+
"@aws-sdk/client-s3",
|
|
14
|
+
"bun",
|
|
15
|
+
"pino",
|
|
16
|
+
"pino-pretty",
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default nextConfig;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"imports": {
|
|
7
|
+
"#questpie": "./src/questpie/server/.generated/index.ts",
|
|
8
|
+
"#questpie/*": "./src/questpie/server/.generated/*"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "next dev --turbopack --port 3000",
|
|
12
|
+
"build": "next build --turbopack",
|
|
13
|
+
"start": "next start --port 3000",
|
|
14
|
+
"check-types": "tsc --noEmit",
|
|
15
|
+
"questpie:generate": "questpie generate -c src/questpie/server/questpie.config.ts",
|
|
16
|
+
"scaffold:generate": "bun run questpie:generate",
|
|
17
|
+
"db:push": "questpie push -c questpie.config.ts",
|
|
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 && tsc --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@electric-sql/pglite": "^0.3.14",
|
|
28
|
+
"@questpie/admin": "latest",
|
|
29
|
+
"@questpie/openapi": "latest",
|
|
30
|
+
"@questpie/tanstack-query": "latest",
|
|
31
|
+
"@t3-oss/env-core": "^0.12.0",
|
|
32
|
+
"@tanstack/react-query": "^5.62.11",
|
|
33
|
+
"drizzle-orm": "1.0.0-beta.6-4414a19",
|
|
34
|
+
"next": "^16.2.9",
|
|
35
|
+
"nodemailer": "^7.0.12",
|
|
36
|
+
"pg": "^8.13.1",
|
|
37
|
+
"pg-boss": "^12.5.4",
|
|
38
|
+
"questpie": "latest",
|
|
39
|
+
"react": "^19.2.0",
|
|
40
|
+
"react-dom": "^19.2.0",
|
|
41
|
+
"shadcn": "^3.6.1",
|
|
42
|
+
"zod": "^4.2.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@tailwindcss/postcss": "^4.0.0",
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"@types/react": "^19.2.0",
|
|
48
|
+
"@types/react-dom": "^19.2.0",
|
|
49
|
+
"drizzle-kit": "1.0.0-beta.6-4414a19",
|
|
50
|
+
"tailwindcss": "^4.0.0",
|
|
51
|
+
"tw-animate-css": "^1.0.0",
|
|
52
|
+
"typescript": "^5.9.2"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useParams, useRouter } from "next/navigation";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
|
|
6
|
+
import { AdminRouter, LoginPage } from "@questpie/admin/client";
|
|
7
|
+
|
|
8
|
+
export default function AdminCatchAll() {
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const params = useParams<{ all?: string[] }>();
|
|
11
|
+
const segments = params.all ?? [];
|
|
12
|
+
|
|
13
|
+
const navigate = useCallback(
|
|
14
|
+
(path: string) => {
|
|
15
|
+
router.push(path);
|
|
16
|
+
},
|
|
17
|
+
[router],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (segments[0] === "login") {
|
|
21
|
+
return (
|
|
22
|
+
<LoginPage
|
|
23
|
+
title="Welcome back"
|
|
24
|
+
description="Sign in to access admin panel"
|
|
25
|
+
showForgotPassword={false}
|
|
26
|
+
showSignUp={false}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<AdminRouter segments={segments} navigate={navigate} basePath="/admin" />
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
|
|
6
|
+
import { authClient } from "@/lib/auth-client";
|
|
7
|
+
import { client } from "@/lib/client";
|
|
8
|
+
import { queryClient } from "@/lib/query-client";
|
|
9
|
+
import { admin } from "@/questpie/admin/admin";
|
|
10
|
+
import { AdminLayoutProvider } from "@questpie/admin/client";
|
|
11
|
+
|
|
12
|
+
import "./admin.css";
|
|
13
|
+
|
|
14
|
+
function AdminLink({
|
|
15
|
+
to,
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
activeProps,
|
|
19
|
+
activeOptions,
|
|
20
|
+
}: {
|
|
21
|
+
to: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
activeProps?: { className?: string };
|
|
25
|
+
activeOptions?: { exact?: boolean };
|
|
26
|
+
}) {
|
|
27
|
+
const pathname = usePathname();
|
|
28
|
+
const isActive = activeOptions?.exact
|
|
29
|
+
? pathname === to
|
|
30
|
+
: pathname === to || pathname.startsWith(`${to}/`);
|
|
31
|
+
const mergedClassName = [className, isActive ? activeProps?.className : null]
|
|
32
|
+
.filter(Boolean)
|
|
33
|
+
.join(" ");
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Link href={to} className={mergedClassName || undefined}>
|
|
37
|
+
{children}
|
|
38
|
+
</Link>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function AdminLayout({
|
|
43
|
+
children,
|
|
44
|
+
}: {
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
}) {
|
|
47
|
+
const pathname = usePathname();
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<AdminLayoutProvider
|
|
51
|
+
admin={admin}
|
|
52
|
+
client={client}
|
|
53
|
+
queryClient={queryClient}
|
|
54
|
+
authClient={authClient}
|
|
55
|
+
LinkComponent={AdminLink}
|
|
56
|
+
activeRoute={pathname}
|
|
57
|
+
basePath="/admin"
|
|
58
|
+
useServerTranslations
|
|
59
|
+
>
|
|
60
|
+
{children}
|
|
61
|
+
</AdminLayoutProvider>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createFetchHandler } from "questpie/http";
|
|
2
|
+
|
|
3
|
+
import { app } from "@/questpie/server/app";
|
|
4
|
+
|
|
5
|
+
const handler = createFetchHandler(app, {
|
|
6
|
+
basePath: "/api",
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const handleCmsRequest = async (request: Request) => {
|
|
10
|
+
const response = await handler(request);
|
|
11
|
+
return (
|
|
12
|
+
response ??
|
|
13
|
+
new Response(JSON.stringify({ error: "Not found" }), {
|
|
14
|
+
status: 404,
|
|
15
|
+
headers: { "Content-Type": "application/json" },
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const GET = handleCmsRequest;
|
|
21
|
+
export const POST = handleCmsRequest;
|
|
22
|
+
export const PUT = handleCmsRequest;
|
|
23
|
+
export const DELETE = handleCmsRequest;
|
|
24
|
+
export const PATCH = handleCmsRequest;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Metadata } from "next";
|
|
2
|
+
|
|
3
|
+
import { Providers } from "./providers";
|
|
4
|
+
|
|
5
|
+
import "@/styles.css";
|
|
6
|
+
|
|
7
|
+
export const metadata: Metadata = {
|
|
8
|
+
title: "{{projectName}}",
|
|
9
|
+
description: "A QUESTPIE powered app",
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default function RootLayout({
|
|
13
|
+
children,
|
|
14
|
+
}: {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}) {
|
|
17
|
+
return (
|
|
18
|
+
<html lang="en">
|
|
19
|
+
<body className="bg-background text-foreground min-h-screen antialiased">
|
|
20
|
+
<Providers>{children}</Providers>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Link from "next/link";
|
|
2
|
+
|
|
3
|
+
export default function NotFound() {
|
|
4
|
+
return (
|
|
5
|
+
<main className="mx-auto flex min-h-screen max-w-md flex-col items-center justify-center px-6 text-center">
|
|
6
|
+
<h1 className="text-3xl font-bold tracking-tight">Page not found</h1>
|
|
7
|
+
<p className="text-muted-foreground mt-3">
|
|
8
|
+
The page you are looking for does not exist.
|
|
9
|
+
</p>
|
|
10
|
+
<Link
|
|
11
|
+
href="/"
|
|
12
|
+
className="text-primary mt-6 inline-block text-sm font-medium hover:underline"
|
|
13
|
+
>
|
|
14
|
+
Back to homepage
|
|
15
|
+
</Link>
|
|
16
|
+
</main>
|
|
17
|
+
);
|
|
18
|
+
}
|