@beignet/cli 0.0.9 → 0.0.10

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 (66) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +35 -19
  3. package/dist/choices.d.ts +32 -3
  4. package/dist/choices.d.ts.map +1 -1
  5. package/dist/choices.js +54 -3
  6. package/dist/choices.js.map +1 -1
  7. package/dist/create-prompts.d.ts +5 -4
  8. package/dist/create-prompts.d.ts.map +1 -1
  9. package/dist/create-prompts.js +22 -4
  10. package/dist/create-prompts.js.map +1 -1
  11. package/dist/create.d.ts +7 -1
  12. package/dist/create.d.ts.map +1 -1
  13. package/dist/create.js +13 -3
  14. package/dist/create.js.map +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +25 -6
  17. package/dist/index.js.map +1 -1
  18. package/dist/make.d.ts +21 -1
  19. package/dist/make.d.ts.map +1 -1
  20. package/dist/make.js +210 -37
  21. package/dist/make.js.map +1 -1
  22. package/dist/templates/base.d.ts.map +1 -1
  23. package/dist/templates/base.js +79 -9
  24. package/dist/templates/base.js.map +1 -1
  25. package/dist/templates/db/index.d.ts +21 -0
  26. package/dist/templates/db/index.d.ts.map +1 -0
  27. package/dist/templates/db/index.js +14 -0
  28. package/dist/templates/db/index.js.map +1 -0
  29. package/dist/templates/db/mysql.d.ts +4 -0
  30. package/dist/templates/db/mysql.d.ts.map +1 -0
  31. package/dist/templates/db/mysql.js +972 -0
  32. package/dist/templates/db/mysql.js.map +1 -0
  33. package/dist/templates/db/postgres.d.ts +4 -0
  34. package/dist/templates/db/postgres.d.ts.map +1 -0
  35. package/dist/templates/db/postgres.js +863 -0
  36. package/dist/templates/db/postgres.js.map +1 -0
  37. package/dist/templates/db/sqlite.d.ts +3 -0
  38. package/dist/templates/db/sqlite.d.ts.map +1 -0
  39. package/dist/templates/db/sqlite.js +878 -0
  40. package/dist/templates/db/sqlite.js.map +1 -0
  41. package/dist/templates/index.d.ts +5 -5
  42. package/dist/templates/index.d.ts.map +1 -1
  43. package/dist/templates/index.js +21 -20
  44. package/dist/templates/index.js.map +1 -1
  45. package/dist/templates/server.d.ts +3 -3
  46. package/dist/templates/server.d.ts.map +1 -1
  47. package/dist/templates/server.js +149 -97
  48. package/dist/templates/server.js.map +1 -1
  49. package/dist/templates/shared.d.ts +34 -1
  50. package/dist/templates/shared.d.ts.map +1 -1
  51. package/dist/templates/shared.js +45 -0
  52. package/dist/templates/shared.js.map +1 -1
  53. package/package.json +2 -2
  54. package/src/choices.ts +70 -3
  55. package/src/create-prompts.ts +25 -3
  56. package/src/create.ts +24 -2
  57. package/src/index.ts +29 -5
  58. package/src/make.ts +265 -34
  59. package/src/templates/base.ts +95 -9
  60. package/src/templates/db/index.ts +34 -0
  61. package/src/templates/db/mysql.ts +976 -0
  62. package/src/templates/db/postgres.ts +867 -0
  63. package/src/templates/{db.ts → db/sqlite.ts} +31 -152
  64. package/src/templates/index.ts +24 -19
  65. package/src/templates/server.ts +161 -97
  66. package/src/templates/shared.ts +90 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @beignet/cli
2
2
 
3
+ ## 0.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 2972ee4: `beignet create` supports `--db sqlite|postgres|mysql` (default `sqlite`), with a matching database prompt in interactive setup. Each backend scaffolds end to end: provider wiring, an idiomatic Drizzle schema, the vendored initial migration, env examples (`POSTGRES_DB_URL`, `MYSQL_DB_URL`), and a dialect-matched test database — in-memory libSQL for SQLite, in-process PGlite for Postgres, and a real server via `MYSQL_TEST_URL` for MySQL. `make resource` and `make feature` detect the app's database and generate dialect-correct schema and repository code, and `beignet db generate|migrate` work unchanged for every dialect.
8
+ - @beignet/core@0.0.10
9
+
3
10
  ## 0.0.9
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -40,17 +40,17 @@ equivalent.
40
40
 
