@polymorphism-tech/morph-spec 4.16.0 → 4.17.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 (98) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +3 -0
  3. package/bin/task-manager.js +999 -962
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/agents/ai-agents/vector-search-expert.md +247 -233
  8. package/framework/agents/backend/ms-agent-expert.md +1 -1
  9. package/framework/agents/backend/neon-expert.md +397 -0
  10. package/framework/agents/frontend/gsap-animator.md +131 -0
  11. package/framework/agents.json +1175 -1085
  12. package/framework/commands/morph-preflight.md +200 -192
  13. package/framework/hooks/claude-code/session-start/inject-morph-context.js +1 -1
  14. package/framework/rules/gsap-standards.md +13 -0
  15. package/framework/rules/neon-standards.md +25 -0
  16. package/framework/skills/level-0-meta/mcp-registry.json +1 -1
  17. package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +472 -472
  18. package/framework/skills/level-0-meta/morph-init/SKILL.md +11 -11
  19. package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +5 -5
  20. package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +5 -5
  21. package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +7 -7
  22. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +24 -24
  23. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +12 -12
  24. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +9 -9
  25. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
  26. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
  27. package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +143 -143
  28. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
  29. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  30. package/framework/standards/STANDARDS.json +184 -107
  31. package/framework/standards/ai-agents/production.md +1 -0
  32. package/framework/standards/ai-agents/setup.md +3 -2
  33. package/framework/standards/ai-agents/workflows.md +1 -0
  34. package/framework/standards/architecture/vertical-slice/vertical-slice.md +4 -4
  35. package/framework/standards/backend/database/postgresql/database.md +58 -78
  36. package/framework/standards/backend/dotnet/scalar-ui.md +172 -172
  37. package/framework/standards/backend/dotnet/vsa-handler-patterns.md +274 -274
  38. package/framework/standards/backend/integrations/asaas/asaas-api.md +1 -1
  39. package/framework/standards/backend/integrations/clerk/clerk-auth.md +23 -21
  40. package/framework/standards/frontend/design-system/animations.md +9 -0
  41. package/framework/standards/frontend/gsap/gsap-core.md +463 -0
  42. package/framework/standards/frontend/gsap/gsap-plugins.md +294 -0
  43. package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +318 -0
  44. package/framework/standards/frontend/nextjs/motion-patterns.md +1 -0
  45. package/framework/standards/frontend/nextjs/nextjs-patterns.md +47 -37
  46. package/framework/standards/infrastructure/docker/easypanel-deploy.md +4 -8
  47. package/framework/standards/infrastructure/neon/neon-pgrag.md +239 -0
  48. package/framework/standards/infrastructure/neon/neon-pgvector.md +236 -0
  49. package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +310 -0
  50. package/framework/standards/infrastructure/neon/neon-setup.md +186 -0
  51. package/framework/standards/integration/mcp/mcp-tools.md +32 -34
  52. package/framework/templates/README.md +18 -18
  53. package/framework/templates/REGISTRY.json +49 -96
  54. package/framework/templates/code/dotnet/abstractions/api-endpoint.cs +7 -7
  55. package/framework/templates/code/dotnet/backend/repository.cs +148 -148
  56. package/framework/templates/code/dotnet/contracts/contracts-vsa.cs +2 -2
  57. package/framework/templates/code/dotnet/database/vector-entity.cs +93 -0
  58. package/framework/templates/code/dotnet/feature/endpoint.cs.hbs +1 -1
  59. package/framework/templates/code/sql/{supabase-migration.sql → postgresql-migration.sql} +8 -17
  60. package/framework/templates/code/sql/{supabase-migration.template.sql → postgresql-migration.template.sql} +10 -13
  61. package/framework/templates/code/sql/{rls-policy.sql → postgresql-rls-policy.sql} +8 -8
  62. package/framework/templates/code/typescript/contracts.ts +167 -168
  63. package/framework/templates/context/CONTEXT.md +3 -3
  64. package/framework/templates/docs/proposal.md +6 -6
  65. package/framework/templates/docs/ui-components.md +1 -1
  66. package/framework/templates/feature/decisions.md +121 -121
  67. package/framework/templates/feature/recap.md +145 -145
  68. package/framework/templates/feature/tasks.md +199 -199
  69. package/framework/templates/frontend/nextjs/gsap-scroll-section.tsx.hbs +44 -0
  70. package/framework/templates/infrastructure/docker/docker-compose.template.yml +50 -67
  71. package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
  72. package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
  73. package/framework/templates/infrastructure/docker/easypanel.template.json +46 -54
  74. package/framework/templates/infrastructure/github/README.md +56 -56
  75. package/framework/templates/integrations/semantic-kernel-neon.cs +125 -0
  76. package/framework/workflows/README.md +1 -1
  77. package/framework/workflows/docs/full-morph.md +69 -69
  78. package/package.json +1 -1
  79. package/src/commands/agents/dispatch-agents.js +19 -15
  80. package/src/commands/state/advance-phase.js +5 -0
  81. package/src/commands/tasks/task.js +3 -0
  82. package/src/core/state/state-manager.js +45 -1
  83. package/src/core/templates/template-registry.js +1 -66
  84. package/src/lib/detectors/index.js +2 -2
  85. package/src/lib/generators/architecture-scanner.js +640 -640
  86. package/src/lib/installers/mcp-installer.js +1 -1
  87. package/src/lib/tasks/task-classifier.js +15 -1
  88. package/src/lib/tasks/test-runner.js +5 -1
  89. package/src/lib/validators/content/content-validator.js +9 -10
  90. package/src/lib/validators/validation-runner.js +7 -5
  91. package/framework/agents/backend/supabase-expert.md +0 -256
  92. package/framework/rules/supabase-standards.md +0 -29
  93. package/framework/standards/infrastructure/supabase/mcp-setup.md +0 -142
  94. package/framework/standards/infrastructure/supabase/supabase-auth.md +0 -176
  95. package/framework/standards/infrastructure/supabase/supabase-custom-jwt.md +0 -206
  96. package/framework/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
  97. package/framework/standards/infrastructure/supabase/supabase-rls.md +0 -184
  98. package/framework/standards/infrastructure/supabase/supabase-storage.md +0 -153
