create-win-project 1.3.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 (198) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +187 -0
  3. package/ci/expo.yml +28 -0
  4. package/ci/laravel.yml +49 -0
  5. package/ci/nextjs.yml +29 -0
  6. package/ci/springboot.yml +33 -0
  7. package/ci/vite.yml +36 -0
  8. package/compatibility/profiles.json +237 -0
  9. package/docs/ARCHITECTURE.md +118 -0
  10. package/docs/CONTENT_MODEL.md +36 -0
  11. package/docs/DEPENDENCY_MAINTENANCE.md +31 -0
  12. package/index.js +431 -0
  13. package/lib/application-shapes.js +95 -0
  14. package/lib/banner.js +45 -0
  15. package/lib/catalog.js +343 -0
  16. package/lib/compatibility.js +116 -0
  17. package/lib/constants.js +3 -0
  18. package/lib/doctor.js +45 -0
  19. package/lib/files.js +158 -0
  20. package/lib/generator.js +366 -0
  21. package/lib/interview.js +77 -0
  22. package/lib/laravel-scaffold.js +3 -0
  23. package/lib/playbooks.js +172 -0
  24. package/lib/project-location.js +18 -0
  25. package/lib/scaffold.js +467 -0
  26. package/lib/stacks/context.js +27 -0
  27. package/lib/stacks/contract.js +142 -0
  28. package/lib/stacks/index.js +8 -0
  29. package/lib/stacks/laravel/architecture.js +27 -0
  30. package/lib/stacks/laravel/auth/oidc.js +13 -0
  31. package/lib/stacks/laravel/auth/public.js +28 -0
  32. package/lib/stacks/laravel/auth/sanctum.js +14 -0
  33. package/lib/stacks/laravel/auth/session.js +17 -0
  34. package/lib/stacks/laravel/composer.js +50 -0
  35. package/lib/stacks/laravel/generate.js +362 -0
  36. package/lib/stacks/laravel/index.js +18 -0
  37. package/lib/stacks/laravel/ui/blade.js +15 -0
  38. package/lib/stacks/laravel/ui/index.js +29 -0
  39. package/lib/stacks/laravel/ui/inertia-react.js +35 -0
  40. package/lib/stacks/laravel/ui/livewire.js +39 -0
  41. package/lib/stacks/laravel/ui/shared.js +14 -0
  42. package/lib/stacks/registry.js +42 -0
  43. package/lib/stacks/shared/contributions.js +25 -0
  44. package/lib/template.js +62 -0
  45. package/package.json +49 -0
  46. package/playbooks/INDEX.md +58 -0
  47. package/playbooks/capabilities/auth/oidc-resource-server.md +15 -0
  48. package/playbooks/capabilities/auth/spring-session.md +15 -0
  49. package/playbooks/capabilities/ci/github-actions.manifest.json +10 -0
  50. package/playbooks/capabilities/ci/github-actions.md +61 -0
  51. package/playbooks/capabilities/docker/docker.manifest.json +11 -0
  52. package/playbooks/capabilities/docker/overview.md +55 -0
  53. package/playbooks/capabilities/flyway/environments.md +5 -0
  54. package/playbooks/capabilities/flyway/flyway.manifest.json +12 -0
  55. package/playbooks/capabilities/flyway/migrations.md +7 -0
  56. package/playbooks/capabilities/flyway/testing.md +5 -0
  57. package/playbooks/capabilities/laravel/database.md +8 -0
  58. package/playbooks/capabilities/laravel/migrations.md +15 -0
  59. package/playbooks/capabilities/laravel/observability.md +8 -0
  60. package/playbooks/capabilities/laravel/oidc-resource-server.md +10 -0
  61. package/playbooks/capabilities/laravel/queues.md +8 -0
  62. package/playbooks/capabilities/laravel/sanctum-spa.md +8 -0
  63. package/playbooks/capabilities/laravel/scheduler.md +7 -0
  64. package/playbooks/capabilities/laravel/session-auth.md +8 -0
  65. package/playbooks/capabilities/laravel/storage-uploads.md +7 -0
  66. package/playbooks/capabilities/postgresql/architecture.md +5 -0
  67. package/playbooks/capabilities/postgresql/migrations.md +5 -0
  68. package/playbooks/capabilities/postgresql/postgresql.manifest.json +15 -0
  69. package/playbooks/capabilities/postgresql/schema-design.md +7 -0
  70. package/playbooks/capabilities/postgresql/security.md +5 -0
  71. package/playbooks/capabilities/postgresql/testing.md +5 -0
  72. package/playbooks/capabilities/prisma/architecture.md +5 -0
  73. package/playbooks/capabilities/prisma/migrations.md +11 -0
  74. package/playbooks/capabilities/prisma/prisma.manifest.json +14 -0
  75. package/playbooks/capabilities/prisma/runtime.md +5 -0
  76. package/playbooks/capabilities/prisma/schema.md +5 -0
  77. package/playbooks/capabilities/prisma/testing.md +5 -0
  78. package/playbooks/capabilities/supabase/architecture.md +5 -0
  79. package/playbooks/capabilities/supabase/authentication.md +5 -0
  80. package/playbooks/capabilities/supabase/expo.md +16 -0
  81. package/playbooks/capabilities/supabase/migrations.md +7 -0
  82. package/playbooks/capabilities/supabase/nextjs.md +24 -0
  83. package/playbooks/capabilities/supabase/rls.md +7 -0
  84. package/playbooks/capabilities/supabase/supabase.manifest.json +32 -0
  85. package/playbooks/capabilities/supabase/testing.md +5 -0
  86. package/playbooks/capabilities/supabase/vite.md +14 -0
  87. package/playbooks/concerns/axios.md +123 -0
  88. package/playbooks/concerns/next-safe-action.md +66 -0
  89. package/playbooks/concerns/next-themes.md +87 -0
  90. package/playbooks/concerns/nuqs.md +59 -0
  91. package/playbooks/concerns/t3-env.md +48 -0
  92. package/playbooks/concerns/tanstack-query.md +145 -0
  93. package/playbooks/concerns/zod.md +174 -0
  94. package/playbooks/concerns/zustand.md +93 -0
  95. package/playbooks/devops/makefile.manifest.json +10 -0
  96. package/playbooks/devops/makefile.md +556 -0
  97. package/playbooks/devops/pr-template.manifest.json +10 -0
  98. package/playbooks/devops/pr-template.md +106 -0
  99. package/playbooks/platform/laravel-ui/blade/architecture.md +5 -0
  100. package/playbooks/platform/laravel-ui/blade/runtime.md +5 -0
  101. package/playbooks/platform/laravel-ui/blade/security.md +5 -0
  102. package/playbooks/platform/laravel-ui/blade/structure.md +5 -0
  103. package/playbooks/platform/laravel-ui/blade/testing.md +5 -0
  104. package/playbooks/platform/laravel-ui/inertia-react/architecture.md +5 -0
  105. package/playbooks/platform/laravel-ui/inertia-react/runtime.md +5 -0
  106. package/playbooks/platform/laravel-ui/inertia-react/security.md +5 -0
  107. package/playbooks/platform/laravel-ui/inertia-react/structure.md +5 -0
  108. package/playbooks/platform/laravel-ui/inertia-react/testing.md +5 -0
  109. package/playbooks/platform/laravel-ui/livewire/architecture.md +5 -0
  110. package/playbooks/platform/laravel-ui/livewire/runtime.md +5 -0
  111. package/playbooks/platform/laravel-ui/livewire/security.md +5 -0
  112. package/playbooks/platform/laravel-ui/livewire/structure.md +5 -0
  113. package/playbooks/platform/laravel-ui/livewire/testing.md +5 -0
  114. package/playbooks/platform/mobile.manifest.json +17 -0
  115. package/playbooks/platform/mobile.md +15 -0
  116. package/playbooks/platform/web.manifest.json +17 -0
  117. package/playbooks/platform/web.md +17 -0
  118. package/playbooks/stack/expo/architecture.md +27 -0
  119. package/playbooks/stack/expo/runtime.md +14 -0
  120. package/playbooks/stack/expo/security.md +18 -0
  121. package/playbooks/stack/expo/structure.md +26 -0
  122. package/playbooks/stack/expo/testing.md +13 -0
  123. package/playbooks/stack/laravel/architecture.md +34 -0
  124. package/playbooks/stack/laravel/runtime.md +27 -0
  125. package/playbooks/stack/laravel/security.md +23 -0
  126. package/playbooks/stack/laravel/structure.md +29 -0
  127. package/playbooks/stack/laravel/testing.md +22 -0
  128. package/playbooks/stack/laravel-ui.manifest.json +42 -0
  129. package/playbooks/stack/laravel.manifest.json +35 -0
  130. package/playbooks/stack/nextjs/architecture.md +62 -0
  131. package/playbooks/stack/nextjs/runtime.md +31 -0
  132. package/playbooks/stack/nextjs/security.md +32 -0
  133. package/playbooks/stack/nextjs/structure.md +50 -0
  134. package/playbooks/stack/nextjs/testing.md +20 -0
  135. package/playbooks/stack/nextjs.manifest.json +49 -0
  136. package/playbooks/stack/no-frontend.manifest.json +25 -0
  137. package/playbooks/stack/none.manifest.json +21 -0
  138. package/playbooks/stack/react-native.manifest.json +49 -0
  139. package/playbooks/stack/react-vite/architecture.md +33 -0
  140. package/playbooks/stack/react-vite/runtime.md +13 -0
  141. package/playbooks/stack/react-vite/security.md +16 -0
  142. package/playbooks/stack/react-vite/structure.md +23 -0
  143. package/playbooks/stack/react-vite/testing.md +12 -0
  144. package/playbooks/stack/react-vite.manifest.json +46 -0
  145. package/playbooks/stack/springboot/architecture.md +40 -0
  146. package/playbooks/stack/springboot/runtime.md +28 -0
  147. package/playbooks/stack/springboot/security.md +28 -0
  148. package/playbooks/stack/springboot/structure.md +30 -0
  149. package/playbooks/stack/springboot/testing.md +22 -0
  150. package/playbooks/stack/springboot.manifest.json +38 -0
  151. package/playbooks/styling/css-modules-extensions.md +267 -0
  152. package/playbooks/styling/css-modules.manifest.json +11 -0
  153. package/playbooks/styling/native-styles.manifest.json +9 -0
  154. package/playbooks/styling/native-styles.md +29 -0
  155. package/playbooks/styling/tailwind-extensions.md +182 -0
  156. package/playbooks/styling/tailwind.manifest.json +11 -0
  157. package/playbooks/universal/accessibility.manifest.json +11 -0
  158. package/playbooks/universal/accessibility.md +45 -0
  159. package/playbooks/universal/coding-rules.manifest.json +12 -0
  160. package/playbooks/universal/coding-rules.md +281 -0
  161. package/playbooks/universal/error-handling.manifest.json +10 -0
  162. package/playbooks/universal/error-handling.md +21 -0
  163. package/playbooks/universal/git-conventions.manifest.json +10 -0
  164. package/playbooks/universal/git-conventions.md +186 -0
  165. package/playbooks/universal/observability.manifest.json +10 -0
  166. package/playbooks/universal/observability.md +29 -0
  167. package/playbooks/universal/security.manifest.json +11 -0
  168. package/playbooks/universal/security.md +30 -0
  169. package/playbooks/universal/typescript.manifest.json +11 -0
  170. package/playbooks/universal/typescript.md +272 -0
  171. package/scripts/compatibility-matrix.mjs +48 -0
  172. package/scripts/validate-content.mjs +76 -0
  173. package/scripts/verify-generated.mjs +153 -0
  174. package/templates/agents/nextjs.md +47 -0
  175. package/templates/agents/react-native.md +48 -0
  176. package/templates/agents/react-vite.md +48 -0
  177. package/templates/docker/compose/postgres.yml +29 -0
  178. package/templates/docker/compose/springboot.yml +69 -0
  179. package/templates/docker/compose/supabase.yml +18 -0
  180. package/templates/docker/compose-prod/springboot.yml +64 -0
  181. package/templates/docker/dockerfile/laravel-inertia.dev.dockerfile +21 -0
  182. package/templates/docker/dockerfile/laravel.dev.dockerfile +12 -0
  183. package/templates/docker/dockerfile/laravel.prod.dockerfile +13 -0
  184. package/templates/docker/dockerfile/nextjs.dev.dockerfile +6 -0
  185. package/templates/docker/dockerfile/nextjs.prod.dockerfile +18 -0
  186. package/templates/docker/dockerfile/springboot.dev.dockerfile +5 -0
  187. package/templates/docker/dockerfile/springboot.prod.dockerfile +10 -0
  188. package/templates/docker/dockerfile/vite.dev.dockerfile +6 -0
  189. package/templates/docker/dockerfile/vite.prod.dockerfile +12 -0
  190. package/templates/gitignore/base.gitignore +32 -0
  191. package/templates/gitignore/nextjs.gitignore +40 -0
  192. package/templates/gitignore/react-native.gitignore +43 -0
  193. package/templates/gitignore/react-vite.gitignore +39 -0
  194. package/templates/makefile/frontend.mk +31 -0
  195. package/templates/makefile/laravel.mk +47 -0
  196. package/templates/makefile/postgres.mk +40 -0
  197. package/templates/makefile/springboot.mk +125 -0
  198. package/templates/makefile/supabase.mk +42 -0
