create-fs-app 3.1.0 → 3.2.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/README.md CHANGED
@@ -268,6 +268,7 @@ Project options
268
268
  --eslint / --no-eslint Keep (default) or remove ESLint configs and lint scripts
269
269
  --prettier / --no-prettier Keep (default) or remove Prettier and the format script
270
270
  --docker / --no-docker Keep (default) or remove Docker files
271
+ --welcome / --no-welcome Welcome start page with live checks (default) or the template's plain page
271
272
  --ci / --no-ci Add a GitHub Actions CI workflow (default: no)
272
273
  --auth <strategy> none | jwt (jwt: nest.js, express)
273
274
 
@@ -43,6 +43,7 @@ export function describeExtras(config) {
43
43
  config.eslint && 'ESLint',
44
44
  config.prettier && 'Prettier',
45
45
  config.docker && 'Docker',
46
+ config.welcome && 'welcome page',
46
47
  config.ci && 'GitHub Actions CI',
47
48
  config.git && 'git init',
48
49
  ].filter((v) => Boolean(v));
@@ -133,7 +134,7 @@ function sourceDir(plan) {
133
134
  /** The --dry-run screen. Reads the source directory (local or cache) but writes nothing. */
134
135
  export function renderDryRun(plan, theme, width = 80) {
135
136
  const { config, template } = plan;
136
- const { added, removed } = plannedFileChanges(config, plan.kind);
137
+ const { added, removed } = plannedFileChanges(config, plan.kind, template);
137
138
  const out = [
138
139
  `${theme.bold('Dry run')} ${plan.templateLabel} ${theme.dim(`(${plan.kind})`)}`,
139
140
  '',
@@ -170,7 +171,7 @@ export function renderDryRun(plan, theme, width = 80) {
170
171
  }
171
172
  }
172
173
  out.push('', theme.bold('Customizations'));
173
- for (const action of describeCustomizations(config, plan.kind)) {
174
+ for (const action of describeCustomizations(config, plan.kind, template)) {
174
175
  out.push(...wrapText(action, width - 4).map((l, i) => `${i ? ' ' : ' - '}${l}`));
175
176
  }
176
177
  const install = config.install
@@ -47,6 +47,8 @@ function addStackOptions(cmd) {
47
47
  .addOption(opt('--no-prettier', 'Remove Prettier and the format script', 'Output'))
48
48
  .addOption(opt('--docker', 'Keep Docker files (default)', 'Output'))
49
49
  .addOption(opt('--no-docker', 'Remove Docker files', 'Output'))
50
+ .addOption(opt('--welcome', 'Welcome start page with live checks (default)', 'Output'))
51
+ .addOption(opt('--no-welcome', "Keep the template's plain start page", 'Output'))
50
52
  .addOption(opt('--ci', 'Add a GitHub Actions CI workflow', 'Output'))
51
53
  .addOption(opt('--no-ci', 'Skip GitHub Actions CI (default)', 'Output'));
52
54
  }
@@ -299,7 +301,7 @@ export function buildProgram(options = {}) {
299
301
  stack: stack,
300
302
  packageManager: parsePackageManager(cmdOptions.packageManager),
301
303
  eslint: cmdOptions.eslint, prettier: cmdOptions.prettier, docker: cmdOptions.docker,
302
- ci: cmdOptions.ci, auth,
304
+ ci: cmdOptions.ci, welcome: cmdOptions.welcome, auth,
303
305
  });
304
306
  await savePreset(presetName, config, cmdOptions.description);
305
307
  console.log(theme.dim(` ${describeStack(stack)} ${theme.glyphs.dot} ${config.packageManager}`));
@@ -176,6 +176,7 @@ export async function resolveCreate(name, flags, ctx) {
176
176
  prettier: flags.prettier ?? base.prettier,
177
177
  docker: flags.docker ?? base.docker,
178
178
  ci: flags.ci ?? base.ci,
179
+ welcome: flags.welcome ?? base.welcome,
179
180
  auth: explicitAuth ?? base.auth,
180
181
  git: ctx.gitGiven ? flags.git : base.git,
181
182
  install: ctx.installGiven ? flags.install : base.install,
@@ -221,7 +222,7 @@ export async function resolveCreate(name, flags, ctx) {
221
222
  }
222
223
  const template = createCustomTemplate(parsed.parsed.repoUrl, parsed.parsed.branch, parsed.parsed.subfolder);
223
224
  const config = ProjectConfigSchema.parse({
224
- ...given, name: requireName(), stack: undefined, auth: 'none', eslint: true, prettier: true, docker: true,
225
+ ...given, name: requireName(), stack: undefined, auth: 'none', eslint: true, prettier: true, docker: true, welcome: false,
225
226
  });
226
227
  return { kind: 'custom', template, config };
227
228
  }
@@ -15,6 +15,7 @@ import * as p from '@clack/prompts';
15
15
  import { PACKAGE_MANAGERS, ProjectConfigSchema, } from '../types/index.js';
16
16
  import { FIELD_LABELS, STACK_FIELDS, availableOptions, autoPick, findTemplate, labelFor, } from '../core/stack.js';
17
17
  import { AUTH_SUPPORT, supportsAuth } from '../core/auth/jwt.js';
18
+ import { supportsWelcome } from '../core/welcome.js';
18
19
  import { validateProjectName } from '../utils/validation.js';
19
20
  import { defaultFor } from './resolve-config.js';
20
21
  import { describeExtras, rows, yesNo } from './output.js';
@@ -38,6 +39,7 @@ const EXTRA_LABELS = {
38
39
  eslint: 'ESLint',
39
40
  prettier: 'Prettier',
40
41
  docker: 'Docker',
42
+ welcome: 'Welcome page',
41
43
  ci: 'GitHub Actions CI',
42
44
  git: 'Initialize git',
43
45
  };
@@ -45,6 +47,7 @@ const EXTRA_HINTS = {
45
47
  eslint: 'lint scripts + configs',
46
48
  prettier: 'format script',
47
49
  docker: 'database compose file + app Dockerfiles',
50
+ welcome: 'start page that checks frontend, backend and database',
48
51
  ci: '.github/workflows/ci.yml',
49
52
  git: 'git init + first commit',
50
53
  };
@@ -117,8 +120,9 @@ function templateFor(templates, stack) {
117
120
  return template;
118
121
  }
119
122
  function extrasFor(template) {
120
- return ['eslint', 'prettier', 'docker', 'ci', 'git']
121
- .filter(e => e !== 'docker' || template.supports.docker);
123
+ return ['eslint', 'prettier', 'docker', 'welcome', 'ci', 'git']
124
+ .filter(e => e !== 'docker' || template.supports.docker)
125
+ .filter(e => e !== 'welcome' || supportsWelcome(template));
122
126
  }
123
127
  async function askPackageManager(current) {
124
128
  return answer(await p.select({
@@ -173,7 +177,7 @@ function reviewText(state, template) {
173
177
  }, t, 74);
174
178
  const details = rows([
175
179
  ['template', template.key],
176
- ['extras', describeExtras({ ...state.extras, docker })],
180
+ ['extras', describeExtras({ ...state.extras, docker, welcome: state.extras.welcome && supportsWelcome(template) })],
177
181
  ['auth', supportsAuth(template.stack.backend) ? state.auth : t.dim(`not available for ${labelFor(template.stack.backend)}`)],
178
182
  ['install', yesNo(state.install)],
179
183
  ]).map(line => ` ${line}`);
@@ -196,6 +200,7 @@ export async function runWizard(seed, templates) {
196
200
  eslint: given.eslint ?? true,
197
201
  prettier: given.prettier ?? true,
198
202
  docker: given.docker ?? true,
203
+ welcome: given.welcome ?? true,
199
204
  ci: given.ci ?? false,
200
205
  git: given.git ?? true,
201
206
  },
@@ -230,6 +235,7 @@ export async function runWizard(seed, templates) {
230
235
  packageManager: state.packageManager,
231
236
  ...state.extras,
232
237
  docker: state.extras.docker && template.supports.docker,
238
+ welcome: state.extras.welcome && supportsWelcome(template),
233
239
  auth: supportsAuth(template.stack.backend) ? state.auth : 'none',
234
240
  install: state.install,
235
241
  });
@@ -76,6 +76,25 @@
76
76
  "version": "16",
77
77
  "port": 5432
78
78
  }
79
+ },
80
+ "welcome": {
81
+ "health": "/health",
82
+ "probe": "/users",
83
+ "docs": "/api",
84
+ "routesFile": "apps/backend/src/users/users.controller.ts",
85
+ "routes": [
86
+ ["GET", "/users"],
87
+ ["GET", "/users/:id"],
88
+ ["POST", "/users"],
89
+ ["PATCH", "/users/:id"],
90
+ ["DELETE", "/users/:id"]
91
+ ],
92
+ "schema": "apps/backend/prisma/schema.prisma",
93
+ "setup": "prisma:migrate",
94
+ "database": {
95
+ "service": "postgres",
96
+ "env": "DATABASE_URL"
97
+ }
79
98
  }
80
99
  },
81
100
  "turborepo-nextjs-express-postgresql-prisma": {
@@ -150,6 +169,25 @@
150
169
  "version": "16",
151
170
  "port": 5432
152
171
  }
172
+ },
173
+ "welcome": {
174
+ "health": "/health",
175
+ "probe": "/users",
176
+ "docs": null,
177
+ "routesFile": "apps/backend/src/routes/users.ts",
178
+ "routes": [
179
+ ["GET", "/users"],
180
+ ["GET", "/users/:id"],
181
+ ["POST", "/users"],
182
+ ["PATCH", "/users/:id"],
183
+ ["DELETE", "/users/:id"]
184
+ ],
185
+ "schema": "apps/backend/prisma/schema.prisma",
186
+ "setup": "prisma:migrate",
187
+ "database": {
188
+ "service": "postgres",
189
+ "env": "DATABASE_URL"
190
+ }
153
191
  }