@@ -1,168 +1,167 @@
1
- // ============================================================
2
- // CONTRACTS: {{titleCase FEATURE_NAME}}
3
- // Stack: Next.js + Supabase
4
- // Generated by MORPH Framework
5
- // Date: {{DATE}}
6
- // ============================================================
7
-
8
- // ----- Supabase Config -----
9
-
10
- export interface SupabaseConfig {
11
- url: string;
12
- anonKey: string;
13
- }
14
-
15
- // ----- API Client Types -----
16
-
17
- export interface ApiClientConfig {
18
- baseUrl: string;
19
- getAccessToken: () => Promise<string | null>;
20
- }
21
-
22
- export interface ApiError {
23
- message: string;
24
- code: string;
25
- statusCode: number;
26
- details?: Record<string, string[]>;
27
- }
28
-
29
- export type ApiResult<T> =
30
- | { success: true; data: T }
31
- | { success: false; error: ApiError };
32
-
33
- // ----- Pagination -----
34
-
35
- export interface PaginationQuery {
36
- page?: number;
37
- pageSize?: number;
38
- }
39
-
40
- export interface PagedResult<T> {
41
- items: T[];
42
- totalCount: number;
43
- page: number;
44
- pageSize: number;
45
- totalPages: number;
46
- hasNext: boolean;
47
- hasPrevious: boolean;
48
- }
49
-
50
- // ----- Supabase Client Type Aliases -----
51
- // Generated by: supabase gen types typescript --project-id <id> > types/database.ts
52
-
53
- export type Tables<T extends keyof Database["public"]["Tables"]> =
54
- Database["public"]["Tables"][T]["Row"];
55
-
56
- export type Insertable<T extends keyof Database["public"]["Tables"]> =
57
- Database["public"]["Tables"][T]["Insert"];
58
-
59
- export type Updatable<T extends keyof Database["public"]["Tables"]> =
60
- Database["public"]["Tables"][T]["Update"];
61
-
62
- // ----- Database Schema (placeholder - replace with generated types) -----
63
-
64
- export interface Database {
65
- public: {
66
- Tables: {
67
- {{FEATURE_NAME}}: {
68
- Row: {
69
- id: string;
70
- name: string;
71
- user_id: string;
72
- status: {{pascalCase FEATURE_NAME}}Status;
73
- created_at: string;
74
- updated_at: string | null;
75
- };
76
- Insert: {
77
- id?: string;
78
- name: string;
79
- user_id?: string;
80
- status?: {{pascalCase FEATURE_NAME}}Status;
81
- created_at?: string;
82
- updated_at?: string | null;
83
- };
84
- Update: {
85
- id?: string;
86
- name?: string;
87
- user_id?: string;
88
- status?: {{pascalCase FEATURE_NAME}}Status;
89
- created_at?: string;
90
- updated_at?: string | null;
91
- };
92
- };
93
- };
94
- Views: Record<string, never>;
95
- Functions: Record<string, never>;
96
- Enums: {
97
- {{FEATURE_NAME}}_status: {{pascalCase FEATURE_NAME}}Status;
98
- };
99
- };
100
- }
101
-
102
- // ----- Feature Types -----
103
-
104
- export type {{pascalCase FEATURE_NAME}}Status =
105
- | "draft"
106
- | "active"
107
- | "completed"
108
- | "archived"
109
- | "failed"
110
- | "cancelled";
111
-
112
- export interface {{pascalCase FEATURE_NAME}} {
113
- id: string;
114
- name: string;
115
- userId: string;
116
- status: {{pascalCase FEATURE_NAME}}Status;
117
- createdAt: string;
118
- updatedAt: string | null;
119
- }
120
-
121
- export interface Create{{pascalCase FEATURE_NAME}}Input {
122
- name: string;
123
- // Add other required fields
124
- }
125
-
126
- export interface Update{{pascalCase FEATURE_NAME}}Input {
127
- name?: string;
128
- // Add other updatable fields
129
- }
130
-
131
- // ----- Storage Types -----
132
-
133
- export interface StorageUpload {
134
- bucket: string;
135
- path: string;
136
- file: File;
137
- contentType?: string;
138
- }
139
-
140
- export interface StorageFile {
141
- id: string;
142
- name: string;
143
- bucket: string;
144
- path: string;
145
- publicUrl: string;
146
- size: number;
147
- contentType: string;
148
- createdAt: string;
149
- }
150
-
151
- // ----- Auth Types -----
152
-
153
- export interface AuthUser {
154
- id: string;
155
- email: string;
156
- displayName: string | null;
157
- avatarUrl: string | null;
158
- }
159
-
160
- export interface AuthSession {
161
- user: AuthUser;
162
- accessToken: string;
163
- expiresAt: number;
164
- }
165
-
166
- // ----- Form Schemas (use with zod) -----
167
- // Define zod schemas in component files, not here.
168
- // This file is for type definitions only.
1
+ // ============================================================
2
+ // CONTRACTS: {{titleCase FEATURE_NAME}}
3
+ // Stack: Next.js + Neon
4
+ // Generated by MORPH Framework
5
+ // Date: {{DATE}}
6
+ // ============================================================
7
+
8
+ // ----- Neon Config -----
9
+
10
+ export interface NeonConfig {
11
+ connectionString: string;
12
+ }
13
+
14
+ // ----- API Client Types -----
15
+
16
+ export interface ApiClientConfig {
17
+ baseUrl: string;
18
+ getAccessToken: () => Promise<string | null>;
19
+ }
20
+
21
+ export interface ApiError {
22
+ message: string;
23
+ code: string;
24
+ statusCode: number;
25
+ details?: Record<string, string[]>;
26
+ }
27
+
28
+ export type ApiResult<T> =
29
+ | { success: true; data: T }
30
+ | { success: false; error: ApiError };
31
+
32
+ // ----- Pagination -----
33
+
34
+ export interface PaginationQuery {
35
+ page?: number;
36
+ pageSize?: number;
37
+ }
38
+
39
+ export interface PagedResult<T> {
40
+ items: T[];
41
+ totalCount: number;
42
+ page: number;
43
+ pageSize: number;
44
+ totalPages: number;
45
+ hasNext: boolean;
46
+ hasPrevious: boolean;
47
+ }
48
+
49
+ // ----- Database Client Type Aliases -----
50
+ // Generated by your ORM (Drizzle or Prisma) from your Neon PostgreSQL schema
51
+
52
+ export type Tables<T extends keyof Database["public"]["Tables"]> =
53
+ Database["public"]["Tables"][T]["Row"];
54
+
55
+ export type Insertable<T extends keyof Database["public"]["Tables"]> =
56
+ Database["public"]["Tables"][T]["Insert"];
57
+
58
+ export type Updatable<T extends keyof Database["public"]["Tables"]> =
59
+ Database["public"]["Tables"][T]["Update"];
60
+
61
+ // ----- Database Schema (placeholder - replace with generated types) -----
62
+
63
+ export interface Database {
64
+ public: {
65
+ Tables: {
66
+ {{FEATURE_NAME}}: {
67
+ Row: {
68
+ id: string;
69
+ name: string;
70
+ user_id: string;
71
+ status: {{pascalCase FEATURE_NAME}}Status;
72
+ created_at: string;
73
+ updated_at: string | null;
74
+ };
75
+ Insert: {
76
+ id?: string;
77
+ name: string;
78
+ user_id?: string;
79
+ status?: {{pascalCase FEATURE_NAME}}Status;
80
+ created_at?: string;
81
+ updated_at?: string | null;
82
+ };
83
+ Update: {
84
+ id?: string;
85
+ name?: string;
86
+ user_id?: string;
87
+ status?: {{pascalCase FEATURE_NAME}}Status;
88
+ created_at?: string;
89
+ updated_at?: string | null;
90
+ };
91
+ };
92
+ };
93
+ Views: Record<string, never>;
94
+ Functions: Record<string, never>;
95
+ Enums: {
96
+ {{FEATURE_NAME}}_status: {{pascalCase FEATURE_NAME}}Status;
97
+ };
98
+ };
99
+ }
100
+
101
+ // ----- Feature Types -----
102
+
103
+ export type {{pascalCase FEATURE_NAME}}Status =
104
+ | "draft"
105
+ | "active"
106
+ | "completed"
107
+ | "archived"
108
+ | "failed"
109
+ | "cancelled";
110
+
111
+ export interface {{pascalCase FEATURE_NAME}} {
112
+ id: string;
113
+ name: string;
114
+ userId: string;
115
+ status: {{pascalCase FEATURE_NAME}}Status;
116
+ createdAt: string;
117
+ updatedAt: string | null;
118
+ }
119
+
120
+ export interface Create{{pascalCase FEATURE_NAME}}Input {
121
+ name: string;
122
+ // Add other required fields
123
+ }
124
+
125
+ export interface Update{{pascalCase FEATURE_NAME}}Input {
126
+ name?: string;
127
+ // Add other updatable fields
128
+ }
129
+
130
+ // ----- Storage Types -----
131
+
132
+ export interface StorageUpload {
133
+ bucket: string;
134
+ path: string;
135
+ file: File;
136
+ contentType?: string;
137
+ }
138
+
139
+ export interface StorageFile {
140
+ id: string;
141
+ name: string;
142
+ bucket: string;
143
+ path: string;
144
+ publicUrl: string;
145
+ size: number;
146
+ contentType: string;
147
+ createdAt: string;
148
+ }
149
+
150
+ // ----- Auth Types -----
151
+
152
+ export interface AuthUser {
153
+ id: string;
154
+ email: string;
155
+ displayName: string | null;
156
+ avatarUrl: string | null;
157
+ }
158
+
159
+ export interface AuthSession {
160
+ user: AuthUser;
161
+ accessToken: string;
162
+ expiresAt: number;
163
+ }
164
+
165
+ // ----- Form Schemas (use with zod) -----
166
+ // Define zod schemas in component files, not here.
167
+ // This file is for type definitions only.
@@ -28,9 +28,9 @@
28
28
 