41
41
  Running create in an interactive terminal without selection flags opens a
42
42
  prompt-based setup that asks for the project directory, whether to scaffold
43
- an API-only app, and which provider integrations to add. Passing any
44
- selection flag (`--api`, `--integrations`, or `--package-manager`) skips the
45
- prompts, and `--yes` forces the non-interactive defaults (the full-stack
46
- starter with `bun`) even on a terminal. Non-interactive runs in scripts and
47
- CI behave exactly as before.
43
+ an API-only app, which database to use, and which provider integrations to
44
+ add. Passing any selection flag (`--api`, `--db`, `--integrations`, or
45
+ `--package-manager`) skips the prompts, and `--yes` forces the
46
+ non-interactive defaults (the full-stack SQLite starter with `bun`) even on a
47
+ terminal. Non-interactive runs in scripts and CI behave exactly as before.
48
48
 
49
49
  By default the CLI creates a Next.js app with:
50
50
 
51
51
  - Contract-first todos API routes
52
52
  - Better Auth routes and Beignet auth provider wiring
53
- - Drizzle SQLite (libSQL) persistence with a local SQLite default and support for hosted libSQL (Turso)
53
+ - Drizzle persistence — SQLite (libSQL) by default, with `--db postgres` and `--db mysql` for the other backends
54
54
  - UOW, audit logging, durable idempotency, and a durable outbox drain route
55
55
  - Jobs, events, listeners, schedules, mail-backed notifications, and uploads
56
56
  - App-owned ports with provider-backed infra adapters
@@ -67,9 +67,9 @@ persistence, and devtools, and swaps the UI shell for a minimal API landing
67
67
  page and a reduced typed client.
68
68
 
69
69
  The starter ships local production-shaped defaults: Better Auth, Drizzle
70
- SQLite (libSQL) persistence, pino logging, UOW, durable idempotency, a
71
- durable outbox, audit logging, and devtools. Add external service
72
- integrations only when you want those providers:
70
+ persistence, pino logging, UOW, durable idempotency, a durable outbox, audit
71
+ logging, and devtools. Add external service integrations only when you want
72
+ those providers:
73
73
 
