@decohere/create 0.0.1-dev.20261110.287 → 0.0.1-dev.20261110.311
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/README.md +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ decohere create webapi -d my-app
|
|
|
35
35
|
To skip prompts, pass every answer up front (`-y` means “install deps, don’t ask”):
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
npm create @decohere@dev -- webapi -d my-app --database postgres/
|
|
38
|
+
npm create @decohere@dev -- webapi -d my-app --database postgres/mikro-orm --auth none -y
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Target directory is `webapi`'s optional argument or `-d` (default `.`). `npm create` treats `-d` as its own loglevel flag and forwards `my-app` as a positional — that form is supported. Extra create flags still need `--` after `npm create`.
|
|
@@ -190,14 +190,17 @@ Commit `pnpm-lock.yaml` after the first install.
|
|
|
190
190
|
| Value | Effect |
|
|
191
191
|
|---|---|
|
|
192
192
|
| `none` | No database |
|
|
193
|
-
| `postgres/
|
|
193
|
+
| `postgres/mikro-orm` | One Compose Postgres **instance**; each API owns a named database + `{PREFIX}_DB_*` env, mapped with MikroORM |
|
|
194
|
+
| `postgres/typeorm` | The same, mapped with TypeORM |
|
|
194
195
|
|
|
195
196
|
```bash
|
|
196
|
-
npx @decohere/create webapi -d my-app --database postgres/
|
|
197
|
-
npx @decohere/create webapi -d my-app --name api --name billing --database postgres/
|
|
197
|
+
npx @decohere/create webapi -d my-app --database postgres/mikro-orm
|
|
198
|
+
npx @decohere/create webapi -d my-app --name api --name billing --database postgres/mikro-orm
|
|
198
199
|
```
|
|
199
200
|
|
|
200
|
-
`config.yaml` lists one datasource per API (`name: billing` → `
|
|
201
|
+
`config.yaml` lists one datasource per API (`name: billing` → `mikroOrm({ name: "billing" })`). Locally they share host `postgres` port `5432`. Point `BILLING_DB_HOST` / `BILLING_DB_PORT` at another server to split later. `webapi add billing --database postgres/mikro-orm` appends a datasource; the bootstrap `CREATE DATABASE`s it on first run.
|
|
202
|
+
|
|
203
|
+
Each API builds in `src/app.ts` (`createApp()`) and starts in `src/main.ts`. Its migrations are in `src/migrations/`, starting with one per table the scaffold maps, and development applies them on start. `pnpm decohere db <command>` runs `src/db.ts` (add `--api billing` when there are several APIs): `generate <name>` writes a migration from your mapping changes, and `migrate`, `status`, `revert` and `new` do what they say. See [Migrations](../../docs/recipes/migrations.md).
|
|
201
204
|
|
|
202
205
|
#### Health probes
|
|
203
206
|
|
|
@@ -208,7 +211,7 @@ Scaffolded APIs call `.use(health())` so these routes are available **without au
|
|
|
208
211
|
| `GET /health` | Liveness — process is up | Always `200` `{ "status": "ok" }` |
|
|
209
212
|
| `GET /ready` | Readiness — dependencies OK | `200` when checks pass; `503` when a check fails |
|
|
210
213
|
|
|
211
|
-
With
|
|
214
|
+
With a database, readiness checks each data source's connection. Use `/ready` for load balancers and orchestrators.
|
|
212
215
|
|
|
213
216
|
#### Auth (`--auth`)
|
|
214
217
|
|
|
@@ -241,7 +244,7 @@ While the API is running, `http://localhost:3000/openapi.json` describes every r
|
|
|
241
244
|
| `auth0 login` | `decohere auth0` | Device/URL login; keeps tokens in `~/.config/auth0` |
|
|
242
245
|
| `auth0 configure` | `decohere auth0` | Update the Auth0 API, login app and token app for an existing workspace |
|
|
243
246
|
| `auth0 token` | `decohere auth0` | Print an access token for calling the API in development |
|
|
244
|
-
| `--database <provider>` | `webapi` / `add` | `none` \| `postgres/typeorm` |
|
|
247
|
+
| `--database <provider>` | `webapi` / `add` | `none` \| `postgres/mikro-orm` \| `postgres/typeorm` |
|
|
245
248
|
| `--auth <provider>` | `webapi` / `add` | `none` \| `auth0` |
|
|
246
249
|
| `-y, --yes` | `webapi` / `add` | Install dependencies without prompting |
|
|
247
250
|
| `--install <mode>` | `webapi` / `add` | `ask` (default) \| `yes` \| `no` |
|