@polymorphism-tech/morph-spec 4.15.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.
- package/README.md +2 -2
- package/bin/morph-spec.js +4 -0
- package/bin/task-manager.js +999 -962
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/agents/ai-agents/vector-search-expert.md +247 -233
- package/framework/agents/backend/ms-agent-expert.md +2 -1
- package/framework/agents/backend/neon-expert.md +397 -0
- package/framework/agents/frontend/gsap-animator.md +131 -0
- package/framework/agents.json +1175 -1077
- package/framework/commands/morph-preflight.md +200 -192
- package/framework/hooks/claude-code/session-start/inject-morph-context.js +1 -1
- package/framework/rules/gsap-standards.md +13 -0
- package/framework/rules/neon-standards.md +25 -0
- package/framework/skills/level-0-meta/mcp-registry.json +1 -1
- package/framework/skills/level-0-meta/morph-agent-teams/SKILL.md +472 -472
- package/framework/skills/level-0-meta/morph-init/SKILL.md +30 -11
- package/framework/skills/level-0-meta/morph-post-implementation/SKILL.md +5 -5
- package/framework/skills/level-0-meta/morph-tool-usage-guide/SKILL.md +5 -5
- package/framework/skills/level-0-meta/morph-tool-usage-guide/references/tools-per-phase.md +7 -7
- package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +24 -24
- package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +12 -12
- package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +9 -9
- package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-phase-tasks/references/task-planning-patterns.md +143 -143
- package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
- package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
- package/framework/standards/STANDARDS.json +184 -107
- package/framework/standards/ai-agents/production.md +1 -0
- package/framework/standards/ai-agents/setup.md +3 -2
- package/framework/standards/ai-agents/workflows.md +1 -0
- package/framework/standards/architecture/vertical-slice/vertical-slice.md +4 -4
- package/framework/standards/backend/database/postgresql/database.md +58 -78
- package/framework/standards/backend/dotnet/scalar-ui.md +172 -172
- package/framework/standards/backend/dotnet/vsa-handler-patterns.md +274 -274
- package/framework/standards/backend/integrations/asaas/asaas-api.md +1 -1
- package/framework/standards/backend/integrations/clerk/clerk-auth.md +23 -21
- package/framework/standards/frontend/design-system/animations.md +9 -0
- package/framework/standards/frontend/gsap/gsap-core.md +463 -0
- package/framework/standards/frontend/gsap/gsap-plugins.md +294 -0
- package/framework/standards/frontend/gsap/gsap-scrolltrigger.md +318 -0
- package/framework/standards/frontend/nextjs/motion-patterns.md +1 -0
- package/framework/standards/frontend/nextjs/nextjs-patterns.md +47 -37
- package/framework/standards/infrastructure/docker/easypanel-deploy.md +4 -8
- package/framework/standards/infrastructure/neon/neon-pgrag.md +239 -0
- package/framework/standards/infrastructure/neon/neon-pgvector.md +236 -0
- package/framework/standards/infrastructure/neon/neon-semantic-kernel.md +310 -0
- package/framework/standards/infrastructure/neon/neon-setup.md +186 -0
- package/framework/standards/integration/mcp/mcp-tools.md +32 -34
- package/framework/templates/README.md +18 -18
- package/framework/templates/REGISTRY.json +49 -96
- package/framework/templates/code/dotnet/abstractions/api-endpoint.cs +7 -7
- package/framework/templates/code/dotnet/backend/repository.cs +148 -148
- package/framework/templates/code/dotnet/contracts/contracts-vsa.cs +2 -2
- package/framework/templates/code/dotnet/database/vector-entity.cs +93 -0
- package/framework/templates/code/dotnet/feature/endpoint.cs.hbs +1 -1
- package/framework/templates/code/sql/{supabase-migration.sql → postgresql-migration.sql} +8 -17
- package/framework/templates/code/sql/{supabase-migration.template.sql → postgresql-migration.template.sql} +10 -13
- package/framework/templates/code/sql/{rls-policy.sql → postgresql-rls-policy.sql} +8 -8
- package/framework/templates/code/typescript/contracts.ts +167 -168
- package/framework/templates/context/CONTEXT.md +3 -3
- package/framework/templates/docs/proposal.md +6 -6
- package/framework/templates/docs/ui-components.md +1 -1
- package/framework/templates/feature/decisions.md +121 -121
- package/framework/templates/feature/recap.md +145 -145
- package/framework/templates/feature/tasks.md +199 -199
- package/framework/templates/frontend/nextjs/gsap-scroll-section.tsx.hbs +44 -0
- package/framework/templates/infrastructure/docker/docker-compose.template.yml +50 -67
- package/framework/templates/infrastructure/docker/dockerfile-api.dockerfile +38 -38
- package/framework/templates/infrastructure/docker/dockerfile-web.dockerfile +48 -48
- package/framework/templates/infrastructure/docker/easypanel.template.json +46 -54
- package/framework/templates/infrastructure/github/README.md +56 -56
- package/framework/templates/integrations/semantic-kernel-neon.cs +125 -0
- package/framework/workflows/README.md +1 -1
- package/framework/workflows/docs/full-morph.md +69 -69
- package/package.json +1 -1
- package/src/commands/agents/dispatch-agents.js +19 -15
- package/src/commands/project/setup-infra-cmd.js +1 -1
- package/src/commands/state/advance-phase.js +5 -0
- package/src/commands/tasks/task.js +3 -0
- package/src/core/state/state-manager.js +45 -1
- package/src/core/templates/template-registry.js +1 -66
- package/src/lib/detectors/index.js +2 -2
- package/src/lib/generators/architecture-scanner.js +640 -640
- package/src/lib/installers/mcp-installer.js +1 -1
- package/src/lib/tasks/task-classifier.js +15 -1
- package/src/lib/tasks/test-runner.js +5 -1
- package/src/lib/validators/content/content-validator.js +9 -10
- package/src/lib/validators/validation-runner.js +7 -5
- package/src/scripts/setup-infra.js +60 -30
- package/framework/agents/backend/supabase-expert.md +0 -256
- package/framework/rules/supabase-standards.md +0 -29
- package/framework/standards/infrastructure/supabase/mcp-setup.md +0 -142
- package/framework/standards/infrastructure/supabase/supabase-auth.md +0 -176
- package/framework/standards/infrastructure/supabase/supabase-custom-jwt.md +0 -206
- package/framework/standards/infrastructure/supabase/supabase-pgvector.md +0 -169
- package/framework/standards/infrastructure/supabase/supabase-rls.md +0 -184
- package/framework/standards/infrastructure/supabase/supabase-storage.md +0 -153
|
@@ -1,168 +1,167 @@
|
|
|
1
|
-
// ============================================================
|
|
2
|
-
// CONTRACTS: {{titleCase FEATURE_NAME}}
|
|
3
|
-
// Stack: Next.js +
|
|
4
|
-
// Generated by MORPH Framework
|
|
5
|
-
// Date: {{DATE}}
|
|
6
|
-
// ============================================================
|
|
7
|
-
|
|
8
|
-
// -----
|
|
9
|
-
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
| { success:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| "
|
|
106
|
-
| "
|
|
107
|
-
| "
|
|
108
|
-
| "
|
|
109
|
-
| "
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
//
|
|
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
|
|
32
|
-
- Project: {{
|
|
33
|
-
- 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-
|
|
55
|
+
{{#if (eq STACK "nextjs-neon")}}
|
|
56
56
|
### Technical Approach
|
|
57
57
|
|
|
58
58
|
| Layer | Technology | Role |
|
|
59
59
|
|-------|-----------|------|
|
|
60
|
-
| **Database** |
|
|
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-
|
|
77
|
+
{{#if (eq STACK "nextjs-neon")}}
|
|
78
78
|
## Cost Estimate
|
|
79
79
|
|
|
80
80
|
| Resource | Provider | Monthly Cost | Notes |
|
|
81
81
|
|----------|----------|-------------|-------|
|
|
82
|
-
|
|
|
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-
|
|
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-
|
|
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
|
|
@@ -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-
|
|
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
|
|
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
|
|
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
|
|
84
|
-
|
|
85
|
-
### Consequences
|
|
86
|
-
|
|
87
|
-
**Pros:**
|
|
88
|
-
- Single auth provider for both layers
|
|
89
|
-
- RLS policies work
|
|
90
|
-
- Built-in social login, magic links, email/password
|
|
91
|
-
- No separate auth service to maintain
|
|
92
|
-
|
|
93
|
-
**Cons:**
|
|
94
|
-
-
|
|
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*
|