74
74
  ```bash
75
75
  bunx @beignet/cli create my-app --integrations inngest,resend
@@ -86,14 +86,27 @@ Each selected integration adds its provider package dependencies, wires the
86
86
  provider in `server/providers.ts`, extends `.env.example`, and writes setup
87
87
  notes to `docs/integrations.md`.
88
88
 
89
- Drizzle SQLite (libSQL) ships in every starter. The scaffold includes
90
- `infra/db/schema/`, `infra/db/repositories.ts`, `infra/db/test-database.ts`,
91
- SQL-backed idempotency and outbox tables, a Drizzle todo repository adapter,
92
- `drizzle.config.ts`, checked-in starter migrations, database scripts, and
93
- `SQLITE_*` env examples, so the generated todo resource uses durable
94
- persistence instead of an in-memory repository. Later `make feature` or
95
- `make resource` calls in that app generate both a Drizzle table/repository
96
- and an in-memory test fake.
89
+ Drizzle persistence ships in every starter; pick the backend with `--db`
90
+ (default `sqlite`):
91
+
92
+ ```bash
93
+ bunx @beignet/cli create my-app --db postgres
94
+ ```
95
+
96
+ `--db` accepts `sqlite` (libSQL, local files plus hosted libSQL/Turso),
97
+ `postgres` (node-postgres, requires a running Postgres 14+ server), and
98
+ `mysql` (`mysql2`, requires MySQL 8.0+). Every backend scaffolds the same
99
+ structure: `infra/db/schema/`, `infra/db/repositories.ts`,
100
+ `infra/db/test-database.ts`, SQL-backed idempotency and outbox tables, a
101
+ Drizzle todo repository adapter, `drizzle.config.ts` with the matching
102
+ dialect, checked-in starter migrations, database scripts, and env examples
103
+ (`SQLITE_*`, `POSTGRES_DB_URL`, or `MYSQL_DB_URL`), so the generated todo
104
+ resource uses durable persistence instead of an in-memory repository.
105
+ Postgres starters run repository tests against in-process PGlite with no
106
+ server; MySQL persistence tests need a real server via `MYSQL_TEST_URL`.
107
+ Later `make feature` or `make resource` calls detect the app's backend from
108
+ `infra/db/repositories.ts` and generate a dialect-correct Drizzle
109
+ table/repository plus an in-memory test fake.
97
110
 
98
111
  Better Auth also ships in every starter. The scaffold adds the Better Auth
99
112
  Next.js route, Beignet auth provider wiring, typed `UNAUTHORIZED` and
@@ -176,6 +189,7 @@ beignet --version
176
189
  Options:
177
190
  --template next Template to use. Currently only `next`.
178
191
  --api Scaffold an API-only app without the UI shell.
192
+ --db postgres Database backend: sqlite (default), postgres, or mysql.
179
193
  --package-manager bun Package manager shown in next steps.
180
194
  --integrations inngest,resend Add integrations: inngest, resend, upstash-rate-limit. Accepts one value or a comma-separated list.
181
195
  --yes Skip interactive create prompts and use the defaults.
@@ -666,8 +680,10 @@ package script to restore.
666
680
  `db reset` is intentionally app-owned because destructive behavior depends on
667
681
  the environment. The standard starter refuses to reset non-local database URLs
668
682
  unless `BEIGNET_ALLOW_DATABASE_RESET=true` is set. Drizzle starters also include
669
- `infra/db/test-database.ts`, which creates an isolated local libSQL database for
670
- repository and persistence tests.
683
+ `infra/db/test-database.ts`, which creates an isolated test database for
684
+ repository and persistence tests: an in-memory libSQL database for SQLite, an
685
+ in-process PGlite database for Postgres, or a real server via `MYSQL_TEST_URL`
686
+ for MySQL.
671
687
 
672
688
  Generate feature-owned test factories and local/demo seeds with:
673
689
 
package/dist/choices.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Choice lists and string-literal types shared by the CLI entrypoint and the
3
- * heavier scaffold/generator modules. Keeping them here lets the bin define
4
- * flag enums without loading templates or generators at startup.
2
+ * Choice lists, string-literal types, and small pure helpers shared by the
3
+ * CLI entrypoint and the heavier scaffold/generator modules. Keeping them
4
+ * here lets the bin define flag enums and next steps without loading
5
+ * templates or generators at startup.
5
6
  */
6
7
  /**
7
8
  * Package managers supported by the app template generator.
@@ -18,6 +19,10 @@ export type TemplateName = "next";
18
19
  * integrations that add an external service remain selectable.
19
20
  */
20
21
  export type IntegrationName = "inngest" | "resend" | "upstash-rate-limit";
22
+ /**
23
+ * Databases supported by the starter's Drizzle persistence layer.
24
+ */
25
+ export type DatabaseName = "sqlite" | "postgres" | "mysql";
21
26
  /**
22
27
  * Supported scaffold template choices.
23
28
  */
@@ -30,6 +35,30 @@ export declare const packageManagerChoices: readonly ["bun", "npm", "pnpm", "yar
30
35
  * Supported scaffold integration choices.
31
36
  */
32
37
  export declare const integrationChoices: readonly ["inngest", "resend", "upstash-rate-limit"];
38
+ /**
39
+ * Supported scaffold database choices.
40
+ */
41
+ export declare const databaseChoices: readonly ["sqlite", "postgres", "mysql"];
42
+ /**
43
+ * Local database name derived from the app name.
44
+ *
45
+ * Postgres and MySQL database identifiers are stricter than project names,
46
+ * so dashes and dots become underscores. Used by `.env.example`, the
47
+ * generated drizzle config, and the create command's next steps, which must
48
+ * all point at the same local database.
49
+ */
50
+ export declare function databaseLocalName(appName: string): string;
51
+ /**
52
+ * Docker one-liner that starts a local database matching the generated
53
+ * `.env.example` connection URL. Returns undefined for SQLite, which needs
54
+ * no server.
55
+ */
56
+ export declare function databaseStartCommand(database: DatabaseName, appName: string): string | undefined;
57
+ /**
58
+ * Local development connection URL matching `databaseStartCommand`.
59
+ * Used as the `.env.example` value and the generated env defaults.
60
+ */
61
+ export declare function databaseLocalUrl(database: DatabaseName, appName: string): string;
33
62
  /**
34
63
  * Shells supported by `beignet completion install` and `uninstall`.
35
64
  */
@@ -1 +1 @@
1
- {"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,oIAa1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAC1E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,0CAIgB,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,oIAa1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/choices.js CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Choice lists and string-literal types shared by the CLI entrypoint and the
3
- * heavier scaffold/generator modules. Keeping them here lets the bin define
4
- * flag enums without loading templates or generators at startup.
2
+ * Choice lists, string-literal types, and small pure helpers shared by the
3
+ * CLI entrypoint and the heavier scaffold/generator modules. Keeping them
4
+ * here lets the bin define flag enums and next steps without loading
5
+ * templates or generators at startup.
5
6
  */
6
7
  /**
7
8
  * Supported scaffold template choices.
@@ -26,6 +27,56 @@ export const integrationChoices = [
26
27
  "resend",
27
28
  "upstash-rate-limit",
28
29
  ];
30
+ /**
31
+ * Supported scaffold database choices.
32
+ */
33
+ export const databaseChoices = [
34
+ "sqlite",
35
+ "postgres",
36
+ "mysql",
37
+ ];
38
+ /**
39
+ * Local database name derived from the app name.
40
+ *
41
+ * Postgres and MySQL database identifiers are stricter than project names,
42
+ * so dashes and dots become underscores. Used by `.env.example`, the
43
+ * generated drizzle config, and the create command's next steps, which must
44
+ * all point at the same local database.
45
+ */
46
+ export function databaseLocalName(appName) {
47
+ return appName.replaceAll(/[^a-z0-9_]/g, "_");
48
+ }
49
+ /**
50
+ * Docker one-liner that starts a local database matching the generated
51
+ * `.env.example` connection URL. Returns undefined for SQLite, which needs
52
+ * no server.
53
+ */
54
+ export function databaseStartCommand(database, appName) {
55
+ const databaseName = databaseLocalName(appName);
56
+ switch (database) {
57
+ case "postgres":
58
+ return `docker run --rm -d -e POSTGRES_USER=beignet -e POSTGRES_PASSWORD=beignet -e POSTGRES_DB=${databaseName} -p 5432:5432 postgres:17-alpine`;
59
+ case "mysql":
60
+ return `docker run --rm -d -e MYSQL_ROOT_PASSWORD=beignet -e MYSQL_DATABASE=${databaseName} -p 3306:3306 mysql:8.4`;
61
+ default:
62
+ return undefined;
63
+ }
64
+ }
65
+ /**
66
+ * Local development connection URL matching `databaseStartCommand`.
67
+ * Used as the `.env.example` value and the generated env defaults.
68
+ */
69
+ export function databaseLocalUrl(database, appName) {
70
+ const databaseName = databaseLocalName(appName);
71
+ switch (database) {
72
+ case "postgres":
73
+ return `postgres://beignet:beignet@127.0.0.1:5432/${databaseName}`;
74
+ case "mysql":
75
+ return `mysql://root:beignet@127.0.0.1:3306/${databaseName}`;
76
+ default:
77
+ return "file:local.db";
78
+ }
79
+ }
29
80
  /**
30
81
  * Supported completion shell choices.
31
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;CACoC,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACsC,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS;IACT,QAAQ;IACR,oBAAoB;CACyB,CAAC;AAOhD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,KAAK;CACwC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,cAAc;IACd,eAAe;IACf,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC"}
1
+ {"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;CACoC,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;CACsC,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS;IACT,QAAQ;IACR,oBAAoB;CACyB,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,QAAQ;IACR,UAAU;IACV,OAAO;CACmC,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,OAAO,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAAsB,EACtB,OAAe;IAEf,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,2FAA2F,YAAY,kCAAkC,CAAC;QACnJ,KAAK,OAAO;YACV,OAAO,uEAAuE,YAAY,yBAAyB,CAAC;QACtH;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAsB,EACtB,OAAe;IAEf,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,6CAA6C,YAAY,EAAE,CAAC;QACrE,KAAK,OAAO;YACV,OAAO,uCAAuC,YAAY,EAAE,CAAC;QAC/D;YACE,OAAO,eAAe,CAAC;IAC3B,CAAC;AACH,CAAC;AAOD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,KAAK;CACwC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,cAAc;IACd,eAAe;IACf,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC"}
@@ -5,13 +5,14 @@
5
5
  * `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
6
6
  * runs and CLI startup never pay for it.
7
7
  */
