-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompatibility-matrix.ts
More file actions
262 lines (248 loc) · 8.08 KB
/
Copy pathcompatibility-matrix.ts
File metadata and controls
262 lines (248 loc) · 8.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
/**
* @data/rules/compatibility-matrix.ts
* Rule-based compatibility definitions.
* Every rule maps a combination of stack choices to a compatibility status.
* The engine reads these — never duplicate this logic in UI or CLI code.
*/
import type {
Framework,
Database,
ORM,
AuthProvider,
UILibrary,
CompatibilityStatus,
} from "../schemas/stack";
export interface CompatibilityRule {
key: string;
status: CompatibilityStatus;
message: string;
suggestion?: string;
}
// ─── Framework + UI Library ───────────────────────────────────────────────
export type FrameworkUIRule = {
framework: Framework;
uiLibrary: UILibrary;
} & CompatibilityRule;
export const FRAMEWORK_UI_RULES: FrameworkUIRule[] = [
// shadcn/ui is React-only
{
key: "framework-ui",
framework: "astro",
uiLibrary: "shadcn",
status: "needs-review",
message: "shadcn/ui works in Astro via React integration but requires @astrojs/react",
suggestion: "Install @astrojs/react or switch uiLibrary to 'none' for Astro",
},
{
key: "framework-ui",
framework: "sveltekit",
uiLibrary: "shadcn",
status: "incompatible",
message: "shadcn/ui is React-only and cannot be used with SvelteKit",
suggestion: "Use 'none' or a Svelte-native component library",
},
{
key: "framework-ui",
framework: "nuxt",
uiLibrary: "shadcn",
status: "incompatible",
message: "shadcn/ui is React-only and cannot be used with Nuxt",
suggestion: "Use 'none' for Nuxt or switch to a Vue-compatible library",
},
{
key: "framework-ui",
framework: "hono",
uiLibrary: "shadcn",
status: "incompatible",
message: "Hono is a server framework; shadcn/ui is a client component library",
suggestion: "Remove uiLibrary for API projects or add a frontend separately",
},
{
key: "framework-ui",
framework: "express",
uiLibrary: "shadcn",
status: "incompatible",
message: "Express is a server framework; shadcn/ui is a client component library",
suggestion: "Remove uiLibrary for API projects",
},
{
key: "framework-ui",
framework: "fastify",
uiLibrary: "shadcn",
status: "incompatible",
message: "Fastify is a server framework; shadcn/ui is a client component library",
suggestion: "Remove uiLibrary for API projects",
},
];
// ─── Database + ORM ───────────────────────────────────────────────────────
export type DatabaseORMRule = {
database: Database;
orm: ORM;
} & CompatibilityRule;
export const DATABASE_ORM_RULES: DatabaseORMRule[] = [
// Convex has its own query layer — no external ORM needed
{
key: "db-orm",
database: "convex",
orm: "prisma",
status: "incompatible",
message: "Convex has its own built-in data layer and does not use Prisma",
suggestion: "Set orm to 'none' when using Convex",
},
{
key: "db-orm",
database: "convex",
orm: "drizzle",
status: "incompatible",
message: "Convex has its own built-in data layer and does not use Drizzle",
suggestion: "Set orm to 'none' when using Convex",
},
{
key: "db-orm",
database: "convex",
orm: "mongoose",
status: "incompatible",
message: "Convex has its own built-in data layer and does not use Mongoose",
suggestion: "Set orm to 'none' when using Convex",
},
// Supabase has PostgREST built in; Prisma/Drizzle work on top
{
key: "db-orm",
database: "supabase",
orm: "mongoose",
status: "incompatible",
message: "Supabase uses PostgreSQL; Mongoose is for MongoDB",
suggestion: "Use Prisma or Drizzle with Supabase, or set orm to 'none'",
},
// MongoDB needs Mongoose
{
key: "db-orm",
database: "mongodb",
orm: "prisma",
status: "needs-review",
message: "Prisma supports MongoDB but the MongoDB connector has limitations",
suggestion: "Consider using Mongoose for better MongoDB compatibility",
},
{
key: "db-orm",
database: "mongodb",
orm: "drizzle",
status: "incompatible",
message: "Drizzle does not support MongoDB",
suggestion: "Use Mongoose for MongoDB, or switch to a PostgreSQL-based database",
},
// Firebase has its own SDK
{
key: "db-orm",
database: "firebase",
orm: "prisma",
status: "incompatible",
message: "Firebase Firestore uses its own SDK and does not work with Prisma",
suggestion: "Set orm to 'none' when using Firebase",
},
{
key: "db-orm",
database: "firebase",
orm: "drizzle",
status: "incompatible",
message: "Firebase Firestore uses its own SDK and does not work with Drizzle",
suggestion: "Set orm to 'none' when using Firebase",
},
// No DB = no ORM
{
key: "db-orm",
database: "none",
orm: "prisma",
status: "incompatible",
message: "An ORM requires a database. No database is selected.",
suggestion: "Select a database or set orm to 'none'",
},
{
key: "db-orm",
database: "none",
orm: "drizzle",
status: "incompatible",
message: "An ORM requires a database. No database is selected.",
suggestion: "Select a database or set orm to 'none'",
},
{
key: "db-orm",
database: "none",
orm: "mongoose",
status: "incompatible",
message: "An ORM requires a database. No database is selected.",
suggestion: "Select a database or set orm to 'none'",
},
];
// ─── Auth + Framework ─────────────────────────────────────────────────────
export type AuthFrameworkRule = {
auth: AuthProvider;
framework: Framework;
} & CompatibilityRule;
export const AUTH_FRAMEWORK_RULES: AuthFrameworkRule[] = [
// next-auth is Next.js specific
{
key: "auth-framework",
auth: "next-auth",
framework: "react-vite",
status: "incompatible",
message: "next-auth (Auth.js) requires a Next.js or compatible server framework",
suggestion: "Use better-auth or clerk for Vite React projects",
},
{
key: "auth-framework",
auth: "next-auth",
framework: "astro",
status: "needs-review",
message: "Auth.js has an Astro adapter but requires additional configuration",
suggestion: "Use better-auth for simpler Astro auth setup",
},
{
key: "auth-framework",
auth: "next-auth",
framework: "hono",
status: "incompatible",
message: "next-auth is designed for Next.js and is incompatible with Hono",
suggestion: "Use better-auth which supports Hono via its adapter system",
},
// Supabase auth goes with Supabase DB
{
key: "auth-framework",
auth: "supabase-auth",
framework: "hono",
status: "needs-review",
message: "Supabase Auth works with Hono but requires manual JWT validation setup",
suggestion: "Consider better-auth for a more integrated Hono auth experience",
},
];
// ─── Database + Auth ─────────────────────────────────────────────────────
export type DatabaseAuthRule = {
database: Database;
auth: AuthProvider;
} & CompatibilityRule;
export const DATABASE_AUTH_RULES: DatabaseAuthRule[] = [
{
key: "db-auth",
database: "firebase",
auth: "better-auth",
status: "needs-review",
message: "better-auth with Firebase requires a custom adapter",
suggestion: "Use firebase-auth when working with Firebase, or switch to PostgreSQL/Supabase",
},
{
key: "db-auth",
database: "convex",
auth: "better-auth",
status: "needs-review",
message: "better-auth with Convex requires a custom adapter — not officially supported yet",
suggestion: "Use Clerk which has official Convex integration, or use Supabase Auth",
},
{
key: "db-auth",
database: "convex",
auth: "next-auth",
status: "needs-review",
message: "next-auth with Convex requires a custom session/token setup",
suggestion: "Use Clerk which has official Convex integration",
},
];