29
29
  ### Database
30
30
  {{#if SQL_ENABLED}}- **Azure SQL** ({{SQL_SERVER}}/{{SQL_DATABASE}}){{/if}}
31
- {{#if SUPABASE_ENABLED}}- **Supabase** (PostgreSQL + Auth + Storage + RLS)
32
- - Project: {{SUPABASE_PROJECT_ID}}
33
- - Region: {{SUPABASE_REGION}}
31
+ {{#if NEON_ENABLED}}- **Neon** (PostgreSQL + Connection Pooling)
32
+ - Project: {{NEON_PROJECT_ID}}
33
+ - Region: {{NEON_REGION}}
34
34
  {{/if}}
35
35
 
36
36
  ### Infrastructure
@@ -52,12 +52,12 @@
52
52
  2. **{Feature 2}** - {brief description}
53
53
  3. **{Feature 3}** - {brief description}
54
54
 
55
- {{#if (eq STACK "nextjs-supabase")}}
55
+ {{#if (eq STACK "nextjs-neon")}}
56
56
  ### Technical Approach
57
57
 
58
58
  | Layer | Technology | Role |
59
59
  |-------|-----------|------|
60
- | **Database** | Supabase (PostgreSQL + RLS) | {tables, policies, storage} |
60
+ | **Database** | Neon (PostgreSQL + RLS) | {tables, policies, storage} |
61
61
  | **Backend API** | .NET 10 Minimal API | {endpoints, business logic} |
62
62
  | **Frontend** | Next.js 15 (App Router) | {pages, components, auth} |
63
63
  | **Infra** | EasyPanel + Docker | {deployment, SSL} |
@@ -74,12 +74,12 @@
74
74
 
75
75
  ---
76
76
 
77
- {{#if (eq STACK "nextjs-supabase")}}
77
+ {{#if (eq STACK "nextjs-neon")}}
78
78
  ## Cost Estimate
79
79
 
80
80
  | Resource | Provider | Monthly Cost | Notes |
81
81
  |----------|----------|-------------|-------|
82
- | Supabase | Free / Pro | $0 - $25 | {DB, Auth, Storage, Realtime} |
82
+ | Neon | Free / Launch | $0 - $19 | {DB, Connection Pooling, Branching} |
83
83
  | VPS (EasyPanel) | {provider} | ${X} | {API + Web containers} |
84
84
  | External APIs | {provider} | ${X} | {if applicable} |
85
85
  | **Total** | | **${X}/month** | |
@@ -138,7 +138,7 @@ How will we know this feature is successful?
138
138
  | Phase | Estimate |
139
139
  |-------|----------|
140
140
  | Design & Spec | {X}h |
141
- {{#if (eq STACK "nextjs-supabase")}}| Database & Migrations | {X}h |
141
+ {{#if (eq STACK "nextjs-neon")}}| Database & Migrations | {X}h |
142
142
  | Backend API | {X}h |
143
143
  | Frontend | {X}h |
144
144
  {{else}}| Implementation | {X}h |
@@ -158,7 +158,7 @@ How will we know this feature is successful?
158
158
 
159
159
  Once approved:
160
160
  1. Create detailed `spec.md` with technical design
161
- {{#if (eq STACK "nextjs-supabase")}}2. Define contracts (`contracts.cs` + `contracts.ts`)
161
+ {{#if (eq STACK "nextjs-neon")}}2. Define contracts (`contracts.cs` + `contracts.ts`)
162
162
  3. Record decisions in `decisions.md`
163
163
  4. Break down into `tasks.md`
164
164
  5. Begin implementation
@@ -8,7 +8,7 @@
8
8
 
9
9
  ---
10
10
 
11
- {{#if (eq STACK "nextjs-supabase")}}
11
+ {{#if (eq STACK "nextjs-neon")}}
12
12
  ## Component Library: shadcn/ui
13
13
 
14
14
  ### C001: Button
@@ -1,121 +1,121 @@
1
- # Architecture Decision Records - {{titleCase FEATURE_NAME}}
2
-
3
- ## ADR-001: {Decision Title}
4
-
5
- **Date:** {{DATE}}
6
- **Status:** Proposed | Accepted | Deprecated | Superseded
7
- **Deciders:** MORPH Agents, Developer
8
-
9
- ### Context
10
-
11
- {Describe the context and problem that led to this decision}
12
-
13
- ### Decision
14
-
15
- {Describe the decision made}
16
-
17
- ### Consequences
18
-
19
- **Pros:**
20
- - {Positive consequence 1}
21
- - {Positive consequence 2}
22
-
23
- **Cons:**
24
- - {Negative consequence 1}
25
-
26
- **Risks:**
27
- - {Identified risk}
28
-
29
- ### Alternatives Considered
30
-
31
- #### Option A: {Name}
32
- - Pros: {advantages}
33
- - Cons: {disadvantages}
34
- - **Rejected because:** {reason}
35
-
36
- #### Option B: {Name}
37
- - Pros: {advantages}
38
- - Cons: {disadvantages}
39
- - **Rejected because:** {reason}
40
-
41
- ---
42
-
43
- {{#if (eq STACK "nextjs-supabase")}}
44
- ## ADR-002: Database Access Strategy
45
-
46
- **Date:** {{DATE}}
47
- **Status:** Accepted
48
-
49
- ### Context
50
-
51
- Need to decide how the .NET API accesses Supabase PostgreSQL.
52
-
53
- ### Decision
54
-
55
- Use Dapper with Npgsql for direct SQL queries. No EF Core.
56
-
57
- ### Consequences
58
-
59
- **Pros:**
60
- - Full control over SQL queries
61
- - Better performance (no ORM overhead)
62
- - Direct access to PostgreSQL features (jsonb, pgvector, functions)
63
- - RLS policies apply naturally through connection
64
-
65
- **Cons:**
66
- - No automatic migrations (use Supabase CLI instead)
67
- - Manual SQL query writing
68
- - No change tracking
69
-
70
- ---
71
-
72
- ## ADR-003: Auth Strategy
73
-
74
- **Date:** {{DATE}}
75
- **Status:** Accepted
76
-
77
- ### Context
78
-
79
- Need authentication for both Next.js frontend and .NET API.
80
-
81
- ### Decision
82
-
83
- Use Supabase Auth with @supabase/ssr on frontend. Validate JWT tokens in .NET API middleware.
84
-
85
- ### Consequences
86
-
87
- **Pros:**
88
- - Single auth provider for both layers
89
- - RLS policies work automatically with auth.uid()
90
- - Built-in social login, magic links, email/password
91
- - No separate auth service to maintain
92
-
93
- **Cons:**
94
- - Coupled to Supabase ecosystem
95
- - JWT secret must be shared with .NET API
96
- {{/if}}
97
-
98
- ---
99
-
100
- ## Template for New ADRs
101
-
102
- ```markdown
103
- ## ADR-XXX: {Title}
104
-
105
- **Date:**
106
- **Status:** Proposed | Accepted | Deprecated | Superseded
107
-
108
- ### Context
109
- {Why is this decision needed?}
110
-
111
- ### Decision
112
- {What was decided?}
113
-
114
- ### Consequences
115
- **Pros:** {list}
116
- **Cons:** {list}
117
- ```
118
-
119
- ---
120
-
121
- *Generated by MORPH Framework*
1
+ # Architecture Decision Records - {{titleCase FEATURE_NAME}}
2
+
3
+ ## ADR-001: {Decision Title}
4
+
5
+ **Date:** {{DATE}}
6
+ **Status:** Proposed | Accepted | Deprecated | Superseded
7
+ **Deciders:** MORPH Agents, Developer
8
+
9
+ ### Context
10
+
11
+ {Describe the context and problem that led to this decision}
12
+
13
+ ### Decision
14
+
15
+ {Describe the decision made}
16
+
17
+ ### Consequences
18
+
19
+ **Pros:**
20
+ - {Positive consequence 1}
21
+ - {Positive consequence 2}
22
+
23
+ **Cons:**
24
+ - {Negative consequence 1}
25
+
26
+ **Risks:**
27
+ - {Identified risk}
28
+
29
+ ### Alternatives Considered
30
+
31
+ #### Option A: {Name}
32
+ - Pros: {advantages}
33
+ - Cons: {disadvantages}
34
+ - **Rejected because:** {reason}
35
+
36
+ #### Option B: {Name}
37
+ - Pros: {advantages}
38
+ - Cons: {disadvantages}
39
+ - **Rejected because:** {reason}
40
+
41
+ ---
42
+
43
+ {{#if (eq STACK "nextjs-neon")}}
44
+ ## ADR-002: Database Access Strategy
45
+
46
+ **Date:** {{DATE}}
47
+ **Status:** Accepted
48
+
49
+ ### Context
50
+
51
+ Need to decide how the .NET API accesses Neon PostgreSQL.
52
+
53
+ ### Decision
54
+
55
+ Use Dapper with Npgsql for direct SQL queries. No EF Core.
56
+
57
+ ### Consequences
58
+
59
+ **Pros:**
60
+ - Full control over SQL queries
61
+ - Better performance (no ORM overhead)
62
+ - Direct access to PostgreSQL features (jsonb, pgvector, functions)
63
+ - RLS policies apply naturally through connection
64
+
65
+ **Cons:**
66
+ - No automatic migrations (use Neon CLI / dotnet ef instead)
67
+ - Manual SQL query writing
68
+ - No change tracking
69
+
70
+ ---
71
+
72
+ ## ADR-003: Auth Strategy
73
+
74
+ **Date:** {{DATE}}
75
+ **Status:** Accepted
76
+
77
+ ### Context
78
+
79
+ Need authentication for both Next.js frontend and .NET API.
80
+
81
+ ### Decision
82
+
83
+ Use Clerk for authentication on frontend. Validate JWT tokens in .NET API middleware.
84
+
85
+ ### Consequences
86
+
87
+ **Pros:**
88
+ - Single auth provider for both layers
89
+ - RLS policies work with Clerk JWT claims via current_setting('request.jwt.claims')
90
+ - Built-in social login, magic links, email/password
91
+ - No separate auth service to maintain
92
+
93
+ **Cons:**
94
+ - Clerk JWT must be forwarded to database connections for RLS
95
+ - JWT secret must be shared with .NET API
96
+ {{/if}}
97
+
98
+ ---
99
+
100
+ ## Template for New ADRs
101
+
102
+ ```markdown
103
+ ## ADR-XXX: {Title}
104
+
105
+ **Date:**
106
+ **Status:** Proposed | Accepted | Deprecated | Superseded
107
+
108
+ ### Context
109
+ {Why is this decision needed?}
110
+
111
+ ### Decision
112
+ {What was decided?}
113
+
114
+ ### Consequences
115
+ **Pros:** {list}
116
+ **Cons:** {list}
117
+ ```
118
+
119
+ ---
120
+
121
+ *Generated by MORPH Framework*