154
192
  },
155
193
  "turborepo-react-express-mongodb-mongoose": {
@@ -225,6 +263,25 @@
225
263
  "version": "7",
226
264
  "port": 27017
227
265
  }
266
+ },
267
+ "welcome": {
268
+ "health": "/health",
269
+ "probe": "/users",
270
+ "docs": null,
271
+ "routesFile": "apps/backend/src/routes/users.ts",
272
+ "routes": [
273
+ ["GET", "/users"],
274
+ ["GET", "/users/:id"],
275
+ ["POST", "/users"],
276
+ ["PATCH", "/users/:id"],
277
+ ["DELETE", "/users/:id"]
278
+ ],
279
+ "schema": "apps/backend/src/models/User.ts",
280
+ "setup": null,
281
+ "database": {
282
+ "service": "mongo",
283
+ "env": "MONGODB_URI"
284
+ }
228
285
  }
229
286
  },
230
287
  "turborepo-nextjs-express-mongodb-mongoose": {
@@ -299,6 +356,25 @@
299
356
  "version": "7",
300
357
  "port": 27017
301
358
  }
359
+ },
360
+ "welcome": {
361
+ "health": "/health",
362
+ "probe": "/users",
363
+ "docs": null,
364
+ "routesFile": "apps/backend/src/routes/users.ts",
365
+ "routes": [
366
+ ["GET", "/users"],
367
+ ["GET", "/users/:id"],
368
+ ["POST", "/users"],
369
+ ["PATCH", "/users/:id"],
370
+ ["DELETE", "/users/:id"]
371
+ ],
372
+ "schema": "apps/backend/src/models/User.ts",
373
+ "setup": null,
374
+ "database": {
375
+ "service": "mongo",
376
+ "env": "MONGODB_URI"
377
+ }
302
378
  }
303
379
  },
304
380
  "turborepo-nextjs-nestjs-mongodb-mongoose": {
@@ -373,6 +449,26 @@
373
449
  "version": "7",
374
450
  "port": 27017
375
451
  }
452
+ },
453
+ "welcome": {
454
+ "health": "/health",
455
+ "probe": "/users",
456
+ "docs": "/api",
457
+ "routesFile": "apps/backend/src/users/users.controller.ts",
458
+ "routes": [
459
+ ["GET", "/users"],
460
+ ["GET", "/users/:id"],
461
+ ["POST", "/users"],
462
+ ["PATCH", "/users/:id"],
463
+ ["DELETE", "/users/:id"]
464
+ ],
465
+ "schema": "apps/backend/src/users/schemas/user.schema.ts",
466
+ "setup": null,
467
+ "database": {
468
+ "service": "mongo",
469
+ "env": "MONGODB_URI",
470
+ "blocksStart": true
471
+ }
376
472
  }
377
473
  },
378
474
  "turborepo-react-nestjs-postgresql-prisma": {
@@ -448,6 +544,25 @@
448
544
  "version": "16",
449
545
  "port": 5432
450
546
  }
547
+ },
548
+ "welcome": {
549
+ "health": "/health",
550
+ "probe": "/users",
551
+ "docs": "/api",
552
+ "routesFile": "apps/backend/src/users/users.controller.ts",
553
+ "routes": [
554
+ ["GET", "/users"],
555
+ ["GET", "/users/:id"],
556
+ ["POST", "/users"],
557
+ ["PATCH", "/users/:id"],
558
+ ["DELETE", "/users/:id"]
559
+ ],
560
+ "schema": "apps/backend/prisma/schema.prisma",
561
+ "setup": "prisma:migrate",
562
+ "database": {
563
+ "service": "postgres",
564
+ "env": "DATABASE_URL"
565
+ }
451
566
  }
452
567
  },
453
568
  "turborepo-react-express-postgresql-prisma": {
@@ -523,6 +638,25 @@
523
638
  "version": "16",
524
639
  "port": 5432
525
640
  }
641
+ },
642
+ "welcome": {
643
+ "health": "/health",
644
+ "probe": "/users",
645
+ "docs": null,
646
+ "routesFile": "apps/backend/src/routes/users.ts",
647
+ "routes": [
648
+ ["GET", "/users"],
649
+ ["GET", "/users/:id"],
650
+ ["POST", "/users"],
651
+ ["PATCH", "/users/:id"],
652
+ ["DELETE", "/users/:id"]
653
+ ],
654
+ "schema": "apps/backend/prisma/schema.prisma",
655
+ "setup": "prisma:migrate",
656
+ "database": {
657
+ "service": "postgres",
658
+ "env": "DATABASE_URL"
659
+ }
526
660
  }
527
661
  },
528
662
  "turborepo-react-nestjs-mongodb-mongoose": {
@@ -598,6 +732,26 @@
598
732
  "version": "7",
599
733
  "port": 27017
600
734
  }
735
+ },
736
+ "welcome": {
737
+ "health": "/health",
738
+ "probe": "/users",
739
+ "docs": "/api",
740
+ "routesFile": "apps/backend/src/users/users.controller.ts",
741
+ "routes": [
742
+ ["GET", "/users"],
743
+ ["GET", "/users/:id"],
744
+ ["POST", "/users"],
745
+ ["PATCH", "/users/:id"],
746
+ ["DELETE", "/users/:id"]
747
+ ],
748
+ "schema": "apps/backend/src/users/schemas/user.schema.ts",
749
+ "setup": null,
750
+ "database": {
751
+ "service": "mongo",
752
+ "env": "MONGODB_URI",
753
+ "blocksStart": true
754
+ }
601
755
  }
602
756
  },
603
757
  "turborepo-nextjs-hono-postgresql-drizzle": {
@@ -672,6 +826,25 @@
672
826
  "version": "16",
673
827
  "port": 5432
674
828
  }
829
+ },
830
+ "welcome": {
831
+ "health": "/health",
832
+ "probe": "/users",
833
+ "docs": null,
834
+ "routesFile": "apps/backend/src/routes/users.ts",
835
+ "routes": [
836
+ ["GET", "/users"],
837
+ ["GET", "/users/:id"],
838
+ ["POST", "/users"],
839
+ ["PATCH", "/users/:id"],
840
+ ["DELETE", "/users/:id"]
841
+ ],
842
+ "schema": "apps/backend/src/db/schema.ts",
843
+ "setup": "db:push",
844
+ "database": {
845
+ "service": "postgres",
846
+ "env": "DATABASE_URL"
847
+ }
675
848
  }
676
849
  },
677
850
  "turborepo-nextjs-fastify-postgresql-prisma": {
@@ -746,6 +919,25 @@
746
919
  "version": "16",
747
920
  "port": 5432
748
921
  }
922
+ },
923
+ "welcome": {
924
+ "health": "/health",
925
+ "probe": "/users",
926
+ "docs": null,
927
+ "routesFile": "apps/backend/src/routes/users.ts",
928
+ "routes": [
929
+ ["GET", "/users"],
930
+ ["GET", "/users/:id"],
931
+ ["POST", "/users"],
932
+ ["PATCH", "/users/:id"],
933
+ ["DELETE", "/users/:id"]
934
+ ],
935
+ "schema": "apps/backend/prisma/schema.prisma",
936
+ "setup": "prisma:migrate",
937
+ "database": {
938
+ "service": "postgres",
939
+ "env": "DATABASE_URL"
940
+ }
749
941
  }
750
942
  },
751
943
  "turborepo-vue-express-postgresql-prisma": {
@@ -821,6 +1013,25 @@
821
1013
  "version": "16",
822
1014
  "port": 5432
823
1015
  }
1016
+ },
1017
+ "welcome": {
1018
+ "health": "/health",
1019
+ "probe": "/users",
1020
+ "docs": null,
1021
+ "routesFile": "apps/backend/src/routes/users.ts",
1022
+ "routes": [
1023
+ ["GET", "/users"],
1024
+ ["GET", "/users/:id"],
1025
+ ["POST", "/users"],
1026
+ ["PATCH", "/users/:id"],
1027
+ ["DELETE", "/users/:id"]
1028
+ ],
1029
+ "schema": "apps/backend/prisma/schema.prisma",
1030
+ "setup": "prisma:migrate",
1031
+ "database": {
1032
+ "service": "postgres",
1033
+ "env": "DATABASE_URL"
1034
+ }
824
1035
  }
825
1036
  },
826
1037
  "turborepo-nextjs-express-sqlite-drizzle": {
@@ -897,6 +1108,25 @@
897
1108
  "apps/backend/dev.db"
898
1109
  ]