8
- import { type IntegrationName, type PackageManager } from "./choices.js";
8
+ import { type DatabaseName, type IntegrationName, type PackageManager } from "./choices.js";
9
9
  /**
10
10
  * Selections shared by create flags and interactive prompt answers.
11
11
  */
12
12
  export type CreateSelections = {
13
13
  directory?: string;
14
14
  api?: boolean;
15
+ db?: DatabaseName;
15
16
  integrations?: readonly IntegrationName[];
16
17
  packageManager?: PackageManager;
17
18
  };
@@ -26,9 +27,9 @@ type CreatePromptTty = {
26
27
  * Decide whether `beignet create` should run the interactive prompt flow.
27
28
  *
28
29
  * Prompts run only on a full TTY, only when `--yes` is absent, and only when
29
- * no selection flag was passed. Any explicit api, integration, or package
30
- * manager selection means the invocation is scripted, so the non-interactive
31
- * path stays byte-identical for agents and CI.
30
+ * no selection flag was passed. Any explicit api, database, integration, or
31
+ * package manager selection means the invocation is scripted, so the
32
+ * non-interactive path stays byte-identical for agents and CI.
32
33
  */
33
34
  export declare function shouldPromptInteractively(flags: CreatePromptFlags, tty: CreatePromptTty): boolean;
34
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"create-prompts.d.ts","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,GAAG;IAC1C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAUT;AAQD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CA4CvC"}
1
+ {"version":3,"file":"create-prompts.d.ts","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,GAAG;IAC1C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAWT;AAcD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAwDvC"}
@@ -5,14 +5,14 @@
5
5
  * `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
6
6
  * runs and CLI startup never pay for it.
7
7
  */
8
- import { integrationChoices, } from "./choices.js";
8
+ import { databaseChoices, integrationChoices, } from "./choices.js";
9
9
  /**
10
10
  * Decide whether `beignet create` should run the interactive prompt flow.
11
11
  *
12
12
  * Prompts run only on a full TTY, only when `--yes` is absent, and only when
13
- * no selection flag was passed. Any explicit api, integration, or package
14
- * manager selection means the invocation is scripted, so the non-interactive
15
- * path stays byte-identical for agents and CI.
13
+ * no selection flag was passed. Any explicit api, database, integration, or
14
+ * package manager selection means the invocation is scripted, so the
15
+ * non-interactive path stays byte-identical for agents and CI.
16
16
  */
17
17
  export function shouldPromptInteractively(flags, tty) {
18
18
  if (!tty.stdin || !tty.stdout)
@@ -20,6 +20,7 @@ export function shouldPromptInteractively(flags, tty) {
20
20
  if (flags.yes)
21
21
  return false;
22
22
  const selectionFlagPassed = flags.api !== undefined ||
23
+ flags.db !== undefined ||
23
24
  (flags.integrations?.length ?? 0) > 0 ||
24
25
  flags.packageManager !== undefined;
25
26
  return !selectionFlagPassed;
@@ -29,6 +30,11 @@ const integrationHints = {
29
30
  resend: "Resend-backed mail provider",
30
31
  "upstash-rate-limit": "Upstash-backed rate limiting",
31
32
  };
33
+ const databaseHints = {
34
+ sqlite: "libSQL/Turso, zero setup — default",
35
+ postgres: "node-postgres, requires a Postgres 14+ server",
36
+ mysql: "mysql2, requires MySQL 8.0+",
37
+ };
32
38
  /**
33
39
  * Run the interactive `beignet create` prompt flow.
34
40
  *
@@ -56,6 +62,17 @@ export async function promptCreateSelections(initial) {
56
62
  });
57
63
  if (prompts.isCancel(api))
58
64
  return undefined;
65
+ const db = await prompts.select({
66
+ message: "Which database?",
67
+ options: databaseChoices.map((database) => ({
68
+ value: database,
69
+ label: database,
70
+ hint: databaseHints[database],
71
+ })),
72
+ initialValue: initial.db ?? "sqlite",
73
+ });
74
+ if (prompts.isCancel(db))
75
+ return undefined;
59
76
  const integrations = await prompts.multiselect({
60
77
  message: "Add provider integrations? (press enter to skip)",
61
78
  options: integrationChoices.map((integration) => ({
@@ -71,6 +88,7 @@ export async function promptCreateSelections(initial) {
71
88
  return {
72
89
  directory,
73
90
  api,
91
+ db,
74
92
  integrations,
75
93
  packageManager: initial.packageManager,
76
94
  };
@@ -1 +1 @@
1
- {"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index.js";
1
+ import { type DatabaseName, type IntegrationName, type PackageManager, type TemplateName } from "./templates/index.js";
2
2
  /**
3
3
  * Options for creating a new Beignet app.
4
4
  */
@@ -12,6 +12,11 @@ export type CreateOptions = {
12
12
  api?: boolean;
13
13
  packageManager?: PackageManager;
14
14
  integrations?: IntegrationName[];
15
+ /**
16
+ * Database backing the starter's Drizzle persistence layer.
17
+ * Defaults to "sqlite".
18
+ */
19
+ db?: DatabaseName;
15
20
  force?: boolean;
16
21
  dryRun?: boolean;
17
22
  beignetVersion?: string;
@@ -26,6 +31,7 @@ export type CreateResult = {
26
31
  dryRun: boolean;
27
32
  files: string[];
28
33
  packageManager: PackageManager;
34
+ database: DatabaseName;
29
35
  };
30
36
  /**
31
37
  * Create a Beignet app from the starter template.
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CA6CvB"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC;;;OAGG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAsDvB"}
package/dist/create.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { mkdir, readdir, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { getTemplateFiles, integrationChoices, } from "./templates/index.js";
3
+ import { databaseChoices, getTemplateFiles, integrationChoices, } from "./templates/index.js";
4
4
  import { getCliVersion } from "./version.js";
5
5
  /**
6
6
  * Create a Beignet app from the starter template.
@@ -13,9 +13,13 @@ export async function createProject(options) {
13
13
  const template = options.template ?? "next";
14
14
  const api = Boolean(options.api);
15
15
  const integrations = resolveIntegrations(options.integrations ?? []);
16
+ const database = options.db ?? "sqlite";
16
17
  if (template !== "next") {
17
18
  throw new Error(`Unknown template "${template}". Available templates: next`);
18
19
  }
20
+ if (!databaseChoices.includes(database)) {
21
+ throw new Error(`Unknown database "${database}". Available databases: ${databaseChoices.join(", ")}`);
22
+ }
19
23
  const dryRun = Boolean(options.dryRun);
20
24
  await assertCanWrite(targetDir, Boolean(options.force));
21
25
  const files = getTemplateFiles({
@@ -24,6 +28,7 @@ export async function createProject(options) {
24
28
  beignetVersion: options.beignetVersion ?? getDefaultBeignetVersion(),
25
29
  api,
26
30
  integrations,
31
+ database,
27
32
  });
28
33
  if (!dryRun) {
29
34
  await mkdir(targetDir, { recursive: true });
@@ -40,6 +45,7 @@ export async function createProject(options) {
40
45
  dryRun,
41
46
  files: files.map((file) => file.path),
42
47
  packageManager,
48
+ database,
43
49
  };
44
50
  }
45
51
  /**
@@ -49,8 +55,12 @@ export async function createProject(options) {
49
55
  const baseProviderNames = new Set(["better-auth", "drizzle-sqlite", "pino"]);
50
56
  function resolveIntegrations(explicitIntegrations) {
51
57
  for (const integration of explicitIntegrations) {
52
- if (baseProviderNames.has(integration)) {
53
- throw new Error(`${integration} is part of every Beignet starter and no longer an --integrations choice.`);
58
+ const integrationName = integration;
59
+ if (baseProviderNames.has(integrationName)) {
60
+ const databaseHint = integrationName === "drizzle-sqlite"
61
+ ? " Choose the starter database with --db sqlite|postgres|mysql instead."
62
+ : "";
63
+ throw new Error(`${integration} is part of every Beignet starter and no longer an --integrations choice.${databaseHint}`);
54
64
  }
55
65
  }
56
66
  const integrations = new Set(explicitI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wBAAsB,IAAI,CACxB,MAAM,WAAwB,EAC9B,OAAO,GAAE,4BAA4B,CAAC,UAAU,CAAe,GAC9D,OAAO,CAAC,IAAI,CAAC,CAiBf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAoBvB,KAAK,UAAU,GAAG,cAAc,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC,CAAC;AAm8CF,wBAAsB,IAAI,CACxB,MAAM,WAAwB,EAC9B,OAAO,GAAE,4BAA4B,CAAC,UAAU,CAAe,GAC9D,OAAO,CAAC,IAAI,CAAC,CAiBf"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { realpathSync } from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { buildApplication, buildCommand, buildRouteMap, proposeCompletions, run, text_en, } from "@stricli/core";
5
- import { completionShellChoices, integrationChoices, makeFeatureAddonChoices, packageManagerChoices, templateChoices, } from "./choices.js";
5
+ import { completionShellChoices, databaseChoices, databaseStartCommand, integrationChoices, makeFeatureAddonChoices, packageManagerChoices, templateChoices, } from "./choices.js";
6
6
  import { getCliVersion } from "./version.js";
7
7
  const outputFormatChoices = [
8
8
  "human",
@@ -124,10 +124,11 @@ const createCommand = buildCommand({
124
124
  docs: {
125
125
  brief: "Create a new Beignet app.",
126
126
  fullDescription: `Scaffolds a full-stack Beignet starter: typed contracts, Better Auth,