@@ -0,0 +1,50 @@
1
+ # Next.js Structure
2
+
3
+ ## Feature Ownership
4
+
5
+ `src/app` is the routing shell. Business/application code belongs to its feature.
6
+
7
+ ```text
8
+ src/
9
+ ├── app/ routes and route-level composition
10
+ ├── components/ui/ domain-free primitives
11
+ ├── components/shared/ UI reused by multiple features
12
+ ├── features/
13
+ │ └── users/
14
+ │ ├── components/
15
+ │ ├── queries/
16
+ │ ├── actions/
17
+ │ ├── services/
18
+ │ ├── repositories/ only for Next-owned persistence
19
+ │ ├── api/ only for remote HTTP boundaries
20
+ │ ├── schemas/
21
+ │ └── types.ts
22
+ ├── lib/ shared infrastructure: auth, db, logging, cache
23
+ └── config/ validated application configuration
24
+ ```
25
+
26
+ Create only folders containing real files. A feature may start with one component and
27
+ one query. Medium defines dependency direction; it does not demand seven directories.
28
+
29
+ Large features may add `index.ts`, `domain/`, `jobs/`, and colocated tests. `index.ts`
30
+ is the only supported cross-feature import surface in Large projects.
31
+
32
+ ## Backend-Specific Boundaries
33
+
34
+ | Data owner | Feature boundary | Example |
35
+ |---|---|---|
36
+ | Next.js + Prisma | `repositories/` | `userRepository.ts` |
37
+ | Next.js + Supabase | `repositories/` using the server client | `userRepository.ts` |
38
+ | Spring/external API | `api/` | `usersApi.ts` |
39
+ | Browser-only SDK | feature `api/` or `data/` | never server secrets |
40
+
41
+ Do not put feature code in `lib/users.ts`, and do not call a Next Route Handler from a
42
+ Server Component merely to reach code in the same process.
43
+
44
+ ## Naming
45
+
46
+ - Use operation names: `createUser`, `listOrders`, `cancelInvoice`.
47
+ - Name entry points by transport only when helpful: `createUserAction`, `POST`.
48
+ - Keep runtime schemas beside the input or external-response boundary.
49
+ - Mark server-only modules with `import 'server-only'` when accidental client import
50
+ would expose secrets or privileged access.
@@ -0,0 +1,20 @@
1
+ # Next.js Testing
2
+
3
+ ## Test Layers
4
+
5
+ | Risk | Test |
6
+ |---|---|
7
+ | Schema or pure policy | Vitest unit test |
8
+ | Component behavior/accessibility | React Testing Library |
9
+ | Service orchestration | Unit test with boundary fakes |
10
+ | Repository/API contract | Integration or contract test |
11
+ | Route Handler/Server Function security | Unauthenticated, forbidden, valid tests |
12
+ | Critical user journey | Playwright |
13
+
14
+ Test observable behavior rather than implementation call counts. Repository tests use the
15
+ real database engine when query behavior matters. Remote API clients use contract fixtures
16
+ that include malformed and failure responses.
17
+
18
+ Every profile must pass format check, lint, typecheck, tests, and production build. Full
19
+ testing adds Playwright. Large adds import-boundary and public-API checks. Authenticated
20
+ projects test expiry/logout and ensure authorization is enforced below the UI.
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "nextjs",
3
+ "kind": "frontend",
4
+ "label": "Next.js",
5
+ "language": "TypeScript",
6
+ "platform": "web",
7
+ "appliesTo": { "backend": ["none", "supabase", "springboot", "postgres", "laravel"] },
8
+ "port": 3000,
9
+ "needsDocker": false,
10
+ "frontendDir": "",
11
+ "architectureProfiles": ["small", "medium", "large"],
12
+ "playbooks": [
13
+ "stack/nextjs/architecture.md",
14
+ "stack/nextjs/structure.md",
15
+ "stack/nextjs/runtime.md",
16
+ "stack/nextjs/security.md",
17
+ "stack/nextjs/testing.md"
18
+ ],
19
+ "stylingOptions": ["tailwind", "css-modules"],
20
+ "scripts": { "dev": "next dev", "build": "next build", "test": "vitest run" },
21
+ "ciTemplate": "nextjs",
22
+ "envPrefix": "NEXT_PUBLIC_",
23
+ "dockerTemplate": "nextjs",
24
+ "agentsTemplate": "nextjs",
25
+ "gitignoreTemplate": "nextjs",
26
+ "folders": [],
27
+ "deps": ["next", "react", "react-dom"],
28
+ "devDeps": ["typescript", "@types/react", "@types/react-dom", "@types/node", "eslint", "eslint-config-next"],
29
+ "env": [],
30
+ "clientEnv": [],
31
+ "constraints": [
32
+ "Server Components default; use client only where browser behavior is required",
33
+ "Medium default: entry point → Service → owned Repository or remote API client"
34
+ ],
35
+ "concerns": [
36
+ { "id": "architecture", "required": true, "playbook": "stack/nextjs/architecture.md", "sections": ["Profiles", "Dependency Direction"] },
37
+ { "id": "structure", "required": true, "playbook": "stack/nextjs/structure.md", "sections": ["Feature Ownership", "Backend-Specific Boundaries"] },
38
+ { "id": "runtime", "required": true, "playbook": "stack/nextjs/runtime.md", "sections": ["Server and Client", "Caching and Mutations"] },
39
+ { "id": "stack-security", "required": true, "playbook": "stack/nextjs/security.md", "sections": ["Authorization", "Sessions"] },
40
+ { "id": "stack-testing", "required": true, "playbook": "stack/nextjs/testing.md", "sections": ["Test Layers"] },
41
+ { "id": "validation", "required": false, "when": "Project has forms / runtime input", "playbook": "concerns/zod.md", "sections": ["Schema First, Always", "Zod Schema Placement"] },
42
+ { "id": "query", "required": false, "when": "Client needs cached server state", "playbook": "concerns/tanstack-query.md", "sections": ["Read Hook", "Mutation Hook"] },
43
+ { "id": "state", "required": false, "when": "Shared non-server UI state", "playbook": "concerns/zustand.md", "sections": ["Store Setup"] },
44
+ { "id": "env", "required": false, "when": "Validating env vars at build time", "playbook": "concerns/t3-env.md", "sections": ["Setup"] },
45
+ { "id": "url-state", "required": false, "when": "Filter/search/pagination state belongs in URL", "playbook": "concerns/nuqs.md", "sections": ["Basic Usage"] },
46
+ { "id": "safe-action", "required": false, "when": "Type-safe server actions with auth middleware", "playbook": "concerns/next-safe-action.md", "sections": ["Setup", "Defining an Action"] },
47
+ { "id": "dark-mode", "required": false, "when": "Project needs dark mode toggle", "playbook": "concerns/next-themes.md", "sections": ["Provider Setup"] }
48
+ ]
49
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "id": "no-frontend",
3
+ "kind": "frontend",
4
+ "label": "No frontend",
5
+ "platform": "api",
6
+ "appliesTo": { "backend": ["springboot", "laravel"] },
7
+ "port": 0,
8
+ "needsDocker": false,
9
+ "frontendDir": "",
10
+ "architectureProfiles": ["small", "medium", "large"],
11
+ "playbooks": [],
12
+ "stylingOptions": [],
13
+ "scripts": {},
14
+ "ciTemplate": "none",
15
+ "envPrefix": "",
16
+ "agentsTemplate": null,
17
+ "gitignoreTemplate": null,
18
+ "folders": [],
19
+ "deps": [],
20
+ "devDeps": [],
21
+ "env": [],
22
+ "clientEnv": [],
23
+ "constraints": ["No browser or mobile client is generated"],
24
+ "concerns": []
25
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "id": "none",
3
+ "kind": "backend",
4
+ "label": "None / frontend only",
5
+ "appliesTo": { "frontend": ["nextjs", "react", "react-native"] },
6
+ "port": 0,
7
+ "needsDocker": false,
8
+ "architectureProfiles": ["small", "medium", "large"],
9
+ "makefileTemplate": "frontend",
10
+ "playbooks": [],
11
+ "folders": [],
12
+ "deps": [],
13
+ "devDeps": [],
14
+ "env": ["API_URL"],
15
+ "clientEnv": ["API_URL"],
16
+ "constraints": [
17
+ "No backend is scaffolded; the frontend can remain standalone or connect to an API later",
18
+ "The generated public API URL is optional until an external API is connected"
19
+ ],
20
+ "concerns": []
21
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "react-native",
3
+ "kind": "frontend",
4
+ "label": "React Native (Expo)",
5
+ "language": "TypeScript",
6
+ "platform": "mobile",
7
+ "appliesTo": { "backend": ["supabase", "springboot", "laravel", "none"] },
8
+ "port": 8081,
9
+ "needsDocker": false,
10
+ "frontendDir": "",
11
+ "architectureProfiles": ["small", "medium", "large"],
12
+ "playbooks": [
13
+ "stack/expo/architecture.md",
14
+ "stack/expo/structure.md",
15
+ "stack/expo/runtime.md",
16
+ "stack/expo/security.md",
17
+ "stack/expo/testing.md"
18
+ ],
19
+ "stylingOptions": ["native-styles"],
20
+ "scripts": { "dev": "expo start", "build": "expo export", "test": "jest --passWithNoTests" },
21
+ "ciTemplate": "expo",
22
+ "envPrefix": "EXPO_PUBLIC_",
23
+ "agentsTemplate": "react-native",
24
+ "gitignoreTemplate": "react-native",
25
+ "folders": [],
26
+ "deps": ["expo", "expo-router", "@expo/metro-runtime", "react", "react-dom", "react-native", "react-native-web", "react-native-safe-area-context"],
27
+ "devDeps": ["typescript", "@types/react"],
28
+ "env": [],
29
+ "clientEnv": [],
30
+ "constraints": [
31
+ "No server boundary — every network call is a client-side side effect",
32
+ "Expo managed workflow — no native build config required",
33
+ "File-based routing via Expo Router (same mental model as Next.js App Router)",
34
+ "React Native StyleSheet by default — no styling compiler or web-CSS assumptions",
35
+ "Auth tokens must use expo-secure-store — never AsyncStorage"
36
+ ],
37
+ "concerns": [
38
+ { "id": "architecture", "required": true, "playbook": "stack/expo/architecture.md", "sections": ["Profiles", "Dependency Direction"] },
39
+ { "id": "navigation", "required": true, "playbook": "stack/expo/structure.md", "sections": ["Expo Router", "Feature Ownership"] },
40
+ { "id": "runtime", "required": true, "playbook": "stack/expo/runtime.md", "sections": ["Lifecycle and Remote State"] },
41
+ { "id": "stack-security", "required": true, "playbook": "stack/expo/security.md", "sections": ["Mobile Trust Boundary", "Session Storage"] },
42
+ { "id": "stack-testing", "required": true, "playbook": "stack/expo/testing.md", "sections": ["Test Layers"] },
43
+ { "id": "styling", "required": true, "playbook": "styling/native-styles.md", "sections": ["Default", "Rules"] },
44
+ { "id": "http-client", "required": false, "when": "The app adopts Axios for a REST API", "playbook": "concerns/axios.md", "sections": ["One Shared Client", "Service Calls apiClient, Hook Calls Service"] },
45
+ { "id": "query", "required": false, "when": "The app needs cached remote server state", "playbook": "concerns/tanstack-query.md", "sections": ["Read Hook", "Mutation Hook", "QueryClient Setup"] },
46
+ { "id": "state", "required": false, "when": "Shared state across multiple screens", "playbook": "concerns/zustand.md", "sections": ["Store Setup", "Auth Store Pattern"] },
47
+ { "id": "validation", "required": false, "when": "Project has forms", "playbook": "concerns/zod.md", "sections": ["Schema First, Always", "React Native Form (React Hook Form + Controller)"] }
48
+ ]
49
+ }
@@ -0,0 +1,33 @@
1
+ # React + Vite Architecture
2
+
3
+ ## Profiles
4
+
5
+ ### Small
6
+
7
+ Keep route pages thin and place protocol details in a feature data function.
8
+
9
+ ```text
10
+ Page → feature component → feature api/data function → trusted backend
11
+ ```
12
+
13
+ ### Medium (default)
14
+
15
+ Use feature modules containing only the needed components, hooks, API/data functions,
16
+ schemas, and types. A client Service may coordinate UI workflows, but it is never a
17
+ trusted business or authorization boundary.
18
+
19
+ ### Large
20
+
21
+ Keep the Medium vocabulary and add explicit feature `index.ts` public APIs, automated
22
+ cross-feature import checks, API contract tests, and documented remote/client/URL state
23
+ ownership. Do not reproduce server Repository layers in a browser bundle.
24
+
25
+ ## Dependency Direction
26
+
27
+ ```text
28
+ router/page → feature UI/hook → feature API/data function → shared transport → backend
29
+ ```
30
+
31
+ The backend or Supabase RLS authenticates and authorizes. Browser code renders decisions
32
+ but cannot enforce them. Features may consume another feature only through its public API
33
+ in Large projects.
@@ -0,0 +1,13 @@
1
+ # React + Vite Runtime
2
+
3
+ ## Remote State
4
+
5
+ Use local component state for interaction, URL state for shareable navigation, and a
6
+ query library only when caching/invalidation/polling/optimistic updates justify it. Do not
7
+ copy remote records into a general client store.
8
+
9
+ - Native `fetch` is the default; centralize base URL and safe error parsing once shared.
10
+ - Cancel work tied to component lifetime and never blindly retry writes.
11
+ - Every `VITE_` environment variable is public.
12
+ - Production hosting needs an SPA fallback for client routes.
13
+ - Loading, empty, error, retry, and stale states are product behavior, not polish.
@@ -0,0 +1,16 @@
1
+ # React + Vite Security
2
+
3
+ ## Browser Trust Boundary
4
+
5
+ Everything shipped from `frontend/src` is observable and modifiable. Never place database
6
+ passwords, service keys, OAuth client secrets, or authorization rules in the SPA.
7
+
8
+ Route guards improve navigation only. The backend or RLS must reject unauthorized direct
9
+ requests and enforce resource ownership. Validate external responses before trusting
10
+ them. Prefer relative validated return paths and redact credentials and personal data
11
+ from logs.
12
+
13
+ For Supabase, the SDK owns browser session refresh; do not add an Axios refresh system.
14
+ For a Spring browser session, send credentials only to the exact allowed origin and use
15
+ the server-issued CSRF token. For OIDC, use Authorization Code with PKCE through a
16
+ maintained client; never implement token rotation by hand.
@@ -0,0 +1,23 @@
1
+ # React + Vite Structure
2
+
3
+ ## Feature Ownership
4
+
5
+ ```text
6
+ frontend/src/
7
+ ├── app/ providers and router composition
8
+ ├── pages/ route-level composition
9
+ ├── components/ui/ domain-free primitives
10
+ ├── components/shared/ cross-feature UI
11
+ ├── features/tasks/
12
+ │ ├── components/
13
+ │ ├── hooks/
14
+ │ ├── api.ts REST/external protocol
15
+ │ ├── data.ts Supabase queries when applicable
16
+ │ ├── schema.ts
17
+ │ └── types.ts
18
+ └── lib/ shared transport and SDK construction
19
+ ```
20
+
21
+ Create a directory only with its first real file. URLs, wire DTOs, Supabase queries, and
22
+ error normalization stay outside visual components. Cross-feature types become shared
23
+ only after genuine reuse. Large modules expose `index.ts`; consumers do not deep import.
@@ -0,0 +1,12 @@
1
+ # React + Vite Testing
2
+
3
+ ## Test Layers
4
+
5
+ - Unit-test schemas, normalization, and pure client policies.
6
+ - Test components by accessible behavior with React Testing Library.
7
+ - Contract-test feature API/data functions, including malformed and rejected responses.
8
+ - Use Playwright for critical navigation, login, authorization failures, and recovery.
9
+ - Large projects verify public feature imports automatically.
10
+
11
+ Every profile passes format check, lint, typecheck, unit tests, and production build.
12
+ Full testing adds Playwright; authentication adds logout/expiry and forbidden-state tests.
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "react",
3
+ "kind": "frontend",
4
+ "label": "React + Vite",
5
+ "language": "TypeScript",
6
+ "platform": "web",
7
+ "appliesTo": { "backend": ["none", "supabase", "springboot", "laravel"] },
8
+ "port": 5173,
9
+ "needsDocker": false,
10
+ "frontendDir": "frontend",
11
+ "architectureProfiles": ["small", "medium", "large"],
12
+ "playbooks": [
13
+ "stack/react-vite/architecture.md",
14
+ "stack/react-vite/structure.md",
15
+ "stack/react-vite/runtime.md",
16
+ "stack/react-vite/security.md",
17
+ "stack/react-vite/testing.md"
18
+ ],
19
+ "stylingOptions": ["tailwind", "css-modules"],
20
+ "scripts": { "dev": "vite", "build": "vite build", "test": "vitest run" },
21
+ "ciTemplate": "vite",
22
+ "envPrefix": "VITE_",
23
+ "dockerTemplate": "vite",
24
+ "agentsTemplate": "react-vite",
25
+ "gitignoreTemplate": "react-vite",
26
+ "folders": [],
27
+ "deps": ["react", "react-dom"],
28
+ "devDeps": ["vite", "typescript", "@vitejs/plugin-react", "@types/react", "@types/react-dom", "@types/node", "eslint", "@eslint/js", "typescript-eslint"],
29
+ "env": [],
30
+ "clientEnv": [],
31
+ "constraints": [
32
+ "SPA exposes everything to the browser — never use the service role key client-side",
33
+ "Full Docker: React + backend + PostgreSQL for Spring Boot combos"
34
+ ],
35
+ "concerns": [
36
+ { "id": "architecture", "required": true, "playbook": "stack/react-vite/architecture.md", "sections": ["Profiles", "Dependency Direction"] },
37
+ { "id": "structure", "required": true, "playbook": "stack/react-vite/structure.md", "sections": ["Feature Ownership"] },
38
+ { "id": "runtime", "required": true, "playbook": "stack/react-vite/runtime.md", "sections": ["Remote State"] },
39
+ { "id": "stack-security", "required": true, "playbook": "stack/react-vite/security.md", "sections": ["Browser Trust Boundary"] },
40
+ { "id": "stack-testing", "required": true, "playbook": "stack/react-vite/testing.md", "sections": ["Test Layers"] },
41
+ { "id": "http-client", "required": false, "when": "The app adopts Axios instead of the native fetch client", "playbook": "concerns/axios.md", "sections": ["One Shared Client", "Service Calls apiClient, Hook Calls Service"] },
42
+ { "id": "validation", "required": false, "when": "Project has forms / runtime input", "playbook": "concerns/zod.md", "sections": ["Schema First, Always", "Web Form (React Hook Form)"] },
43
+ { "id": "query", "required": false, "when": "Client needs cached server state", "playbook": "concerns/tanstack-query.md", "sections": ["Read Hook", "Mutation Hook"] },
44
+ { "id": "state", "required": false, "when": "Shared UI state across pages", "playbook": "concerns/zustand.md", "sections": ["Store Setup"] }
45
+ ]
46
+ }
@@ -0,0 +1,40 @@
1
+ # Spring Boot Architecture
2
+
3
+ ## Profiles
4
+
5
+ ### Small
6
+
7
+ Use a conventional package per feature with one Controller, Service, Repository, request
8
+ and response DTOs, and entity when persistence exists. Do not add interfaces that have
9
+ only one implementation or split a simple operation into ceremonial layers.
10
+
11
+ ```text
12
+ HTTP → Controller → Service → Repository → PostgreSQL
13
+ ```
14
+
15
+ ### Medium (default)
16
+
17
+ Keep package-by-feature and make API, application service, persistence, DTO, and entity
18
+ ownership explicit. Services own transaction boundaries and reusable operations. Features
19
+ communicate through clear application APIs rather than reaching into repositories.
20
+
21
+ ### Large
22
+
23
+ Build a modular monolith with Spring Modulith. A feature exposes a small API or named
24
+ interface and keeps application, domain, and persistence implementation internal. Verify
25
+ no cycles, no access to internals, and only declared module dependencies. Large does not
26
+ mean microservices.
27
+
28
+ ## Dependency Direction
29
+
30
+ ```text
31
+ web/API → application operation → domain policy → persistence/external adapter
32
+ ```
33
+
34
+ - Controllers translate HTTP and never call repositories.
35
+ - Services do not return `ResponseEntity` or depend on route details.
36
+ - Repositories contain persistence queries, not application policy.
37
+ - Cross-feature work calls a public operation or publishes a deliberate event.
38
+ - External side effects are not assumed successful merely because a transaction commits.
39
+
40
+ Start at the selected project baseline and let each feature create only the files it uses.
@@ -0,0 +1,28 @@
1
+ # Spring Boot Runtime
2
+
3
+ ## Transactions
4
+
5
+ Application services own transactions spanning multiple writes or read-modify-write
6
+ behavior. Use read-only transactions for coherent multi-query reads when beneficial.
7
+ Database unique/check/foreign-key constraints are the final concurrency boundary; map
8
+ expected constraint conflicts to stable application errors.
9
+
10
+ Publish noncritical work after commit. Use an outbox or durable queue when delivery must
11
+ survive process failure. Plain `@Async` is not a reliability guarantee.
12
+
13
+ ## Errors and Observability
14
+
15
+ Services throw custom application exceptions with stable error codes and no HTTP types.
16
+ `@RestControllerAdvice` maps them to RFC 9457 `ProblemDetail`. Include a safe code and
17
+ trace ID; never expose stack traces, SQL, internal hosts, credentials, or sensitive fields.
18
+
19
+ Use structured PII-safe events. Do not log whole requests, passwords, tokens, cookies, or
20
+ email addresses by default. Health and readiness are different: readiness verifies
21
+ dependencies required to serve traffic.
22
+
23
+ Configuration comes from validated properties and environment-specific deployment values.
24
+ Keep Open Session in View disabled and schema changes owned by Flyway migrations.
25
+
26
+ Allowlist client-selected sort fields. Store uploads outside the application tree under
27
+ generated object keys; validate size and content and route untrusted files through the
28
+ product's scanning/quarantine process.
@@ -0,0 +1,28 @@
1
+ # Spring Boot Security
2
+
3
+ ## Authentication Models
4
+
5
+ The generated authentication choice is authoritative:
6
+
7
+ - `public`: no user accounts; generated application endpoints are intentionally public.
8
+ - `undecided`: health is public and every other endpoint is denied until auth is designed.
9
+ - `session`: Spring owns a secure browser session; credential cookies require CSRF.
10
+ - `oidc`: an external identity provider owns login, refresh, rotation, and revocation;
11
+ Spring Resource Server validates access-token signature, issuer, audience, time, and
12
+ maps scopes/claims to authorities.
13
+
14
+ Never turn the API into a home-grown authorization server from a short JWT example.
15
+
16
+ ## Authorization
17
+
18
+ Route rules provide a broad baseline. Enforce feature permissions and resource ownership
19
+ at the application operation or protected data boundary with method security or an
20
+ equivalent policy. Test unauthenticated, authenticated-but-forbidden, and allowed cases.
21
+
22
+ - Keep CSRF enabled for cookie/browser credentials; disable it only for a documented API
23
+ that accepts bearer headers and no ambient browser credentials.
24
+ - Configure exact-origin credentialed CORS. Never combine credentials with wildcard origin.
25
+ - Rotate the session ID after login and invalidate server sessions on logout.
26
+ - Hash passwords with a maintained adaptive encoder if the product owns credentials.
27
+ - Rate limit login, recovery, and other abuse-sensitive operations.
28
+ - Treat role claims as inputs to server policy, not proof of resource ownership.
@@ -0,0 +1,30 @@
1
+ # Spring Boot Structure
2
+
3
+ ## Package by Feature
4
+
5
+ Place the application class in the root package. Organize business code below it by
6
+ feature, never in one global controller/service/repository layer.
7
+
8
+ ```text
9
+ com.example.app/
10
+ ├── Application.java
11
+ ├── users/
12
+ │ ├── api/ controllers and transport DTOs (Medium/Large)
13
+ │ ├── service/ application operations
14
+ │ ├── repository/ persistence boundary
15
+ │ └── entity/ persistence/domain model
16
+ ├── orders/
17
+ └── shared/ small technical foundations, not shared business dumping ground
18
+ ```
19
+
20
+ Small may keep the few feature classes directly under `users/`. Medium uses the named
21
+ subpackages when multiple files make ownership clearer. Large exposes types in the module
22
+ base/API package and places implementation below `internal/` as required by the generated
23
+ Spring Modulith verification.
24
+
25
+ - Use constructor injection.
26
+ - Prefer Java records for immutable transport DTOs; classes remain valid when framework
27
+ or modeling needs require them.
28
+ - Do not use Lombok `@Data` on JPA entities. Define equality from stable identity and keep
29
+ secrets/relationships out of `toString`.
30
+ - Use database-native identity types and constraints deliberately.
@@ -0,0 +1,22 @@
1
+ # Spring Boot Testing
2
+
3
+ ## Test Layers
4
+
5
+ | Risk | Test |
6
+ |---|---|
7
+ | Pure policy/value object | JUnit unit test |
8
+ | Service orchestration/error code | Focused unit test with boundary fakes |
9
+ | MVC validation/error/security | MVC slice test without a database |
10
+ | Custom repository/Flyway/constraints | PostgreSQL Testcontainers integration |
11
+ | Feature module | Module integration test |
12
+ | Large boundaries | Spring Modulith `ApplicationModules.verify()` |
13
+
14
+ Do not use H2 as proof that PostgreSQL queries or migrations work. Standard Spring Data
15
+ methods need no dedicated test, but custom queries, constraints, locking, and migrations do.
16
+
17
+ Test behavior and risk rather than every public method or mock call. Authentication tests
18
+ cover session expiry/logout/CSRF or invalid JWT issuer, audience, signature, and expiry as
19
+ applicable. Authorization tests include resource ownership, not roles alone.
20
+
21
+ Every profile runs Maven tests and package. Full testing runs PostgreSQL integration tests;
22
+ Large additionally fails on cycles and access to module internals.
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "springboot",
3
+ "kind": "backend",
4
+ "label": "Spring Boot",
5
+ "language": "Java",
6
+ "appliesTo": { "frontend": ["nextjs", "react", "react-native"] },
7
+ "port": 8080,
8
+ "needsDocker": true,
9
+ "architectureProfiles": ["small", "medium", "large"],
10
+ "playbooks": [
11
+ "stack/springboot/architecture.md",
12
+ "stack/springboot/structure.md",
13
+ "stack/springboot/runtime.md",
14
+ "stack/springboot/security.md",
15
+ "stack/springboot/testing.md",
16
+ { "file": "capabilities/auth/spring-session.md", "appliesWhen": { "authentication": "session" } },
17
+ { "file": "capabilities/auth/oidc-resource-server.md", "appliesWhen": { "authentication": "oidc" } }
18
+ ],
19
+ "makefileTemplate": "springboot",
20
+ "folders": [],
21
+ "deps": [],
22
+ "devDeps": [],
23
+ "env": ["API_URL", "DATABASE_URL", "POSTGRES_USER", "POSTGRES_PASSWORD", "POSTGRES_DB", "SPRING_PROFILES_ACTIVE"],
24
+ "clientEnv": ["API_URL"],
25
+ "constraints": [
26
+ "Spring Boot owns server-side business logic, authorization, and data access",
27
+ "Security starts deny-by-default; add authentication through Spring Security rather than hand-rolled token code"
28
+ ],
29
+ "concerns": [
30
+ { "id": "architecture", "required": true, "playbook": "stack/springboot/architecture.md", "sections": ["Profiles", "Dependency Direction"] },
31
+ { "id": "structure", "required": true, "playbook": "stack/springboot/structure.md", "sections": ["Package by Feature"] },
32
+ { "id": "runtime", "required": true, "playbook": "stack/springboot/runtime.md", "sections": ["Transactions", "Errors and Observability"] },
33
+ { "id": "stack-security", "required": true, "playbook": "stack/springboot/security.md", "sections": ["Authentication Models", "Authorization"] },
34
+ { "id": "stack-testing", "required": true, "playbook": "stack/springboot/testing.md", "sections": ["Test Layers"] },
35
+ { "id": "session-auth", "required": true, "appliesWhen": { "authentication": "session" }, "playbook": "capabilities/auth/spring-session.md", "sections": ["Session Ownership", "Required Tests"] },
36
+ { "id": "oidc-auth", "required": true, "appliesWhen": { "authentication": "oidc" }, "playbook": "capabilities/auth/oidc-resource-server.md", "sections": ["Provider and API Responsibilities", "Required Tests"] }
37
+ ]
38
+ }