@shaferllc/keel 0.83.4 → 0.83.6

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.
@@ -0,0 +1,186 @@
1
+ # From install to deploy
2
+
3
+ One path from zero to a live Keel app — locally, on Cloudflare yourself, or on
4
+ **Keel Cloud** with an AI agent. Pick the track that matches how you want to
5
+ ship; everything else is optional.
6
+
7
+ ```text
8
+ create-keeljs → npm run dev → (optional MCP) → deploy
9
+
10
+ Keel Cloud (optional)
11
+ ```
12
+
13
+ ## Requirements
14
+
15
+ - Node.js **≥ 22**
16
+ - npm
17
+ - For self-hosted edge deploys: a [Cloudflare](https://dash.cloudflare.com) account
18
+ and [Wrangler](https://developers.cloudflare.com/workers/wrangler/) (ships with
19
+ the kits as a devDependency)
20
+ - For Keel Cloud: an invite / allowlisted email at [app.keeljs.cloud](https://app.keeljs.cloud)
21
+ during private alpha
22
+
23
+ ## 1. Create an app
24
+
25
+ ```bash
26
+ npm create keeljs@latest my-app # full-stack "app" preset (default)
27
+ # npm create keeljs@latest my-api -- --preset api
28
+ # npm create keeljs@latest my-saas -- --preset saas
29
+ # npm create keeljs@latest bare -- --preset minimal
30
+ cd my-app
31
+ npm install
32
+ cp .env.example .env # if the kit didn't already
33
+ ```
34
+
35
+ | Preset | Use when |
36
+ |--------|----------|
37
+ | `minimal` | Hello-world / learning — routes, a view, Tailwind. No database. |
38
+ | `api` | JSON API — models, migrations, token auth, OpenAPI, tests. |
39
+ | `app` *(default)* | Product with views, sessions, register/login, password reset, 2FA. |
40
+ | `saas` | Multi-tenant product — teams, roles, invitations, billing. |
41
+
42
+ Templates live **inside** `@shaferllc/keel`, so the kit version matches the
43
+ framework version you just installed. Details: [Starter kits](./starter-kits.md).
44
+
45
+ ## 2. Run it locally
46
+
47
+ ```bash
48
+ npm run migrate # if the preset has a database (api / app / saas)
49
+ npm run dev # http://localhost:3000 — Node + local SQLite
50
+ ```
51
+
52
+ Useful next commands:
53
+
54
+ ```bash
55
+ npm run keel -- routes # what is mounted
56
+ npm run keel -- make:controller Post # scaffold, then wire a route
57
+ npm test
58
+ npm run typecheck
59
+ ```
60
+
61
+ Local tip: `DB_CONNECTION` defaults to a SQLite file. Switching drivers later is
62
+ config only — see [Database](./database.md) and [Starter kits](./starter-kits.md).
63
+
64
+ For a guided first hour inside the codebase (routes, controllers, views, config),
65
+ read [Getting Started](./getting-started.md).
66
+
67
+ ## 3. Optional — AI agents (local)
68
+
69
+ Keel is designed to be written with an agent. Point Cursor / Claude Code at the
70
+ MCP server that ships with the package:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "keel": {
76
+ "command": "npx",
77
+ "args": ["-y", "keel-mcp"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ Then have the agent call `keel_overview` first. It can search docs, look up the
84
+ public API, and scaffold controllers/jobs/… without inventing imports.
85
+
86
+ Full map: [Building with AI](./ai.md).
87
+
88
+ ## 4. Deploy yourself (Cloudflare Workers)
89
+
90
+ Every kit includes `wrangler.jsonc`, a `worker.ts` entry, and `npm run deploy`.
91
+ You own the Cloudflare account and the hostname.
92
+
93
+ ```bash
94
+ # one-time
95
+ npx wrangler login
96
+ npx wrangler d1 create my-app # paste database_id into wrangler.jsonc
97
+
98
+ # ship
99
+ npm run deploy # css:build + wrangler deploy
100
+ ```
101
+
102
+ Migrations against remote D1 use the HTTP driver from your laptop / CI — the
103
+ binding only exists inside the Worker. Set Cloudflare API credentials as
104
+ documented in [Database](./database.md) (D1 HTTP) and your kit’s README.
105
+
106
+ Edge preview without deploying:
107
+
108
+ ```bash
109
+ npm run dev:edge # wrangler + local D1
110
+ ```
111
+
112
+ Hosting helpers (hostname utils, SQL dump, secrets encryption) live in
113
+ [`@shaferllc/keel/hosting`](./hosting.md) if you build your own control plane.
114
+
115
+ ## 5. Optional — Keel Cloud
116
+
117
+ [Keel Cloud](https://app.keeljs.cloud) is a hosted control plane: pick a preset,
118
+ edit real source, preview and publish Workers for you, vault secrets, and export
119
+ git + SQL anytime. Free tier is limited (typically one site); Pro adds more sites
120
+ and custom domains.
121
+
122
+ Use Cloud when you want the platform to own deploys and hostnames. Skip it when
123
+ you already have Cloudflare / your own pipeline (§4).
124
+
125
+ ### Sign up and mint a token
126
+
127
+ 1. Open [app.keeljs.cloud](https://app.keeljs.cloud) (invite code or allowlisted
128
+ email during alpha).
129
+ 2. Create a personal access token at **`/tokens`**. The plaintext looks like
130
+ `keel_<selector>.<verifier>` — copy it once.
131
+ 3. Wire it into your MCP client (same `keel-mcp` binary as local):
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "keel": {
137
+ "command": "npx",
138
+ "args": ["-y", "keel-mcp"],
139
+ "env": {
140
+ "KEEL_CLOUD_TOKEN": "keel_….…",
141
+ "KEEL_CLOUD_URL": "https://app.keeljs.cloud"
142
+ }
143
+ }
144
+ }
145
+ }
146
+ ```
147
+
148
+ Reload MCP. When the token is set, `keel_cloud_*` tools appear alongside the
149
+ docs tools. The token binds to your **first team**.
150
+
151
+ ### Agent loop on Cloud
152
+
153
+ 1. `keel_cloud_create_site { name: "Acme", preset: "app" }`
154
+ 2. Edit files at the returned `storage_path` (real Keel app + git)
155
+ 3. `keel_cloud_set_secret` for anything the Worker needs at runtime
156
+ 4. `keel_cloud_preview { site_id }` — iterate freely
157
+ 5. `keel_cloud_publish { site_id, confirm: true }` — only after you approve
158
+ 6. Optional Pro: `keel_cloud_set_custom_domain { hostname, attach: true }`
159
+ 7. Escape hatch anytime: `keel_cloud_export` + `keel_cloud_export_sql`
160
+
161
+ You can also drive the same flow from the dashboard at `/sites`. Billing for Pro
162
+ is at `/billing` (or `keel_cloud_billing` / `_checkout` / `_portal` via MCP).
163
+
164
+ Tool reference: [Building with AI](./ai.md#the-mcp-server).
165
+
166
+ ## Which path should I pick?
167
+
168
+ | Goal | Path |
169
+ |------|------|
170
+ | Learn Keel / ship a side project on your CF account | §§1–4 |
171
+ | Build with an agent in your IDE, deploy yourself | §§1–4 + §3 |
172
+ | Let the platform host preview/prod + secrets + export | §§1–2 + §5 (Cloud creates the app for you) |
173
+ | Multi-tenant SaaS with billing | Preset `saas`, then §4 or §5 |
174
+
175
+ Cloud **create_site** scaffolds a kit the same way `create-keeljs` does — you do
176
+ not need both for the same app. Use `create-keeljs` for apps you own end-to-end;
177
+ use Cloud when you want hosted preview/publish under `*.keeljs.cloud`.
178
+
179
+ ## Where next
180
+
181
+ - [Getting Started](./getting-started.md) — first route, controller, view
182
+ - [Starter kits](./starter-kits.md) — presets and the Node/edge seam
183
+ - [Building with AI](./ai.md) — MCP tools (local + Cloud)
184
+ - [Hosting](./hosting.md) — Cloudflare / dump / secrets primitives
185
+ - [Accounts](./accounts.md) · [Teams](./teams.md) · [Billing](./billing.md) — what
186
+ `app` / `saas` already mount
@@ -15,32 +15,20 @@ Keel targets modern Node and web-standard APIs, so a current runtime matters —
15
15
 
16
16
  ## Install
17
17
 
18
- Keel ships as two repos: the **framework** (`@shaferllc/keel`, published to
19
- npm) and a **starter app** (`shaferllc/keel-app`) you build on. Which path you
20
- take depends on whether you're starting fresh or bolting Keel onto something
21
- that already exists. See [Architecture](./architecture.md#two-repos-library-and-starter)
22
- for why it's split this way.
23
-
24
- ### From the starter (recommended)
25
-
26
- The fastest route to a running app is the starter — a working skeleton with the
27
- folders, config, and scripts already wired:
18
+ The fastest path to a running app is the generator it copies a curated kit
19
+ from the same `@shaferllc/keel` version you install, so the template cannot lag
20
+ the framework:
28
21
 
29
22
  ```bash
30
- git clone https://github.com/shaferllc/keel-app.git my-app
23
+ npm create keeljs@latest my-app
31
24
  cd my-app
32
25
  npm install
26
+ npm run dev # http://localhost:3000
33
27
  ```
34
28
 
35
- The starter depends on `@shaferllc/keel`, so you pick up framework updates with
36
- an ordinary `npm update @shaferllc/keel` your app code in `app/` stays put.
37
-
38
- A fresh checkout ships with a working `.env`. To start from the template
39
- instead:
40
-
41
- ```bash
42
- cp .env.example .env
43
- ```
29
+ For the full journey (presets, Cloudflare deploy, optional Keel Cloud + MCP),
30
+ see **[From install to deploy](./from-install-to-deploy.md)**. Kit details:
31
+ [Starter kits](./starter-kits.md).
44
32
 
45
33
  ### Into an existing app
46
34
 
@@ -57,22 +45,24 @@ import { Application, Router, config } from "@shaferllc/keel/core";
57
45
  ```
58
46
 
59
47
  You supply the four convention folders yourself — `app/`, `config/`, `routes/`,
60
- `bootstrap/` — plus an entry that calls `createApplication()`. The starter's
48
+ `bootstrap/` — plus an entry that calls `createApplication()`. A generated kit’s
61
49
  `bootstrap/app.ts` is the reference; copy it and trim to taste.
62
50
 
63
51
  ### Hacking on the framework itself
64
52
 
65
- To work on Keel proper, clone the framework repo — it carries an example app you
66
- can run directly:
53
+ To work on Keel proper, clone the framework repo:
67
54
 
68
55
  ```bash
69
56
  git clone https://github.com/shaferllc/keel.git
70
57
  cd keel
71
58
  npm install
72
- npm run dev # example app on http://localhost:3000
73
- npm run build # compile the package to dist/
59
+ npm test
60
+ npm run typecheck
74
61
  ```
75
62
 
63
+ Generate a disposable app against your checkout with
64
+ `npm create keeljs@latest …` and point its dependency at `file:../keel`.
65
+
76
66
  ## Run the server
77
67
 
78
68
  ```bash
@@ -267,9 +257,10 @@ unsure what's mounted. [The Console](./console.md) lists every command.
267
257
  ## Where to go next
268
258
 
269
259
  You now have the shape of a Keel app: routes point at controllers, controllers
270
- render views and read config, and the console scaffolds the pieces. The deep
271
- guides pick up from here:
260
+ render views and read config, and the console scaffolds the pieces.
272
261
 
262
+ - **[From install to deploy](./from-install-to-deploy.md)** — presets, Cloudflare,
263
+ optional Keel Cloud + MCP
273
264
  - [Architecture](./architecture.md) — how boot, the container, and the request
274
265
  lifecycle fit together
275
266
  - [The Service Container](./container.md) — how dependency injection works
@@ -284,6 +275,7 @@ guides pick up from here:
284
275
  the active-record layer on top of it
285
276
  - [Configuration](./configuration.md) and [The Console](./console.md) — settings
286
277
  and commands
278
+ - [Building with AI](./ai.md) — MCP docs + Cloud tools
287
279
 
288
280
  When something isn't documented, open the source — the whole framework is a few
289
281
  hundred readable lines in `src/core/`, and [Built on Hono](./hono.md) explains
@@ -5,7 +5,8 @@ npm create keeljs@latest my-app -- --preset saas
5
5
  ```
6
6
 
7
7
  Four curated applications. Each is a complete, working app — not a scaffold you have
8
- to finish.
8
+ to finish. For the full path from this command through Cloudflare or Keel Cloud,
9
+ see [From install to deploy](./from-install-to-deploy.md).
9
10
 
10
11
  | Preset | What you get |
11
12
  | --- | --- |