127
- Drizzle/libSQL persistence with checked-in migrations, pino logging,
128
- devtools, and a shadcn UI shell. Pass --api for an API-only scaffold
129
- without the UI shell.
127
+ Drizzle persistence with checked-in migrations, pino logging, devtools,
128
+ and a shadcn UI shell. Pass --api for an API-only scaffold without the
129
+ UI shell, and --db to choose the database.
130
130
 
131
+ Available databases: ${databaseChoices.join(", ")}
131
132
  Available integrations: ${integrationChoices.join(", ")}
132
133
 
133
134
  Running create on an interactive terminal without selection flags opens a
@@ -147,6 +148,12 @@ prompt-based setup. Pass --yes or any selection flag to skip the prompts.`,
147
148
  withNegated: false,
148
149
  brief: "Scaffold an API-only app without the UI shell.",
149
150
  },
151
+ db: {
152
+ kind: "enum",
153
+ values: databaseChoices,
154
+ optional: true,
155
+ brief: "Database for Drizzle persistence. Default: sqlite.",
156
+ },
150
157
  packageManager: {
151
158
  kind: "enum",
152
159
  values: packageManagerChoices,
@@ -189,6 +196,7 @@ prompt-based setup. Pass --yes or any selection flag to skip the prompts.`,
189
196
  let selections = {
190
197
  directory,
191
198
  api: flags.api,
199
+ db: flags.db,
192
200
  integrations: flags.integrations,
193
201
  packageManager: flags.packageManager,
194
202
  };
