create-theokit 0.1.0-alpha.12 → 0.1.0-alpha.13
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/package.json +1 -1
- package/templates/api-only/README.md.tmpl +76 -0
- package/templates/api-only/package.json.tmpl +6 -1
- package/templates/dashboard/README.md.tmpl +74 -0
- package/templates/dashboard/package.json.tmpl +6 -1
- package/templates/default/package.json.tmpl +6 -1
- package/templates/postgres/README.md.tmpl +81 -0
- package/templates/postgres/package.json.tmpl +6 -1
- package/templates/saas/README.md.tmpl +101 -0
- package/templates/saas/package.json.tmpl +6 -1
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
TheoKit API-only project. Backend routes with Zod validation + typed responses — no frontend bundle, no React.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Set your provider key if you wire an agent route later
|
|
9
|
+
echo 'OPENROUTER_API_KEY=sk-or-v1-...' > .env
|
|
10
|
+
|
|
11
|
+
# 2. Boot the dev server
|
|
12
|
+
npx theokit dev
|
|
13
|
+
|
|
14
|
+
# 3. Probe the health route
|
|
15
|
+
curl http://localhost:3000/api/health
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
You should see `{"status":"ok"}`. The server is now serving the routes under `server/routes/`.
|
|
19
|
+
|
|
20
|
+
## Templates
|
|
21
|
+
|
|
22
|
+
- **default** — TheoUI chat composer + agent route.
|
|
23
|
+
- **dashboard** — nested layouts + sidebar.
|
|
24
|
+
- **api-only** (this one) — server routes without React.
|
|
25
|
+
- **postgres** — Drizzle ORM + migrations.
|
|
26
|
+
- **saas** — full app with auth, billing, sessions.
|
|
27
|
+
|
|
28
|
+
## What the framework auto-loads
|
|
29
|
+
|
|
30
|
+
- **`.env` → `process.env`**. Edit `.env`; restart the dev server.
|
|
31
|
+
- **`.theo/` build output cleanup** on every `theokit build`.
|
|
32
|
+
- **Route discovery** — every `server/routes/*.ts` becomes a wired endpoint.
|
|
33
|
+
|
|
34
|
+
## Project structure
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
server/
|
|
38
|
+
├── routes/
|
|
39
|
+
│ ├── health.ts GET /api/health — returns {status:"ok"}
|
|
40
|
+
│ └── users.ts CRUD /api/users — Zod-validated body
|
|
41
|
+
theo.config.ts Framework config
|
|
42
|
+
.env Secrets — never committed (.gitignore)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Sample requests
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Health check
|
|
49
|
+
curl http://localhost:3000/api/health
|
|
50
|
+
|
|
51
|
+
# Create a user (POST with JSON body)
|
|
52
|
+
curl -X POST http://localhost:3000/api/users \
|
|
53
|
+
-H 'Content-Type: application/json' \
|
|
54
|
+
-d '{"name":"Alice","email":"alice@example.com"}'
|
|
55
|
+
|
|
56
|
+
# List users
|
|
57
|
+
curl http://localhost:3000/api/users
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Common commands
|
|
61
|
+
|
|
62
|
+
| Command | What it does |
|
|
63
|
+
|---|---|
|
|
64
|
+
| `npx theokit dev` | Dev server with HMR + structured logs |
|
|
65
|
+
| `npx theokit build` | Production build → `.theo/` |
|
|
66
|
+
| `npx theokit start` | Serve the production build |
|
|
67
|
+
| `npx theokit routes` | List all routes detected |
|
|
68
|
+
| `npm run typecheck` | TypeScript strict check (no emit) |
|
|
69
|
+
|
|
70
|
+
## Add a new route
|
|
71
|
+
|
|
72
|
+
Drop a `.ts` file in `server/routes/`. Use `defineRoute` from `theokit/server` for Zod-validated handlers, or export `GET`/`POST` directly.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Apply your own. The TheoKit framework is Apache-2.0.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.1.0-alpha.
|
|
13
|
+
"theokit": "^0.1.0-alpha.13",
|
|
14
14
|
"react": "^19.0.0",
|
|
15
15
|
"react-dom": "^19.0.0"
|
|
16
16
|
},
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"typescript": "^5.7.0",
|
|
19
19
|
"@types/react": "^19.0.0",
|
|
20
20
|
"@types/react-dom": "^19.0.0"
|
|
21
|
+
},
|
|
22
|
+
"pnpm": {
|
|
23
|
+
"onlyBuiltDependencies": [
|
|
24
|
+
"esbuild"
|
|
25
|
+
]
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
TheoKit dashboard project. Build the app your agent lives in — with nested layouts and a sidebar wired from day one.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Set your provider key (OpenRouter recommended — one key, any model)
|
|
9
|
+
echo 'OPENROUTER_API_KEY=sk-or-v1-...' > .env
|
|
10
|
+
|
|
11
|
+
# 2. Boot the dev server
|
|
12
|
+
npx theokit dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Open the printed URL. The default surface is a dashboard shell with sidebar nav + content area, ready to host your agent panels.
|
|
16
|
+
|
|
17
|
+
## Templates
|
|
18
|
+
|
|
19
|
+
- **default** — TheoUI chat composer + agent route.
|
|
20
|
+
- **dashboard** (this one) — nested layouts + sidebar nav.
|
|
21
|
+
- **api-only** — server routes without React.
|
|
22
|
+
- **postgres** — Drizzle ORM + migrations.
|
|
23
|
+
- **saas** — full app with auth, billing, sessions.
|
|
24
|
+
|
|
25
|
+
## What the framework auto-loads
|
|
26
|
+
|
|
27
|
+
- **`.env` → `process.env`**. Edit `.env`; restart the dev server.
|
|
28
|
+
- **`.theo/` build output cleanup** on every `theokit build`.
|
|
29
|
+
- **Tailwind + `@usetheo/ui` styling** auto-configured for the TheoUI surface.
|
|
30
|
+
|
|
31
|
+
## Project structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
app/ Frontend (file-based routing with nested layouts)
|
|
35
|
+
├── layout.tsx root wrapper — TheoUI provider + theme
|
|
36
|
+
├── page.tsx / — dashboard home
|
|
37
|
+
├── dashboard/
|
|
38
|
+
│ ├── layout.tsx /dashboard/* — sidebar shell
|
|
39
|
+
│ └── page.tsx /dashboard — primary panel
|
|
40
|
+
server/ Backend (explicit routes)
|
|
41
|
+
├── routes/
|
|
42
|
+
│ └── health.ts GET /api/health
|
|
43
|
+
theo.config.ts Framework config
|
|
44
|
+
tailwind.config.ts Tailwind theme tokens
|
|
45
|
+
.env Secrets — never committed
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Common commands
|
|
49
|
+
|
|
50
|
+
| Command | What it does |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `npx theokit dev` | Dev server with HMR + devtools overlay |
|
|
53
|
+
| `npx theokit build` | Production build → `.theo/` |
|
|
54
|
+
| `npx theokit start` | Serve the production build |
|
|
55
|
+
| `npx theokit check` | Lint for upgrade-readiness |
|
|
56
|
+
| `npx theokit routes` | List all routes + actions detected |
|
|
57
|
+
| `npm run typecheck` | TypeScript strict check (no emit) |
|
|
58
|
+
|
|
59
|
+
## Add a new panel
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
mkdir -p app/dashboard/billing
|
|
63
|
+
cat > app/dashboard/billing/page.tsx <<'EOF'
|
|
64
|
+
export default function BillingPage() {
|
|
65
|
+
return <h2>Billing</h2>
|
|
66
|
+
}
|
|
67
|
+
EOF
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
The route appears at `/dashboard/billing` after HMR.
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
Apply your own. The TheoKit framework is Apache-2.0.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.1.0-alpha.
|
|
13
|
+
"theokit": "^0.1.0-alpha.13",
|
|
14
14
|
"react": "^19.0.0",
|
|
15
15
|
"react-dom": "^19.0.0"
|
|
16
16
|
},
|
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
"typescript": "^5.7.0",
|
|
19
19
|
"@types/react": "^19.0.0",
|
|
20
20
|
"@types/react-dom": "^19.0.0"
|
|
21
|
+
},
|
|
22
|
+
"pnpm": {
|
|
23
|
+
"onlyBuiltDependencies": [
|
|
24
|
+
"esbuild"
|
|
25
|
+
]
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"typecheck": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"theokit": "^0.1.0-alpha.
|
|
13
|
+
"theokit": "^0.1.0-alpha.13",
|
|
14
14
|
"@usetheo/sdk": "^1.2.0",
|
|
15
15
|
"@usetheo/ui": "^0.12.0-next.0",
|
|
16
16
|
"lucide-react": "^0.469.0",
|
|
@@ -25,5 +25,10 @@
|
|
|
25
25
|
"@types/react-dom": "^19.0.0",
|
|
26
26
|
"tailwindcss": "^4.0.0",
|
|
27
27
|
"@tailwindcss/vite": "^4.0.0"
|
|
28
|
+
},
|
|
29
|
+
"pnpm": {
|
|
30
|
+
"onlyBuiltDependencies": [
|
|
31
|
+
"esbuild"
|
|
32
|
+
]
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
TheoKit project with Postgres + Drizzle ORM wired. Schema-first, migration-aware, typed end-to-end.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 0. Provision Postgres
|
|
9
|
+
# Option A — local docker (one-liner):
|
|
10
|
+
docker run --name pg -e POSTGRES_PASSWORD=dev -p 5432:5432 -d postgres:16
|
|
11
|
+
# Option B — hosted: neon.tech, supabase.com, fly.io
|
|
12
|
+
|
|
13
|
+
# 1. Set env
|
|
14
|
+
cat > .env <<'EOF'
|
|
15
|
+
DATABASE_URL=postgres://postgres:dev@localhost:5432/postgres
|
|
16
|
+
OPENROUTER_API_KEY=sk-or-v1-...
|
|
17
|
+
EOF
|
|
18
|
+
|
|
19
|
+
# 2. Generate + apply migrations
|
|
20
|
+
pnpm db:generate
|
|
21
|
+
pnpm db:migrate
|
|
22
|
+
|
|
23
|
+
# 3. Boot the dev server
|
|
24
|
+
npx theokit dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Open the printed URL. The default surface includes a sample users API backed by Postgres.
|
|
28
|
+
|
|
29
|
+
## Templates
|
|
30
|
+
|
|
31
|
+
- **default** — TheoUI chat composer + agent route.
|
|
32
|
+
- **dashboard** — nested layouts + sidebar.
|
|
33
|
+
- **api-only** — server routes without React.
|
|
34
|
+
- **postgres** (this one) — Drizzle ORM + migrations.
|
|
35
|
+
- **saas** — full app with auth, billing, sessions.
|
|
36
|
+
|
|
37
|
+
## What the framework auto-loads
|
|
38
|
+
|
|
39
|
+
- **`.env` → `process.env`**. `DATABASE_URL` must be set before `pnpm db:migrate`.
|
|
40
|
+
- **`.theo/` build output cleanup** on every `theokit build`.
|
|
41
|
+
- **Drizzle schema** under `db/schema.ts` drives migrations + typed query builder.
|
|
42
|
+
|
|
43
|
+
## Project structure
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
app/ Frontend
|
|
47
|
+
├── page.tsx / — sample UI
|
|
48
|
+
server/
|
|
49
|
+
├── routes/
|
|
50
|
+
│ ├── health.ts GET /api/health
|
|
51
|
+
│ └── users.ts CRUD /api/users — backed by db.users
|
|
52
|
+
db/
|
|
53
|
+
├── schema.ts Drizzle schema (tables + relations)
|
|
54
|
+
├── client.ts Drizzle client (used by routes)
|
|
55
|
+
└── migrations/ Generated SQL files (committed)
|
|
56
|
+
drizzle.config.ts Drizzle CLI config
|
|
57
|
+
theo.config.ts Framework config
|
|
58
|
+
.env Secrets — never committed
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Common commands
|
|
62
|
+
|
|
63
|
+
| Command | What it does |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `npx theokit dev` | Dev server with HMR |
|
|
66
|
+
| `npx theokit build` | Production build |
|
|
67
|
+
| `npx theokit start` | Serve production build |
|
|
68
|
+
| `pnpm db:generate` | Generate SQL migration from `db/schema.ts` |
|
|
69
|
+
| `pnpm db:migrate` | Apply pending migrations to `DATABASE_URL` |
|
|
70
|
+
| `pnpm db:studio` | Open Drizzle Studio UI |
|
|
71
|
+
| `npm run typecheck` | TypeScript strict check |
|
|
72
|
+
|
|
73
|
+
## Troubleshooting
|
|
74
|
+
|
|
75
|
+
- **`pnpm db:migrate` fails with "ECONNREFUSED"** → check `DATABASE_URL` host:port + Postgres is running (`docker ps` or hosted dashboard).
|
|
76
|
+
- **`relation "users" does not exist`** → you forgot `pnpm db:migrate`. Run it.
|
|
77
|
+
- **Schema change not reflected** → `pnpm db:generate` first, then `pnpm db:migrate`.
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Apply your own. The TheoKit framework is Apache-2.0.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"db:studio": "drizzle-kit studio"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"theokit": "^0.1.0-alpha.
|
|
17
|
+
"theokit": "^0.1.0-alpha.13",
|
|
18
18
|
"react": "^19.0.0",
|
|
19
19
|
"react-dom": "^19.0.0",
|
|
20
20
|
"drizzle-orm": "^0.45.0",
|
|
@@ -26,5 +26,10 @@
|
|
|
26
26
|
"@types/react": "^19.0.0",
|
|
27
27
|
"@types/react-dom": "^19.0.0",
|
|
28
28
|
"drizzle-kit": "^0.31.0"
|
|
29
|
+
},
|
|
30
|
+
"pnpm": {
|
|
31
|
+
"onlyBuiltDependencies": [
|
|
32
|
+
"esbuild"
|
|
33
|
+
]
|
|
29
34
|
}
|
|
30
35
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# {{name}}
|
|
2
|
+
|
|
3
|
+
TheoKit SaaS template — auth, sessions, billing-ready, and an agent route. The full stack for shipping an account-aware product on day one.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 0. Provision Postgres (sessions + users)
|
|
9
|
+
docker run --name pg -e POSTGRES_PASSWORD=dev -p 5432:5432 -d postgres:16
|
|
10
|
+
# Or use a hosted Postgres (neon.tech / supabase.com)
|
|
11
|
+
|
|
12
|
+
# 1. Set env (generate a strong session secret)
|
|
13
|
+
cat > .env <<EOF
|
|
14
|
+
DATABASE_URL=postgres://postgres:dev@localhost:5432/postgres
|
|
15
|
+
SESSION_SECRET=$(openssl rand -base64 32)
|
|
16
|
+
OPENROUTER_API_KEY=sk-or-v1-...
|
|
17
|
+
EOF
|
|
18
|
+
|
|
19
|
+
# 2. Migrate the schema
|
|
20
|
+
pnpm db:generate
|
|
21
|
+
pnpm db:migrate
|
|
22
|
+
|
|
23
|
+
# 3. Boot the dev server
|
|
24
|
+
npx theokit dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Sample auth flow
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Register
|
|
31
|
+
curl -X POST http://localhost:3000/api/register \
|
|
32
|
+
-H 'Content-Type: application/json' \
|
|
33
|
+
-d '{"email":"alice@example.com","password":"strong-passphrase"}'
|
|
34
|
+
|
|
35
|
+
# Login (saves session cookie)
|
|
36
|
+
curl -X POST http://localhost:3000/api/login \
|
|
37
|
+
-H 'Content-Type: application/json' \
|
|
38
|
+
-d '{"email":"alice@example.com","password":"strong-passphrase"}' \
|
|
39
|
+
-c cookies.txt
|
|
40
|
+
|
|
41
|
+
# Authenticated request
|
|
42
|
+
curl http://localhost:3000/api/me -b cookies.txt
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Templates
|
|
46
|
+
|
|
47
|
+
- **default** — TheoUI chat composer + agent route.
|
|
48
|
+
- **dashboard** — nested layouts + sidebar.
|
|
49
|
+
- **api-only** — server routes without React.
|
|
50
|
+
- **postgres** — Drizzle ORM + migrations.
|
|
51
|
+
- **saas** (this one) — full app with auth, billing, sessions.
|
|
52
|
+
|
|
53
|
+
## What the framework auto-loads
|
|
54
|
+
|
|
55
|
+
- **`.env` → `process.env`**. `SESSION_SECRET`, `DATABASE_URL`, `OPENROUTER_API_KEY` all required.
|
|
56
|
+
- **Encrypted sessions** (AES-256-GCM) via `SESSION_SECRET`.
|
|
57
|
+
- **`.theo/` build output cleanup** on every `theokit build`.
|
|
58
|
+
|
|
59
|
+
## Project structure
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
app/ Frontend
|
|
63
|
+
├── page.tsx / — landing
|
|
64
|
+
server/
|
|
65
|
+
├── routes/
|
|
66
|
+
│ ├── login.ts POST /api/login — sets session cookie
|
|
67
|
+
│ ├── logout.ts POST /api/logout — clears session
|
|
68
|
+
│ ├── me.ts GET /api/me — requireAuth() guarded
|
|
69
|
+
│ └── agent.ts POST /api/agent — agent SSE, requireAuth()
|
|
70
|
+
db/
|
|
71
|
+
├── schema.ts users + sessions tables (Drizzle)
|
|
72
|
+
└── migrations/ generated SQL (committed)
|
|
73
|
+
drizzle.config.ts Drizzle config
|
|
74
|
+
theo.config.ts Framework config
|
|
75
|
+
.env Secrets — never committed
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Common commands
|
|
79
|
+
|
|
80
|
+
| Command | What it does |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `npx theokit dev` | Dev server with HMR + auth |
|
|
83
|
+
| `npx theokit build` | Production build |
|
|
84
|
+
| `npx theokit start` | Serve production build |
|
|
85
|
+
| `pnpm db:generate` | Generate SQL migration |
|
|
86
|
+
| `pnpm db:migrate` | Apply migrations |
|
|
87
|
+
| `npm run typecheck` | TypeScript strict check |
|
|
88
|
+
|
|
89
|
+
## Adding billing
|
|
90
|
+
|
|
91
|
+
Stripe is the canonical path — add `STRIPE_SECRET_KEY` to `.env`, mount `server/routes/billing/webhook.ts` via `defineWebhook`, and wire plan checks into `requireAuth()`.
|
|
92
|
+
|
|
93
|
+
## Troubleshooting
|
|
94
|
+
|
|
95
|
+
- **`SESSION_SECRET must be at least 32 bytes`** → regenerate with `openssl rand -base64 32`.
|
|
96
|
+
- **`relation "users" does not exist`** → run `pnpm db:migrate` first.
|
|
97
|
+
- **`401 Unauthorized` on `/api/me`** → login first; cookie must be sent (`-b cookies.txt`).
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
Apply your own. The TheoKit framework is Apache-2.0.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"db:studio": "drizzle-kit studio"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"theokit": "^0.1.0-alpha.
|
|
17
|
+
"theokit": "^0.1.0-alpha.13",
|
|
18
18
|
"@usetheo/ui": "^0.12.0-next.0",
|
|
19
19
|
"react": "^19.0.0",
|
|
20
20
|
"react-dom": "^19.0.0",
|
|
@@ -28,5 +28,10 @@
|
|
|
28
28
|
"@types/react": "^19.0.0",
|
|
29
29
|
"@types/react-dom": "^19.0.0",
|
|
30
30
|
"drizzle-kit": "^0.31.0"
|
|
31
|
+
},
|
|
32
|
+
"pnpm": {
|
|
33
|
+
"onlyBuiltDependencies": [
|
|
34
|
+
"esbuild"
|
|
35
|
+
]
|
|
31
36
|
}
|
|
32
37
|
}
|