899
1110
  }
1111
+ },
1112
+ "welcome": {
1113
+ "health": "/health",
1114
+ "probe": "/users",
1115
+ "docs": null,
1116
+ "routesFile": "apps/backend/src/routes/users.ts",
1117
+ "routes": [
1118
+ ["GET", "/users"],
1119
+ ["GET", "/users/:id"],
1120
+ ["POST", "/users"],
1121
+ ["PATCH", "/users/:id"],
1122
+ ["DELETE", "/users/:id"]
1123
+ ],
1124
+ "schema": "apps/backend/src/db/schema.ts",
1125
+ "setup": null,
1126
+ "database": {
1127
+ "env": "DATABASE_URL",
1128
+ "file": "apps/backend/dev.db"
1129
+ }
900
1130
  }
901
1131
  }
902
1132
  },
@@ -14,6 +14,7 @@ import { tarballUrl } from './download.js';
14
14
  import { getCacheEntry } from './template-cache.js';
15
15
  import { cloneTemplate, customizeTemplate, initializeGit, installDependencies, } from './template-clone.js';
16
16
  import { CliError } from '../utils/cli-error.js';
17
+ import { supportsWelcome } from './welcome.js';
17
18
  /** Thrown when dependency installation fails; the project itself was created. */
18
19
  export class InstallError extends CliError {
19
20
  constructor(details) {
@@ -52,8 +53,8 @@ export async function planScaffold(config, options = {}) {
52
53
  ? template.key
53
54
  : `${template.url ?? 'unknown'}${template.subfolder ? ` (${template.subfolder})` : ''}`;
54
55
  return {
55
- // A template without Docker files has nothing to keep
56
- config: template.supports.docker ? config : { ...config, docker: false },
56
+ // A template without Docker files has nothing to keep; one without welcome data keeps its start page
57
+ config: { ...config, docker: config.docker && template.supports.docker, welcome: config.welcome && supportsWelcome(template) },
57
58
  targetDir: path.join(options.cwd ?? process.cwd(), config.name),
58
59
  template,
59
60
  templateLabel,
@@ -83,7 +84,7 @@ export async function scaffoldProject(plan, hooks = {}) {
83
84
  const source = await cloneTemplate(plan.template, targetDir, { noCache: plan.noCache });
84
85
  done('copy', source);
85
86
  start('customize');
86
- await customizeTemplate(targetDir, config, { kind: plan.kind });
87
+ await customizeTemplate(targetDir, config, { kind: plan.kind, template: plan.template });
87
88
  done('customize');
88
89
  }
89
90
  catch (error) {
@@ -8,6 +8,7 @@ import { run } from '../utils/exec.js';
8
8
  import { downloadTemplate } from './download.js';
9
9
  import { getTemplateFromCache } from './template-cache.js';
10
10
  import { describeJwtAuth, generateJwtAuth, jwtFiles, supportsAuth } from './auth/jwt.js';
11
+ import { applyWelcome, supportsWelcome, welcomeEntry, welcomeFiles } from './welcome.js';
11
12
  /**
12
13
  * Copy a template into `targetDir` (which must not exist):
13
14
  * local path → copy; otherwise cache (24 h) → tarball download.
@@ -93,7 +94,11 @@ export async function customizeTemplate(targetDir, config, options) {
93
94
  }
94
95
  await generateJwtAuth(targetDir, backend, config.packageManager);
95
96
  }
96
- // 6. pnpm needs "workspace:*" for local packages (templates ship npm-style "*")
97
+ // 6. Welcome page (official and contributed only; after auth, so it lists the auth routes)
98
+ if (!custom && config.welcome && options.template) {
99
+ await applyWelcome(targetDir, config, options.template);
100
+ }
101
+ // 7. pnpm needs "workspace:*" for local packages (templates ship npm-style "*")
97
102
  if (config.packageManager === 'pnpm') {
98
103
  await fixWorkspaceProtocol(targetDir);
99
104
  }
@@ -101,7 +106,7 @@ export async function customizeTemplate(targetDir, config, options) {
101
106
  /**
102
107
  * The changes customizeTemplate will make, for --dry-run.
103
108
  */
104
- export function describeCustomizations(config, kind) {
109
+ export function describeCustomizations(config, kind, template) {
105
110
  const custom = kind === 'custom';
106
111
  const actions = [];
107
112
  actions.push(custom
@@ -129,13 +134,16 @@ export function describeCustomizations(config, kind) {
129
134
  if (!custom && config.auth === 'jwt' && supportsAuth(backend)) {
130
135
  actions.push(...describeJwtAuth(backend));
131
136
  }
137
+ if (!custom && config.welcome && template && supportsWelcome(template)) {
138
+ actions.push(`Use the welcome page as the start page (${welcomeEntry(template)}), which checks the frontend, backend and database`);
139
+ }
132
140
  return actions;
133
141
  }
134
142
  /**
135
143
  * Files customizeTemplate adds and removes (project-relative POSIX paths), for
136
144
  * --dry-run. Removed paths are candidates: a template may not have them all.
137
145
  */
138
- export function plannedFileChanges(config, kind) {
146
+ export function plannedFileChanges(config, kind, template) {
139
147
  const custom = kind === 'custom';
140
148
  const added = [];
141
149
  const removed = [];
@@ -153,6 +161,8 @@ export function plannedFileChanges(config, kind) {
153
161
  const backend = config.stack?.backend;
154
162
  if (config.auth === 'jwt' && supportsAuth(backend))
155
163
  added.push(...jwtFiles(backend));
164
+ if (config.welcome && template && supportsWelcome(template))
165
+ added.push(...welcomeFiles(template));
156
166
  }
157
167
  return { added, removed };
158
168
  }
@@ -47,6 +47,26 @@ export const LayersSchema = z.object({
47
47
  orm: LayerSchema,
48
48
  database: LayerSchema,
49
49
  });
50
+ /** What the welcome page (core/welcome.ts) shows beyond the layers; checked against the files by validate-registry. */
51
+ export const WelcomeSchema = z.object({
52
+ health: z.string().min(1),
53
+ /** Route the page calls to see whether the backend reaches the database. */
54
+ probe: z.string().min(1),
55
+ /** API docs path (NestJS Swagger), null when the backend has none. */
56
+ docs: z.string().min(1).nullable(),
57
+ routesFile: z.string().min(1),
58
+ routes: z.array(z.tuple([z.string().min(1), z.string().min(1)])),
59
+ schema: z.string().min(1),
60
+ /** Backend script that creates the tables on first run, null when the backend does it itself. */
61
+ setup: z.string().min(1).nullable(),
62
+ database: z.object({
63
+ service: z.string().min(1).optional(),
64
+ env: z.string().min(1),
65
+ file: z.string().min(1).optional(),
66
+ /** The backend waits for the database before it listens (NestJS + Mongoose). */
67
+ blocksStart: z.boolean().optional(),
68
+ }),
69
+ });
50
70
  export const RegistryEntrySchema = z.object({
51
71
  id: z.string().optional(),
52
72
  description: z.string().min(1),
@@ -58,6 +78,8 @@ export const RegistryEntrySchema = z.object({
58
78
  node: z.string().min(1).optional(),
59
79
  /** Layer data for the layer log (required for official entries by validate-registry). */
60
80
  layers: LayersSchema.optional(),
81
+ /** Welcome page data (required for official entries by validate-registry). */
82
+ welcome: WelcomeSchema.optional(),
61
83
  });
62
84
  export const ContributedEntrySchema = RegistryEntrySchema.extend({
63
85
  contributor: ContributorSchema,
@@ -93,6 +115,7 @@ export function toTemplates(registry, options = {}) {
93
115
  stack: entry.stack,
94
116
  node: entry.node,
95
117
  layers: entry.layers,
118
+ welcome: entry.welcome,
96
119
  };
97
120
  if (options.localDir) {
98
121
  return { ...base, localPath: path.join(options.localDir, relative) };
@@ -0,0 +1,260 @@
1
+ /**
2
+ * The welcome page: <cfa-welcome> as the generated project's start page.
3
+ *
4
+ * The element (welcome/src/cfa-welcome.ts, built into welcome/dist/ by
5
+ * scripts/build-welcome.mjs) ships inside the CLI package, so a project gets
6
+ * the page that matches the CLI version that made it. applyWelcome() copies it
7
+ * into apps/frontend/src/cfa-welcome/, writes stack.ts (what the page shows,
8
+ * from the registry's layers and welcome data plus the chosen options) and
9
+ * replaces the start page and its test. --no-welcome skips all of it and the
10
+ * template's own start page stays.
11
+ */
12
+ import fs from 'fs/promises';
13
+ import { existsSync } from 'fs';
14
+ import path from 'path';
15
+ import { fileURLToPath } from 'url';
16
+ import { Logger } from '../utils/logger.js';
17
+ /** welcome/dist/ of the CLI package (the same path from src/core/ and dist/core/). */
18
+ export const WELCOME_DIST = fileURLToPath(new URL('../../welcome/dist/', import.meta.url));
19
+ const WELCOME_FILES = ['cfa-welcome.js', 'cfa-welcome-display.woff2', 'OFL-BarlowCondensed.txt'];
20
+ /** Folder inside the frontend that holds the element, its types and stack.ts. */
21
+ const WELCOME_FOLDER = 'src/cfa-welcome';
22
+ const NEXT_PAGE = ({ api }) => `"use client";
23
+
24
+ // The start page create-fs-app made for this project: it checks that the
25
+ // frontend, the backend and the database are connected. To use your own page,
26
+ // replace this file; src/cfa-welcome/ can then be deleted.
27
+ import "../cfa-welcome/cfa-welcome.js";
28
+ import { stack } from "../cfa-welcome/stack";
29
+
30
+ const API = process.env.NEXT_PUBLIC_API_URL ?? "${api}";
31
+
32
+ // <cfa-welcome> is a custom element. Typing it here, instead of in React's JSX
33
+ // namespace, works whichever copy of @types/react the build picks up.
34
+ const CfaWelcome = "cfa-welcome" as unknown as (props: { api: string; stack: string }) => null;
35
+
36
+ export default function Home() {
37
+ return <CfaWelcome api={API} stack={JSON.stringify(stack)} />;
38
+ }
39
+ `;
40
+ const REACT_PAGE = ({ api }) => `// The start page create-fs-app made for this project: it checks that the
41
+ // frontend, the backend and the database are connected. To use your own page,
42
+ // replace this component; src/cfa-welcome/ can then be deleted.
43
+ import './cfa-welcome/cfa-welcome.js';
44
+ import { stack } from './cfa-welcome/stack';
45
+
46
+ const API = import.meta.env.VITE_API_URL ?? '${api}';
47
+
48
+ // <cfa-welcome> is a custom element. Typing it here, instead of in React's JSX
49
+ // namespace, works whichever copy of @types/react the build picks up.
50
+ const CfaWelcome = 'cfa-welcome' as unknown as (props: { api: string; stack: string }) => null;
51
+
52
+ function App() {
53
+ return <CfaWelcome api={API} stack={JSON.stringify(stack)} />;
54
+ }
55
+
56
+ export default App;
57
+ `;
58
+ const VUE_PAGE = ({ api }) => `<script setup lang="ts">
59
+ // The start page create-fs-app made for this project: it checks that the
60
+ // frontend, the backend and the database are connected. To use your own page,
61
+ // replace this component; src/cfa-welcome/ and the isCustomElement option in
62
+ // vite.config.ts and vitest.config.ts can then be deleted.
63
+ import './cfa-welcome/cfa-welcome.js';
64
+ import { stack } from './cfa-welcome/stack';
65
+
66
+ const api = import.meta.env.VITE_API_URL ?? '${api}';
67
+ const stackJson = JSON.stringify(stack);
68
+ </script>
69
+
70
+ <template>
71
+ <cfa-welcome
72
+ :api="api"
73
+ :stack="stackJson"
74
+ />
75
+ </template>
76
+ `;
77
+ /** Shared body of the start page tests: the element renders the project's stack. */
78
+ const testBody = (q, name, render) => `
79
+ afterEach(() => {
80
+ cleanup();
81
+ vi.unstubAllGlobals();
82
+ });
83
+
84
+ test(${q}renders the welcome page for this project${q}, async () => {
85
+ // The page checks the backend; answer without one running
86
+ vi.stubGlobal(${q}fetch${q}, vi.fn().mockResolvedValue(new Response(${q}{}${q})));
87
+ const { container } = ${render};
88
+ const page = container.querySelector(${q}cfa-welcome${q});
89
+ expect(page).not.toBeNull();
90
+ await vi.waitFor(() => expect(page!.shadowRoot?.textContent).toContain(${q}${name} is running.${q}));
91
+ });
92
+ `;
93
+ const FRONTENDS = {
94
+ 'next.js': {
95
+ entry: 'src/app/page.tsx',
96
+ test: '__tests__/page.test.tsx',
97
+ page: NEXT_PAGE,
98
+ testFile: ({ name }) => `import { cleanup, render } from "@testing-library/react";
99
+ import { afterEach, expect, test, vi } from "vitest";
100
+ import Home from "../src/app/page";
101
+ ${testBody('"', name, 'render(<Home />)')}`,
102
+ },
103
+ react: {
104
+ entry: 'src/App.tsx',
105
+ test: 'src/App.test.tsx',
106
+ page: REACT_PAGE,
107
+ testFile: ({ name }) => `import { cleanup, render } from '@testing-library/react';
108
+ import { afterEach, expect, test, vi } from 'vitest';
109
+ import App from './App';
110
+ ${testBody("'", name, 'render(<App />)')}`,
111
+ },
112
+ vue: {
113
+ entry: 'src/App.vue',
114
+ test: 'src/App.test.ts',
115
+ page: VUE_PAGE,
116
+ testFile: ({ name }) => `import { cleanup, render } from '@testing-library/vue';
117
+ import { afterEach, expect, test, vi } from 'vitest';
118
+ import App from './App.vue';
119
+ ${testBody("'", name, 'render(App)')}`,
120
+ },
121
+ };
122
+ const PLAIN_TYPES = `// Types for cfa-welcome.js (generated by create-fs-app). The module only registers <cfa-welcome>.
123
+ export {};
124
+ `;
125
+ /** The JWT routes the auth scaffolding adds (core/auth/jwt.ts). */
126
+ const JWT_ROUTES = [
127
+ ['POST', '/auth/login', '5 per 15 min'],
128
+ ['GET', '/auth/me', 'needs token'],
129
+ ];
130
+ /** Whether the welcome page can be added: an official or contributed template with welcome data and a known frontend. */
131
+ export function supportsWelcome(template) {
132
+ const frontend = template.stack?.frontend;
133
+ return Boolean(template.welcome && template.layers && frontend && frontend in FRONTENDS);
134
+ }
135
+ /** The welcome page's start page file, relative to the project (for --dry-run and messages). */
136
+ export function welcomeEntry(template) {
137
+ const kind = FRONTENDS[template.stack?.frontend ?? ''];
138
+ if (!kind || !template.layers)
139
+ return undefined;
140
+ return path.posix.join(template.layers.frontend.path ?? 'apps/frontend', kind.entry);
141
+ }
142
+ /** Files applyWelcome adds or replaces (project-relative POSIX paths), for --dry-run. */
143
+ export function welcomeFiles(template) {
144
+ const kind = FRONTENDS[template.stack?.frontend ?? ''];
145
+ if (!kind || !template.layers)
146
+ return [];
147
+ const fe = template.layers.frontend.path ?? 'apps/frontend';
148
+ const folder = path.posix.join(fe, WELCOME_FOLDER);
149
+ return [
150
+ ...WELCOME_FILES.map(f => path.posix.join(folder, f)),
151
+ path.posix.join(folder, 'cfa-welcome.d.ts'),
152
+ path.posix.join(folder, 'stack.ts'),
153
+ ];
154
+ }
155
+ /** "^20.19.0 || ^22.12.0 || >=24.0.0" → "20.19+" (the lowest supported version). */
156
+ function nodeLabel(range) {
157
+ const match = range?.match(/(\d+)\.(\d+)/);
158
+ return match ? `${match[1]}.${match[2]}+` : undefined;
159
+ }
160
+ function layer(l) {
161
+ if (!l)
162
+ return {};
163
+ const { name, version, path: p, port, notes } = l;
164
+ return { name, version, path: p, port, notes };
165
+ }
166
+ /** What the page shows: the shape of `Stack` in welcome/src/cfa-welcome.ts. */
167
+ export function buildWelcomeStack(config, template) {
168
+ const { layers, welcome, stack } = template;
169
+ if (!layers || !welcome || !stack)
170
+ throw new Error('This template has no welcome page data');
171
+ const pm = config.packageManager;
172
+ const backendPath = layers.backend.path ?? 'apps/backend';
173
+ const jwt = config.auth === 'jwt';
174
+ const docker = config.docker && template.supports.docker;
175
+ return {
176
+ name: config.name,
177
+ packageManager: pm,
178
+ monorepo: stack.monorepo,
179
+ node: nodeLabel(template.node),
180
+ entry: welcomeEntry(template),
181
+ docker,
182
+ auth: jwt ? 'jwt' : null,
183
+ frontend: layer(layers.frontend),
184
+ backend: {
185
+ ...layer(layers.backend),
186
+ health: welcome.health,
187
+ probe: welcome.probe,
188
+ docs: welcome.docs,
189
+ routesFile: welcome.routesFile,
190
+ routes: [...welcome.routes, ...(jwt ? JWT_ROUTES : [])],
191
+ },
192
+ orm: {
193
+ ...layer(layers.orm),
194
+ schema: welcome.schema,
195
+ // From the project root; "cd ../.." brings the shell back for the next command
196
+ setup: welcome.setup ? `cd ${backendPath} && ${pm} run ${welcome.setup} && cd ../..` : null,
197
+ },
198
+ database: {
199
+ ...layer(layers.database),
200
+ kind: stack.database,
201
+ ...welcome.database,
202
+ },
203
+ };
204
+ }
205
+ /** Let Vue treat <cfa-welcome> as a custom element: vue() → vue({ template: { compilerOptions: ... } }). */
206
+ async function patchVueConfig(file) {
207
+ if (!existsSync(file))
208
+ return;
209
+ const content = await fs.readFile(file, 'utf-8');
210
+ const next = content.replace(/\bvue\(\)/, "vue({ template: { compilerOptions: { isCustomElement: (tag) => tag === 'cfa-welcome' } } })");
211
+ if (next === content) {
212
+ Logger.warn(`Could not find vue() in ${path.basename(file)}; add isCustomElement for cfa-welcome to the Vue plugin yourself.`);
213
+ return;
214
+ }
215
+ await fs.writeFile(file, next);
216
+ }
217
+ /**
218
+ * React (Vite) lints only .ts/.tsx, so the built file's eslint-disable banner is
219
+ * reported as unused; ignore the file instead. Next.js and Vue lint .js files
220
+ * and need the banner.
221
+ */
222
+ async function ignoreInReactEslint(frontendDir) {
223
+ const file = path.join(frontendDir, 'eslint.config.js');
224
+ if (!existsSync(file))
225
+ return; // --no-eslint
226
+ const content = await fs.readFile(file, 'utf-8');
227
+ const next = content.replace(/ignores: \['dist'\]/, "ignores: ['dist', 'src/cfa-welcome/cfa-welcome.js']");
228
+ if (next !== content)
229
+ await fs.writeFile(file, next);
230
+ }
231
+ /** Add the welcome page to a scaffolded project. Skips templates supportsWelcome() rejects. */
232
+ export async function applyWelcome(targetDir, config, template) {
233
+ if (!supportsWelcome(template))
234
+ return;
235
+ const kind = FRONTENDS[template.stack.frontend];
236
+ const frontendDir = path.join(targetDir, template.layers.frontend.path ?? 'apps/frontend');
237
+ const folder = path.join(frontendDir, WELCOME_FOLDER);
238
+ const missing = WELCOME_FILES.filter(f => !existsSync(path.join(WELCOME_DIST, f)));
239
+ if (missing.length > 0) {
240
+ throw new Error(`The welcome page files are missing from ${WELCOME_DIST} (${missing.join(', ')}); run the CLI build (scripts/build-welcome.mjs).`);
241
+ }
242
+ await fs.mkdir(folder, { recursive: true });
243
+ for (const file of WELCOME_FILES) {
244
+ await fs.copyFile(path.join(WELCOME_DIST, file), path.join(folder, file));
245
+ }
246
+ await fs.writeFile(path.join(folder, 'cfa-welcome.d.ts'), PLAIN_TYPES);
247
+ const stack = buildWelcomeStack(config, template);
248
+ await fs.writeFile(path.join(folder, 'stack.ts'), `// What the start page shows about this project (written by create-fs-app).\nexport const stack = ${JSON.stringify(stack, null, 2)};\n`);
249
+ const port = template.layers.backend.port ?? 3001;
250
+ const input = { name: config.name, api: `http://localhost:${port}` };
251
+ await fs.writeFile(path.join(frontendDir, kind.entry), kind.page(input));
252
+ await fs.mkdir(path.dirname(path.join(frontendDir, kind.test)), { recursive: true });
253
+ await fs.writeFile(path.join(frontendDir, kind.test), kind.testFile(input));
254
+ if (template.stack.frontend === 'react')
255
+ await ignoreInReactEslint(frontendDir);
256
+ if (template.stack.frontend === 'vue') {
257
+ await patchVueConfig(path.join(frontendDir, 'vite.config.ts'));
258
+ await patchVueConfig(path.join(frontendDir, 'vitest.config.ts'));
259
+ }
260
+ }
@@ -25,6 +25,7 @@ export const ProjectOptionsSchema = z.object({
25
25
  prettier: z.boolean().default(true),
26
26
  docker: z.boolean().default(true),
27
27
  auth: AuthStrategySchema.default('none'),
28
+ welcome: z.boolean().default(true), // <cfa-welcome> start page (core/welcome.ts)
28
29
  git: z.boolean().default(true), // git init + first commit
29
30
  install: z.boolean().default(false), // install dependencies after scaffolding
30
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fs-app",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Create a full-stack TypeScript monorepo from one command: a frontend, a backend and a database, already connected.",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {
@@ -9,20 +9,22 @@
9
9
  "type": "module",
10
10
  "files": [
11
11
  "dist/**/*",
12
+ "welcome/dist/**/*",
12
13
  "README.md",
13
14
  "LICENSE"
14
15
  ],
15
16
  "scripts": {
16
- "prebuild": "node scripts/sync-registry.mjs",
17
+ "prebuild": "node scripts/sync-registry.mjs && node scripts/build-welcome.mjs",
17
18
  "build": "tsc",
18
19
  "dev": "tsc -w",
19
20
  "lint": "eslint . --max-warnings 0",
20
21
  "lint:fix": "eslint . --fix",
21
- "typecheck": "tsc --noEmit",
22
+ "typecheck": "tsc --noEmit && tsc -p welcome",
22
23
  "test": "vitest run",
23
24
  "test:e2e-templates": "node scripts/e2e-templates.mjs",
24
25
  "test:e2e-docker": "node scripts/e2e-docker.mjs",
25
26
  "sync-registry": "node scripts/sync-registry.mjs",
27
+ "build:welcome": "node scripts/build-welcome.mjs",
26
28
  "postbuild": "node -e \"require('fs').chmodSync('dist/index.js', 0o755)\"",
27
29
  "prepublishOnly": "npm run build",
28
30
  "size": "npm pack --dry-run 2>&1 | grep -E 'package size|Tarball Contents'",
@@ -77,6 +79,7 @@
77
79
  "@types/node": "^24.8.1",
78
80
  "@typescript-eslint/eslint-plugin": "^8.46.1",
79
81
  "@typescript-eslint/parser": "^8.46.1",
82
+ "esbuild": "^0.28.2",
80
83
  "eslint": "^9.38.0",
81
84
  "typescript": "^5.9.3",
82
85
  "vitest": "^4.0.0"
@@ -0,0 +1,93 @@
1
+ Copyright 2017 The Barlow Project Authors (https://github.com/jpt/barlow)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,114 @@
1
+ /* <cfa-welcome>, the start page made by create-fs-app (https://github.com/Om-jannu/create-fs-app). Generated file. */
2
+ /* eslint-disable */
3
+ var ue="https://github.com/Om-jannu/create-fs-app",me="https://create-fs-app.vercel.app/docs",fe="'CFA Display','Barlow Condensed','Avenir Next Condensed','Roboto Condensed','Arial Narrow',sans-serif",s=$=>String($??"").replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`),o=$=>`<code>${s($).replace(/\//g,"/<wbr>")}</code>`,be=0,V=!1;async function z($,e){let n=new AbortController,l=setTimeout(()=>n.abort(),e),i=performance.now();try{let c=await fetch($,{signal:n.signal,cache:"no-store",headers:{accept:"application/json"}}),m=Math.round(performance.now()-i),g=c.ok?await c.json().catch(()=>null):null;return{s:c.ok?"ok":"error",code:c.status,ms:m,body:g}}catch{if(n.signal.aborted)return{s:"timeout"};try{return await fetch($,{mode:"no-cors",cache:"no-store",signal:AbortSignal.timeout(e)}),{s:"cors"}}catch{return{s:"down"}}}finally{clearTimeout(l)}}var ge=`
4
+ :host{--ground:#ece6d6;--sunk:#e3dcc9;--text:#23262b;--text2:#4a4a44;--muted:#5e5c54;--line:#23262b;--soft:#9b9584;--ok:#1a6b43;--err:#a33a1c;--slip:#23262b;--on-slip:#ece6d6;--on-slip-2:#b9b2a0;--sel:#d9c49a;
5
+ display:block;min-height:100vh;min-height:100dvh;background:var(--ground);color:var(--text);color-scheme:light;
6
+ font:400 1.0625rem/1.55 'Iowan Old Style','Source Serif 4',Charter,Georgia,serif;-webkit-text-size-adjust:100%}
7
+ :host([hidden]){display:none}
8
+ @media (prefers-color-scheme:dark){:host(:not([theme=light])){--ground:#1c1f23;--sunk:#272b30;--text:#ece6d6;--text2:#c9c2b0;--muted:#a8a191;--line:#cfc8b6;--soft:#6d6b63;--ok:#6cc596;--err:#ff9b94;--slip:#ece6d6;--on-slip:#23262b;--on-slip-2:#4a4a44;--sel:#ff7a52;color-scheme:dark}}
9
+ :host([theme=dark]){--ground:#1c1f23;--sunk:#272b30;--text:#ece6d6;--text2:#c9c2b0;--muted:#a8a191;--line:#cfc8b6;--soft:#6d6b63;--ok:#6cc596;--err:#ff9b94;--slip:#ece6d6;--on-slip:#23262b;--on-slip-2:#4a4a44;--sel:#ff7a52;color-scheme:dark}
10
+ *{box-sizing:border-box;margin:0;padding:0}
11
+ ::selection{background:var(--sel);color:#23262b}
12
+ .w{container-type:inline-size;min-height:inherit}
13
+ .d{font-family:${fe};font-weight:700;font-stretch:condensed;letter-spacing:-.015em;line-height:1}
14
+ code,.m{font-family:ui-monospace,'SF Mono',SFMono-Regular,Menlo,Consolas,monospace;font-size:.8125rem;font-variant-numeric:tabular-nums}
15
+ a{color:inherit;text-decoration:underline 1.5px;text-underline-offset:3px}
16
+ a:hover{text-decoration-color:#ff7a52}
17
+ :focus-visible{outline:2px solid var(--text);outline-offset:3px}
18
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
19
+ .pad{padding-inline:clamp(20px,4cqi,56px);max-width:1440px;margin-inline:auto}
20
+ .hd{border-bottom:1.5px solid var(--line)}
21
+ .hd .pad{display:flex;flex-wrap:wrap;gap:8px 24px;align-items:center;justify-content:space-between;padding-block:16px}
22
+ .brand{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
23
+ .brand b{font-size:1.375rem}
24
+ .brand svg{flex:none;color:var(--text)}
25
+ .brand .m,.credit{color:var(--muted)}
26
+ .credit{font-size:.875rem}
27
+ .credit a,.credit button{color:var(--text)}
28
+ .lk{font:inherit;background:none;border:0;cursor:pointer;text-decoration:underline 1.5px;text-underline-offset:3px}
29
+ .lk:hover{text-decoration-color:#ff7a52}
30
+ .jump{display:none;color:var(--err);font-weight:600}
31
+ .rm{border:1.5px dashed var(--soft);padding:12px 16px;margin-top:20px;font-size:.9375rem;max-width:72ch}
32
+ main,.main{display:block;padding-block:clamp(24px,3cqi,40px) 40px}
33
+ .top{display:flex;flex-wrap:wrap;gap:20px 40px;justify-content:space-between;align-items:flex-end}
34
+ h1.d,.hl{font-size:clamp(2.5rem,1.2rem + 4cqi,4rem);line-height:.98;overflow-wrap:anywhere;text-wrap:balance}
35
+ .lede{font-size:clamp(1.0625rem,1rem + .3cqi,1.1875rem);line-height:1.45;margin-top:12px;max-width:62ch;color:var(--text2)}
36
+ .lede code,.next code,.fix code,.note code,.rm code{background:var(--sunk);color:var(--text);padding:1px 5px;overflow-wrap:anywhere}
37
+ .sum{display:flex;flex-wrap:wrap;gap:10px 14px;align-items:center}
38
+ .sq{display:inline-flex;gap:6px}
39
+ .q{display:inline-block;width:10px;height:10px;border:1.5px solid var(--line);flex:none}
40
+ .q.ok{background:var(--ok);border-color:var(--ok)}
41
+ .q.down{background:var(--err);border-color:var(--err)}
42
+ .q.wait{animation:bl 1.2s steps(2,start) infinite}
43
+ .q.unknown{border-style:dashed;border-color:var(--soft)}
44
+ @keyframes bl{50%{background:var(--line)}}
45
+ .btn{font:700 .75rem/1 ui-monospace,'SF Mono',Menlo,Consolas,monospace;letter-spacing:.12em;text-transform:uppercase;color:var(--text);background:transparent;border:1.5px solid var(--line);padding:10px 16px;min-width:7.5em;min-height:40px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
46
+ .btn:hover,.btn[data-done]{background:var(--text);color:var(--ground);border-color:var(--text)}
47
+ .btn[aria-disabled=true]{cursor:progress}
48
+ .grid{display:grid;grid-template-columns:minmax(0,1fr) 48px minmax(0,1.3fr) 48px minmax(0,1.1fr);margin-top:clamp(24px,2.6cqi,36px)}
49
+ .p{border:1.5px solid var(--line);display:flex;flex-direction:column;min-width:0}
50
+ .p[data-s=down]{border-color:var(--err)}
51
+ .strip{display:block;width:100%;height:14px;border-bottom:1.5px solid var(--line)}
52
+ .p[data-s=down] .strip{border-bottom-color:var(--err)}
53
+ .in{padding:18px 20px 20px;display:flex;flex-direction:column;gap:12px;flex:1}
54
+ .in h2,.in h3,.in h4,.in h5,.in h6{font-size:clamp(1.625rem,1.2rem + 1cqi,1.875rem)}
55
+ .role{color:var(--muted);margin-top:-4px}
56
+ .nw{white-space:nowrap;overflow-wrap:anywhere}
57
+ .state{display:flex;gap:8px;align-items:baseline;font-weight:600;font-size:.9375rem;line-height:1.4}
58
+ .state .m{font-weight:700}
59
+ .state .q{transform:translateY(1px)}
60
+ .state.down{color:var(--err)}
61
+ .state.unknown,.state.wait{color:var(--muted)}
62
+ .p p{font-size:.9375rem;line-height:1.45}
63
+ .note{color:var(--text2)}
64
+ table{border-collapse:collapse;width:100%}
65
+ th,td{padding:7px 0;border-bottom:1.5px dashed var(--soft);text-align:left;vertical-align:baseline}
66
+ td+td{padding-left:12px}
67
+ td:first-child{font-weight:700;width:5.5em}
68
+ td:last-child{text-align:right;color:var(--muted)}
69
+ td.bad{color:var(--err)}
70
+ .fix{display:flex;flex-direction:column;gap:10px;border-top:1.5px solid var(--err);padding-top:12px}
71
+ .fix>p{font-size:.9375rem}
72
+ .fix.aux{border-top-color:var(--line)}
73
+ .slip{background:var(--slip);color:var(--on-slip);display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;justify-content:space-between;padding:10px 10px 10px 14px}
74
+ .slip code{font-size:.875rem;font-weight:600;white-space:pre-wrap;overflow-wrap:break-word;flex:1 1 12ch;min-width:0;background:none;color:inherit;padding:0}
75
+ .slip .btn{color:var(--on-slip);border-color:var(--on-slip);min-height:34px;min-width:5.5em;padding:7px 10px}
76
+ .slip .btn:hover,.slip .btn[data-done]{background:var(--on-slip);color:var(--slip)}
77
+ .slip:has(.btn:focus-visible){outline:2px solid var(--text);outline-offset:2px}
78
+ .slip .btn:focus-visible{outline-color:var(--on-slip);outline-offset:-5px}
79
+ .then{color:var(--text2)}
80
+ .wire{position:relative;min-height:28px}
81
+ .wire svg{position:absolute;overflow:visible}
82
+ .wire .h{left:0;width:100%;top:calc(50% - 6px)}
83
+ .wire .v{top:0;height:100%;left:calc(50% - 6px)}
84
+ .wire line{stroke:var(--line);stroke-width:1.5px;vector-effect:non-scaling-stroke}
85
+ .wire .v{display:none}
86
+ .wire[data-s=wait] line{stroke-dasharray:6 6;animation:mv .9s linear infinite}
87
+ .wire[data-s=down] line{stroke:var(--err);stroke-dasharray:7 5;stroke-width:2px}
88
+ .wire[data-s=unknown] line{stroke:var(--soft);stroke-dasharray:2 6}
89
+ @keyframes mv{to{stroke-dashoffset:-12}}
90
+ .next{display:flex;flex-wrap:wrap;gap:10px 28px;align-items:baseline;margin-top:24px;padding-top:16px;border-top:1.5px dashed var(--soft)}
91
+ .next h2,.next h3,.next h4,.next h5,.next h6{font:700 .6875rem/1.4 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
92
+ .next{flex-wrap:nowrap}
93
+ .next ul{list-style:none;display:flex;flex-wrap:wrap;gap:10px 28px;font-size:.9375rem;flex:1;min-width:0}
94
+ @container (max-width:999px){
95
+ .grid{grid-template-columns:minmax(0,1fr)}
96
+ .wire{height:32px;min-height:0}
97
+ .wire .h{display:none}.wire .v{display:block}
98
+ .jump{display:inline;flex-basis:100%;text-align:left;order:3}
99
+ .sum{width:100%}
100
+ }
101
+ @container (max-width:479px){.sum .btn{margin-left:auto}.next{flex-direction:column}.next ul{flex-direction:column}}
102
+ @container (max-width:20rem){.nw{white-space:normal}table{table-layout:fixed}td:first-child{width:auto}td{overflow-wrap:anywhere}td+td{padding-left:8px}}
103
+ @media (prefers-reduced-motion:reduce){.wire[data-s=wait] line,.q.wait{animation:none}}
104
+ @media (forced-colors:active){.q.ok,.q.down{background:CanvasText}.slip{border:1.5px solid CanvasText}}
105
+ `,B={wait:"Checking",ok:"Connected",down:"Not reachable",unknown:"Unknown",cors:"Blocked by CORS",timeout:"No answer",error:"Answered with an error"},we=typeof HTMLElement>"u"?class{}:HTMLElement,D=class extends we{static observedAttributes=["stack","api","theme","heading-level"];#n;#u=`cfa${++be}`;#o=null;#e={s:"wait"};#t={s:"wait"};#r={s:"wait"};#l=0;#i=!1;#c=!1;#d=!1;#p;#s;constructor(){super(),this.#n=this.attachShadow({mode:"open"}),this.#n.innerHTML=`<style>${ge}</style><div class="w"></div><p class="sr" role="status" aria-live="polite"></p>`,this.#s=this.#n.querySelector(".w"),this.#s.setAttribute("role","region"),this.#s.setAttribute("aria-labelledby",`${this.#u}-h`),this.#p=this.#n.querySelector("[role=status]"),this.#n.addEventListener("click",e=>this.#w(e))}get stack(){return this.#o}set stack(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{e=null}this.#o=e??null,this.#a(),this.#d&&this.isConnected&&this.check()}get api(){return(this.getAttribute("api")||"http://localhost:3001").replace(/\/$/,"")}set api(e){e?this.setAttribute("api",e):this.removeAttribute("api")}connectedCallback(){this.#d=!0,this.#b(),this.#o||this.#m(),this.#a(),this.check()}attributeChangedCallback(e,n,l){n===l||!this.#d||!this.isConnected||(e==="stack"&&this.#m(),this.#a(),(e==="stack"||e==="api")&&this.check())}#m(){try{this.#o=JSON.parse(this.getAttribute("stack")||"null")}catch{this.#o=null}}#b(){let e=this.getAttribute("font-src")??new URL("./cfa-welcome-display.woff2",import.meta.url).href;if(V||e==="none"||typeof FontFace>"u")return;V=!0,new FontFace("CFA Display",`url(${JSON.stringify(e)}) format('woff2')`,{weight:"700",display:"swap"}).load().then(l=>document.fonts.add(l),()=>{})}async check(){let e=this.#o;if(!e)return;let n=++this.#l,l=Number(this.getAttribute("timeout"))||4e3;this.#i=!0,this.#e=this.#t={s:"wait"},this.#r={s:e.backend.docs?"wait":"none"},this.#a();let i=this.api,c=new Promise(g=>setTimeout(g,450)),m=await z(i+(e.backend.health||"/health"),l);if(await c,n===this.#l){if(this.#e=m,m.s!=="ok")this.#t={s:"unknown"},e.backend.docs&&(this.#r={s:"unknown"});else{let g=m.body?.database,M=typeof g=="string"?Promise.resolve({s:g==="ok"||g==="up"?"ok":"down",ms:m.ms,code:m.code}):e.backend.probe===null?Promise.resolve({s:"unknown"}):z(i+(e.backend.probe||"/users"),Math.max(l*3,12e3)).then(u=>u.s==="ok"?u:u.s==="timeout"||(u.code??0)>=500?{...u,s:"down"}:{...u,s:u.s==="error"?"unknown":u.s}),S=e.backend.docs?z(i+e.backend.docs,l):Promise.resolve({s:"none"}),[N,v]=await Promise.all([M,S]);if(n!==this.#l)return;this.#t=N,this.#r=v.s==="ok"||v.s==="none"?v:{...v,s:"error"}}this.#i=!1,this.#a(),this.#h(this.#g())}}#f(){return 1+ +(this.#e.s==="ok")+ +(this.#t.s==="ok")}#g(){let e=this.#o,n=[this.#e.s!=="ok"&&`${e.backend.name}: ${B[this.#e.s].toLowerCase()}`,this.#t.s!=="ok"&&`${e.database.name}: ${B[this.#t.s].toLowerCase()}`].filter(Boolean);return`Checks finished. ${this.#f()} of 3 connected.${n.length?" "+n.join(". ")+".":""}`}#h(e){this.#p.textContent="",setTimeout(()=>{this.#p.textContent=e},60)}#w=async e=>{let n=e.target.closest("button");if(n){if(n.dataset.act==="check"){if(this.#i)return;this.#h("Checking again"),this.check()}else if(n.dataset.act==="jump"){let l=this.#n.querySelector(".p[data-s=down]"),i=l?.querySelector("[data-copy]");l?.scrollIntoView({block:"start",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"}),i?.focus({preventScroll:!0})}else if(n.dataset.act==="remove")this.#c=!this.#c,this.#a();else if(n.dataset.copy!=null){let l=n.dataset.copy,i=!1;try{await navigator.clipboard.writeText(l),i=!0}catch{let c=document.createElement("textarea");c.value=l,c.setAttribute("readonly",""),c.style.cssText="position:fixed;opacity:0",this.#n.appendChild(c),c.select();try{i=document.execCommand("copy")}catch{i=!1}c.remove(),n.focus()}if(!i){let c=n.previousElementSibling;c&&getSelection()?.selectAllChildren(c)}n.textContent=i?"Copied":"Select and copy",n.toggleAttribute("data-done",i),this.#h(i?`Copied: ${l}`:"Copy failed. The command is selected; press Control or Command and C."),setTimeout(()=>{n.textContent="Copy",n.removeAttribute("data-done")},2e3)}}};#a(){if(!this.isConnected&&!this.#s.childElementCount)return;let e=this.#o,n=this.#n.activeElement?.dataset?.k;this.#s.innerHTML=e?this.#k(e):'<div class="pad main"><p>cfa-welcome: no stack description. Set the <code>stack</code> attribute.</p></div>',n&&this.#s.querySelector(`[data-k="${n}"]`)?.focus()}#k(e){let n=Math.min(Math.max(Number(this.getAttribute("heading-level"))||1,1),5),l=(t,h,x,f="")=>`<h${n+t} class="${h}"${f?` id="${f}"`:""}>${x}</h${n+t}>`,i=e.packageManager||"npm",c=this.api,m=c.replace(/^https?:\/\//,""),g=this.#f(),M=this.#e.s==="wait"||this.#t.s==="wait",S=t=>`<span class="q ${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}"></span>`,N=[e.monorepo&&e.monorepo[0].toUpperCase()+e.monorepo.slice(1),i,e.node&&`Node ${e.node}`].filter(Boolean).join(" \xB7 "),v=e.entry||`${e.frontend.path||"apps/frontend"}`,u=this.#u,K=0,X=`<div class="hd"><div class="pad"><div class="brand">
106
+ <svg width="26" height="26" viewBox="0 0 512 512" aria-hidden="true"><polygon points="140,360 372,360 256,280" fill="#2ec4b6"/><polygon points="256,120 140,360 256,280" fill="#c2a173"/><polygon points="256,120 372,360 256,280" fill="#ff7a52"/><polygon points="256,120 140,360 372,360" fill="none" stroke="currentColor" stroke-width="18" stroke-linejoin="round"/></svg>
107
+ <b class="d">${s(e.name)}</b>${N?`<span class="m">${s(N)}</span>`:""}</div>
108
+ <p class="credit">Made with <a href="${ue}" target="_blank" rel="noopener">create-fs-app</a> \xB7 <a href="${me}" target="_blank" rel="noopener">Docs</a> \xB7 <button type="button" class="lk" data-act="remove" data-k="rm" aria-expanded="${this.#c}" aria-controls="${u}-rm">Remove this page</button></p></div></div>`,Y=`<div id="${u}-rm" class="rm"${this.#c?"":" hidden"}><p>Delete the <code>&lt;cfa-welcome&gt;</code> element and its import from ${o(v)}, then put your own page there. Nothing else in the project uses it.</p></div>`,Q=`<div class="top"><div>${l(0,"d hl",`${s(e.name)} is running.`,`${u}-h`)}
109
+ <p class="lede">Edit ${o(v)} to start. This page checks that the frontend, the backend and the database are connected.</p></div>
110
+ <div class="sum"><span class="sq" aria-hidden="true">${S("ok")}${S(this.#e.s)}${S(this.#t.s)}</span><span class="m">${M?"Checking 3 parts\u2026":`${g} of 3 connected`}</span>
111
+ ${!M&&g<3?`<button type="button" class="lk jump" data-act="jump" data-k="jump">Go to the fix for ${s(this.#e.s!=="ok"?e.backend.name:e.database.name)}</button>`:""}
112
+ <button type="button" class="btn" data-act="check" data-k="check"${this.#i?' aria-disabled="true"':""}>${this.#i?"Checking\u2026":"Check again"}</button></div></div>`,I=t=>`<div class="wire" data-s="${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}" aria-hidden="true"><svg class="h" height="12"><line x1="0" y1="1" x2="100%" y2="1"/><line x1="0" y1="11" x2="100%" y2="11"/></svg><svg class="v" width="12"><line x1="1" y1="0" x2="1" y2="100%"/><line x1="11" y1="0" x2="11" y2="100%"/></svg></div>`,Z=t=>{let h=`${u}-${t}`;return`<svg class="strip" aria-hidden="true" preserveAspectRatio="none"><defs>${t==="sand"?`<pattern id="${h}" width="8" height="8" patternUnits="userSpaceOnUse"><rect width="8" height="8" fill="#d9c49a"/><circle cx="2" cy="2" r="1" fill="#8a5a2b"/><circle cx="6" cy="6" r="1" fill="#8a5a2b"/></pattern>`:t==="brick"?`<pattern id="${h}" width="16" height="14" patternUnits="userSpaceOnUse"><rect width="16" height="14" fill="#ff7a52"/><path d="M0 7.5H16M4 0V7M12 7V14" stroke="#23262b" stroke-width="1.2"/></pattern>`:`<pattern id="${h}" width="8" height="8" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="8" height="8" fill="#3b3f45"/><path d="M0 0V8" stroke="#8a8f86" stroke-width="1.5"/></pattern>`}</defs><rect width="100%" height="100%" fill="url(#${h})"/></svg>`},P=t=>`<div class="slip"><code>${s(t)}</code><button type="button" class="btn" data-copy="${s(t)}" data-k="copy-${++K}" aria-label="Copy: ${s(t)}">Copy</button></div>`,w=(t,h,...x)=>`<div class="fix"><p>${t}</p>${P(h)}${x.map(f=>f?`<p class="then">${f[0]}</p>${P(f[1])}`:"").join("")}</div>`,F=(t,h,x,f,L,pe)=>`<section class="p" data-s="${h==="ok"||h==="wait"||h==="unknown"||h==="none"?h:"down"}" aria-labelledby="${u}-${t}">${Z(x)}<div class="in">${l(1,"d",s([f.name,f.version].filter(Boolean).join(" ")),`${u}-${t}`)}<p class="role m">${L.split(" \xB7 ").map(he=>`<span class="nw">${s(he)}</span>`).join(" \xB7 ")}</p>${pe}</div></section>`,U=(t,h)=>`<p class="state ${t==="ok"?"ok":t==="wait"?"wait":t==="unknown"?"unknown":"down"}">${S(t)}<span>${h}</span></p>`,b=t=>`<span class="m">${s(t)}</span>`,C=e.frontend,ee=F("fe","ok","sand",C,["Frontend",C.path,C.port&&`:${C.port}`].filter(Boolean).join(" \xB7 "),U("ok",`Serving this page at ${b(location.host||"localhost")}`)+`<p class="note">${C.notes?.length?s(C.notes.join(" and "))+". ":""}Calls the API at ${o(m)}.</p>`),a=e.backend,r=this.#e,y=a.health||"/health",te=r.s==="wait"?`Checking ${b("GET "+y)}\u2026`:r.s==="ok"?`${b("GET "+y)} \xB7 ${b(r.code)} \xB7 ${b(r.ms+" ms")}`:r.s==="down"?`Not reachable at ${b(m)}`:r.s==="timeout"?`No answer in ${b(Math.round((Number(this.getAttribute("timeout"))||4e3)/1e3)+" s")}`:r.s==="cors"?"Answered, but the browser blocked it":`${b("GET "+y)} answered ${b(r.code)}`,d=this.#t,H=a.probe===void 0?"/users":a.probe,G=(a.routes||[]).map(([t,h,x])=>{let f=x?s(x):"",L="";return h===H&&t==="GET"&&(d.s==="ok"?f=String(d.code??200):d.s==="down"?(f=d.code?`${d.code}`:"no answer",L=' class="bad"'):d.s==="wait"&&r.s==="ok"&&(f="\u2026")),`<tr><td>${s(t)}</td><td>${s(h)}</td><td${L}>${f}</td></tr>`}).join(""),ne=G?`<table class="m"><caption class="sr">Routes in ${s(a.path||"apps/backend")}</caption><thead class="sr"><tr><th scope="col">Method</th><th scope="col">Path</th><th scope="col">Result</th></tr></thead><tbody>${G}</tbody></table>`:"",A=this.#r,oe=a.docs?A.s==="ok"?`<p><a class="btn" href="${s(c+a.docs)}" target="_blank" rel="noopener">Open API docs ${s(a.docs)}</a></p>`:A.s==="error"?`<p class="note">No API docs at ${o(m+a.docs)} (${A.code?`answered ${A.code}`:"no answer"}).</p>`:`<p class="note">API docs at ${o(a.docs)} once the backend answers.</p>`:`<p class="note">${s(a.name)} has no API docs page in this template. The routes are in ${o(a.routesFile||"apps/backend/src")}.</p>`,J=e.auth==="jwt",T=`${a.path||"apps/backend"}/.env`,p=e.database,E=e.docker!==!1&&p.service?`docker compose up -d ${p.service}`:"",O=!!p.blocksStart&&!!E,W=`${s(a.name)} waits for ${s(p.name)} before it listens, so a stopped ${s(p.name)} keeps it from starting.`,se=["Then start the frontend and backend from the project root:",`${i} run dev`],j="";if(r.s==="down")j=J?w(`Nothing answers at ${o(m)}. With JWT auth the backend exits on start when ${o("JWT_SECRET")} is empty. Add one to ${o(T)}:`,`echo "JWT_SECRET=$(openssl rand -hex 32)" >> ${T}`,O?[`${W} Start it:`,E]:null,se):O?w(`Nothing answers at ${o(m)}. ${W} Start ${s(p.name)} first:`,E,["Then press Check again. If the backend has stopped, start the frontend and backend from the project root:",`${i} run dev`]):w(`Nothing answers at ${o(m)}. Start the frontend and backend together from the project root:`,`${i} run dev`)+`<p class="note">Already running? Read the backend's error in that terminal.</p>`;else if(r.s==="timeout")j=w(`${o("GET "+y)} took longer than the limit. The backend may still be starting: press Check again in a moment, or test it from a terminal:`,`curl -i ${c}${y}`);else if(r.s==="cors"){let t=location.origin;j=w(`The backend answered, but it only allows requests from ${o("FRONTEND_URL")} (default ${o("http://localhost:3000")}) and this page is ${o(t)}. Allow this origin, then restart the backend:`,`echo "FRONTEND_URL=${t}" >> ${T}`)}else r.s==="error"&&(j=w(`${o("GET "+y)} answered ${r.code}. The backend's terminal shows the error. Test it with:`,`curl -i ${c}${y}`));let ae=J&&r.s==="ok"?`<div class="fix aux"><p>JWT auth is on and ${o("JWT_SECRET")} is set. To log in, set ${o("AUTH_USER_EMAIL")} in ${o(T)}, create the password hash, and paste it into ${o("AUTH_USER_PASSWORD_HASH")}:</p>${P(`cd ${a.path||"apps/backend"} && ${i} run auth:hash-password -- '<password>'`)}</div>`:"",ie=F("be",r.s,"brick",a,["Backend",a.path,a.port&&`:${a.port}`,...(a.notes||[]).filter(t=>t!=="Swagger")].filter(Boolean).join(" \xB7 "),U(r.s,te)+j+ne+(r.s==="ok"||r.s==="wait"||!a.docs?oe:"")+ae),k=e.orm,_=p.kind==="sqlite",re=["Database",_?p.file||"apps/backend/dev.db":e.docker!==!1&&p.service?"docker compose":null,_?"no Docker":p.port&&`:${p.port}`,k&&[k.name,k.version].filter(Boolean).join(" ")].filter(Boolean).join(" \xB7 "),ce=d.s==="wait"?r.s==="wait"?"Waiting for the backend":`Checking through ${b("GET "+H)}\u2026`:d.s==="ok"?`Connected \xB7 ${b(d.ms+" ms")} through the backend`:d.s==="unknown"?O&&r.s==="down"?`Unknown \xB7 probably stopped, so ${s(a.name)} can't start`:"Unknown until the backend answers":d.s==="down"?`Not reachable \xB7 ${b("GET "+H)} ${d.code?`answered ${b(d.code)}`:"got no answer"}`:B[d.s],q="";if(d.s==="down"){let t=p.env||(p.kind==="mongodb"?"MONGODB_URI":"DATABASE_URL");_?q=w(`The backend can't open ${o(p.file||"apps/backend/dev.db")}. It creates the file and applies the migrations when it starts, so restart it from the project root:`,`${i} run dev`)+`<p class="note">Still failing? ${o(t)} in ${o(T)} must be a file URL (the default is ${o("file:./dev.db")}). No Docker is involved.</p>`:E?q=w(`The backend is up but can't reach ${s(p.name)}. Start it from the project root:`,E,k?.setup?["First run? Create the tables:",k.setup]:null):q=w(`The backend is up but can't reach ${s(p.name)}. Start ${s(p.name)}${p.port?` on :${p.port}`:""}, check ${o(t)} in ${o(T)}, then restart:`,`${i} run dev`)}let le=(d.s==="ok"||d.s==="wait")&&k?.schema?`<p class="note">Schema in ${o(k.schema)}.</p>`:"",de=F("db",d.s,"bed",p,re,U(d.s,ce)+q+le),R=[];return a.routesFile&&R.push(`Add a route in ${o(a.routesFile)}`),k?.schema&&R.push(`Change the schema in ${o(k.schema)}`),R.push(`Run the tests with ${o(`${i} test`)}`),a.docs&&r.s==="ok"&&A.s==="ok"&&R.push(`Try the API at <a href="${s(c+a.docs)}" target="_blank" rel="noopener">${s(m+a.docs)}</a>`),`${X}<div class="pad main">${Y}${Q}
113
+ <div class="grid">${ee}${I(r.s)}${ie}${I(d.s)}${de}</div>
114
+ <section class="next" aria-labelledby="${u}-n">${l(1,"","Next",`${u}-n`)}<ul>${R.map(t=>`<li>${t}</li>`).join("")}</ul></section></div>`}};typeof customElements<"u"&&!customElements.get("cfa-welcome")&&customElements.define("cfa-welcome",D);export{D as CfaWelcome};