create-raredays-app 0.1.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.
Files changed (158) hide show
  1. package/README.md +89 -0
  2. package/bin/index.js +1024 -0
  3. package/package.json +43 -0
  4. package/scaffold-fragments/billing/files/app/api/billing/webhook/route.ts +5 -0
  5. package/scaffold-fragments/billing/module.json +31 -0
  6. package/scaffold-fragments/billing/runtime/config.ts +8 -0
  7. package/scaffold-fragments/billing/runtime/exports.ts +6 -0
  8. package/scaffold-fragments/billing/runtime/imports.ts +6 -0
  9. package/scaffold-fragments/billing/runtime/ports.ts +3 -0
  10. package/scaffold-fragments/cms/module.json +29 -0
  11. package/scaffold-fragments/cms/runtime/config.ts +4 -0
  12. package/scaffold-fragments/cms/runtime/exports.ts +1 -0
  13. package/scaffold-fragments/cms/runtime/imports.ts +1 -0
  14. package/scaffold-fragments/email/module.json +30 -0
  15. package/scaffold-fragments/email/runtime/config.ts +1 -0
  16. package/scaffold-fragments/email/runtime/imports.ts +1 -0
  17. package/scaffold-fragments/email/runtime/ports.ts +1 -0
  18. package/scaffold-fragments/feature-flags/files/app/lib/flags.ts +48 -0
  19. package/scaffold-fragments/feature-flags/module.json +66 -0
  20. package/scaffold-fragments/i18n/files/messages/en-US.json +15 -0
  21. package/scaffold-fragments/i18n/module.json +9 -0
  22. package/scaffold-fragments/i18n/runtime/config.ts +7 -0
  23. package/scaffold-fragments/i18n/runtime/exports.ts +1 -0
  24. package/scaffold-fragments/i18n/runtime/imports.ts +2 -0
  25. package/scaffold-fragments/i18n/runtime/ports.ts +1 -0
  26. package/scaffold-fragments/identity/module.json +30 -0
  27. package/scaffold-fragments/identity/vendors/better-auth/files/app/api/auth/[...all]/route.ts +15 -0
  28. package/scaffold-fragments/identity/vendors/better-auth/files/app/lib/auth.ts +20 -0
  29. package/scaffold-fragments/jobs/module.json +12 -0
  30. package/scaffold-fragments/jobs/runtime/config.ts +4 -0
  31. package/scaffold-fragments/jobs/runtime/imports.ts +1 -0
  32. package/scaffold-fragments/jobs/runtime/ports.ts +1 -0
  33. package/scaffold-fragments/notifications/module.json +12 -0
  34. package/scaffold-fragments/notifications/runtime/config.ts +8 -0
  35. package/scaffold-fragments/notifications/runtime/imports.ts +5 -0
  36. package/scaffold-fragments/notifications/runtime/ports.ts +1 -0
  37. package/scaffold-fragments/organizations/module.json +12 -0
  38. package/scaffold-fragments/telemetry/module.json +43 -0
  39. package/scaffold-fragments/telemetry/runtime/config.ts +7 -0
  40. package/scaffold-fragments/telemetry/runtime/imports.ts +7 -0
  41. package/scaffold-fragments/telemetry/runtime/ports.ts +1 -0
  42. package/skillex/private/contribute.md +193 -0
  43. package/skillex/public/consumer.md +157 -0
  44. package/templates/client/.storybook/main.ts +77 -0
  45. package/templates/client/.storybook/preview.ts +12 -0
  46. package/templates/client/CLAUDE.md +50 -0
  47. package/templates/client/_claude/settings.json +107 -0
  48. package/templates/client/_github/PULL_REQUEST_TEMPLATE.md +19 -0
  49. package/templates/client/_github/dependabot.yml +48 -0
  50. package/templates/client/_github/workflows/ci.yml +104 -0
  51. package/templates/client/_gitignore +15 -0
  52. package/templates/client/_npmrc +1 -0
  53. package/templates/client/app/(app)/layout.tsx +49 -0
  54. package/templates/client/app/(marketing)/layout.tsx +21 -0
  55. package/templates/client/app/(marketing)/page.tsx +34 -0
  56. package/templates/client/app/api/backend/[...path]/route.ts +37 -0
  57. package/templates/client/app/api/dev/login/route.ts +14 -0
  58. package/templates/client/app/api/dev/logout/route.ts +18 -0
  59. package/templates/client/app/globals.css +22 -0
  60. package/templates/client/app/home-auth-controls.tsx +28 -0
  61. package/templates/client/app/layout.tsx +38 -0
  62. package/templates/client/app/lib/backend-client.ts +55 -0
  63. package/templates/client/app/lib/runtime.test.ts +38 -0
  64. package/templates/client/app/lib/runtime.ts +54 -0
  65. package/templates/client/app/protected/page.tsx +31 -0
  66. package/templates/client/app/theme.override.css +9 -0
  67. package/templates/client/instrumentation.ts +10 -0
  68. package/templates/client/mocks/browser.tsx +28 -0
  69. package/templates/client/mocks/handlers.ts +20 -0
  70. package/templates/client/mocks/node.ts +7 -0
  71. package/templates/client/next.config.ts +8 -0
  72. package/templates/client/oxfmt.config.ts +8 -0
  73. package/templates/client/oxlint.config.ts +8 -0
  74. package/templates/client/package.json +61 -0
  75. package/templates/client/postcss.config.mjs +1 -0
  76. package/templates/client/public/mockServiceWorker.js +349 -0
  77. package/templates/client/scripts/build-theme.mjs +18 -0
  78. package/templates/client/site.spec.ts +58 -0
  79. package/templates/client/skillex.json +12 -0
  80. package/templates/client/skills/repo.md +56 -0
  81. package/templates/client/stylelint.config.mjs +4 -0
  82. package/templates/client/tsconfig.json +11 -0
  83. package/templates/client/vitest.config.ts +27 -0
  84. package/templates/client/vitest.setup.ts +18 -0
  85. package/templates/full-stack/.storybook/main.ts +77 -0
  86. package/templates/full-stack/.storybook/preview.ts +12 -0
  87. package/templates/full-stack/CLAUDE.md +50 -0
  88. package/templates/full-stack/_claude/settings.json +107 -0
  89. package/templates/full-stack/_github/PULL_REQUEST_TEMPLATE.md +19 -0
  90. package/templates/full-stack/_github/dependabot.yml +57 -0
  91. package/templates/full-stack/_github/workflows/ci.yml +109 -0
  92. package/templates/full-stack/_github/workflows/db-check.yml +36 -0
  93. package/templates/full-stack/_github/workflows/db-migrate.yml +39 -0
  94. package/templates/full-stack/_gitignore +15 -0
  95. package/templates/full-stack/_npmrc +1 -0
  96. package/templates/full-stack/app/(app)/layout.tsx +53 -0
  97. package/templates/full-stack/app/(marketing)/layout.tsx +21 -0
  98. package/templates/full-stack/app/(marketing)/page.tsx +38 -0
  99. package/templates/full-stack/app/api/dev/login/route.ts +14 -0
  100. package/templates/full-stack/app/api/dev/logout/route.ts +18 -0
  101. package/templates/full-stack/app/api/widgets/route.ts +10 -0
  102. package/templates/full-stack/app/demo/widgets/page.tsx +86 -0
  103. package/templates/full-stack/app/globals.css +22 -0
  104. package/templates/full-stack/app/home-auth-controls.tsx +28 -0
  105. package/templates/full-stack/app/layout.tsx +38 -0
  106. package/templates/full-stack/app/lib/runtime.test.ts +38 -0
  107. package/templates/full-stack/app/lib/runtime.ts +54 -0
  108. package/templates/full-stack/app/protected/page.tsx +31 -0
  109. package/templates/full-stack/app/theme.override.css +9 -0
  110. package/templates/full-stack/db/check.ts +46 -0
  111. package/templates/full-stack/db/index.ts +109 -0
  112. package/templates/full-stack/db/migrate.ts +66 -0
  113. package/templates/full-stack/db/migrations/.gitkeep +0 -0
  114. package/templates/full-stack/db/schema.ts +20 -0
  115. package/templates/full-stack/drizzle.config.ts +16 -0
  116. package/templates/full-stack/instrumentation.ts +10 -0
  117. package/templates/full-stack/mocks/browser.tsx +28 -0
  118. package/templates/full-stack/mocks/handlers.ts +34 -0
  119. package/templates/full-stack/mocks/node.ts +7 -0
  120. package/templates/full-stack/next.config.ts +8 -0
  121. package/templates/full-stack/oxfmt.config.ts +8 -0
  122. package/templates/full-stack/oxlint.config.ts +8 -0
  123. package/templates/full-stack/package.json +72 -0
  124. package/templates/full-stack/postcss.config.mjs +1 -0
  125. package/templates/full-stack/public/mockServiceWorker.js +349 -0
  126. package/templates/full-stack/scripts/build-theme.mjs +18 -0
  127. package/templates/full-stack/site.spec.ts +58 -0
  128. package/templates/full-stack/skillex.json +12 -0
  129. package/templates/full-stack/skills/repo.md +56 -0
  130. package/templates/full-stack/stylelint.config.mjs +4 -0
  131. package/templates/full-stack/tsconfig.json +11 -0
  132. package/templates/full-stack/vitest.config.ts +42 -0
  133. package/templates/full-stack/vitest.setup.ts +18 -0
  134. package/templates/static/.storybook/main.ts +77 -0
  135. package/templates/static/.storybook/preview.ts +12 -0
  136. package/templates/static/CLAUDE.md +50 -0
  137. package/templates/static/_claude/settings.json +107 -0
  138. package/templates/static/_github/PULL_REQUEST_TEMPLATE.md +18 -0
  139. package/templates/static/_github/dependabot.yml +43 -0
  140. package/templates/static/_github/workflows/ci.yml +91 -0
  141. package/templates/static/_gitignore +15 -0
  142. package/templates/static/_npmrc +1 -0
  143. package/templates/static/app/(marketing)/layout.tsx +21 -0
  144. package/templates/static/app/(marketing)/page.tsx +17 -0
  145. package/templates/static/app/globals.css +22 -0
  146. package/templates/static/app/layout.tsx +24 -0
  147. package/templates/static/app/theme.override.css +9 -0
  148. package/templates/static/next.config.ts +19 -0
  149. package/templates/static/oxfmt.config.ts +8 -0
  150. package/templates/static/oxlint.config.ts +8 -0
  151. package/templates/static/package.json +53 -0
  152. package/templates/static/postcss.config.mjs +1 -0
  153. package/templates/static/scripts/build-theme.mjs +18 -0
  154. package/templates/static/site.spec.ts +58 -0
  155. package/templates/static/skillex.json +12 -0
  156. package/templates/static/skills/repo.md +56 -0
  157. package/templates/static/stylelint.config.mjs +4 -0
  158. package/templates/static/tsconfig.json +11 -0
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # create-raredays-app
2
+
3
+ Scaffold a new RareDays Next.js app. Runs as an interactive TUI or non-interactively with flags.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ # interactive mode (prompts for everything)
9
+ pnpm create raredays-app
10
+
11
+ # non-interactive with a preset
12
+ pnpm create raredays-app my-app --preset courseware
13
+
14
+ # non-interactive with explicit options
15
+ pnpm create raredays-app my-app --template full-stack --modules billing,jobs
16
+
17
+ # from a checkout of this repo
18
+ node workspaces/app/cli/create-raredays-app/bin/index.js my-app
19
+ ```
20
+
21
+ ## Presets
22
+
23
+ Pre-configured app types offered in interactive mode and via `--preset`:
24
+
25
+ - **courseware** -- Full course platform (full-stack template + billing module, violet brand).
26
+ - **internal-tool** -- Admin dashboard (full-stack template + jobs module, slate brand).
27
+ - **demo** -- Lightweight demo (static template, no modules, emerald brand).
28
+
29
+ Presets set the template, modules, and brand color. You can still customise display name and git settings.
30
+
31
+ ## Templates
32
+
33
+ - **full-stack** -- Next.js + Drizzle + the full module system. Supports identity, billing, jobs, notifications, email, telemetry. Composition root at `app/lib/runtime.ts`.
34
+ - **client** -- Next.js BFF + SPA, proxies to an external backend. Supports modules but no database layer.
35
+ - **static** -- Truly static, deployable to CDN/edge. Core + design system only, no SSR or API routes.
36
+
37
+ ## Options
38
+
39
+ - `--template <name>` -- `full-stack` (default), `client`, or `static`.
40
+ - `--preset <name>` -- `courseware`, `internal-tool`, or `demo`. Overrides `--template` and `--modules`.
41
+ - `--modules <list>` -- comma-separated modules to wire: `billing`, `jobs`, `notifications`, `email`, `telemetry`, `feature-flags`.
42
+ - `--vendors <list>` -- comma-separated vendor preconfiguration: `stripe`, `resend`, `sentry`, `axiom`.
43
+ - `--remote-url <url>` -- set git remote origin after scaffolding.
44
+ - `--no-git` -- skip `git init`.
45
+ - `--no-install` -- skip `pnpm install`.
46
+ - `--dev` -- rewrite every `@raredays/*` dependency to `workspace:*` (for in-repo dogfooding).
47
+ - `-h`, `--help` -- show usage.
48
+
49
+ ## What it does
50
+
51
+ 1. Copies `templates/<name>/` into the target directory.
52
+ 2. Renames stub files (`_gitignore` -> `.gitignore`, `_npmrc` -> `.npmrc`).
53
+ 3. Sets `package.json:name` to the project slug.
54
+ 4. Substitutes `__SLUG__` in `site.spec.ts` and applies display name, domain, and brand color.
55
+ 5. Loads scaffold fragments for selected modules (imports, config, ports, file overlays).
56
+ 6. Composes `app/lib/runtime.ts` with module wiring and `mocks/handlers.ts` with vendor mocks.
57
+ 7. Merges fragment dependencies into `package.json`.
58
+ 8. Writes `.env.example` if any vendor env vars are needed.
59
+ 9. Optionally runs `git init` and `pnpm install`.
60
+
61
+ ## Scaffold fragments
62
+
63
+ The `scaffold-fragments/` directory contains per-module overlays:
64
+
65
+ - `billing/` -- Stripe billing integration (checkout, portal, webhooks)
66
+ - `email/` -- Resend email provider
67
+ - `feature-flags/` -- Vercel Flags SDK wiring
68
+ - `jobs/` -- Background job processing
69
+ - `notifications/` -- Multi-channel notification delivery
70
+ - `telemetry/` -- Sentry + Axiom telemetry
71
+
72
+ Each fragment has a `module.json` manifest, runtime slot injections, and optional file overlays.
73
+
74
+ ## How it fits in the ecosystem
75
+
76
+ `create-raredays-app` is the primary entry point for new RareDays projects. It produces a fully configured Next.js app that depends on `@raredays/core`, `@raredays/style`, `@raredays/lint`, and `@raredays/typescript`, plus any domain modules the user selects. The generated app follows the same hexagonal architecture used internally: port contracts from `@raredays/core`, in-memory dev providers, and vendor adapters swapped in for production.
77
+
78
+ ## Development
79
+
80
+ ```sh
81
+ # run the scaffolder interactively in a sandbox
82
+ pnpm --filter create-raredays-app dev
83
+
84
+ # clean the sandbox
85
+ pnpm --filter create-raredays-app clean
86
+
87
+ # lint
88
+ pnpm --filter create-raredays-app lint
89
+ ```