@@ -209,6 +217,7 @@ prompt-based setup. Pass --yes or any selection flag to skip the prompts.`,
209
217
  throw new Error("Project directory is required. Pass beignet create <directory>, or run beignet create in an interactive terminal.");
210
218
  }
211
219
  const api = selections.api ?? false;
220
+ const database = selections.db ?? "sqlite";
212
221
  const integrations = uniqueValues([...(selections.integrations ?? [])]);
213
222
  const result = await createProject({
214
223
  name: selections.directory,
@@ -216,12 +225,13 @@ prompt-based setup. Pass --yes or any selection flag to skip the prompts.`,
216
225
  api,
217
226
  packageManager: selections.packageManager,
218
227
  integrations,
228
+ db: database,
219
229
  force: Boolean(flags.force),
220
230
  dryRun: Boolean(flags.dryRun),
221
231
  });
222
232
  writeOutput(this, flags.json
223
233
  ? JSON.stringify(result, null, 2)
224
- : nextSteps(result, { api, integrations }));
234
+ : nextSteps(result, { api, integrations, database }));
225
235
  };
226
236
  },
227
237
  });
@@ -790,6 +800,15 @@ ${plannedFiles}`;
790
800
  const openStep = options.api
791
801
  ? " open http://localhost:3000 for the API landing page"
792
802
  : " open http://localhost:3000/sign-up";
803
+ const startDatabaseCommand = options.database
804
+ ? databaseStartCommand(options.database, result.name)
805
+ : undefined;
806
+ const startDatabaseStep = startDatabaseCommand
807
+ ? `Start the database:
808
+ ${startDatabaseCommand}
809
+
810
+ `
811
+ : "";
793
812
  return `Created ${result.name} at ${result.targetDir}
794
813
 
795
814
  Next steps:
@@ -797,7 +816,7 @@ Next steps:
797
816
  ${pm} install
798
817
  cp .env.example .env.local
799
818
  ${envStep}
800
- Prepare the database:
819
+ ${startDatabaseStep}Prepare the database:
801
820
  ${cli} db migrate
802
821
 
803
822
  Start the app: