-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstack-config.ts
More file actions
157 lines (151 loc) · 3.98 KB
/
Copy pathstack-config.ts
File metadata and controls
157 lines (151 loc) · 3.98 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
/**
* Stack Configuration
*
* Add new technologies here to make them available in the UI and AI.
* Each category can have multiple options.
*/
export const STACK_CONFIG = {
intent: {
label: "Intent",
description: "What type of application are you building?",
options: {
saas: {
label: "SaaS",
description: "Full-stack application with frontend and backend",
},
api: {
label: "API",
description: "Backend-only service",
},
},
required: true,
default: "saas",
},
frontend: {
label: "Frontend",
description: "Choose your frontend framework",
options: {
nextjs: {
label: "Next.js",
description: "React framework with server-side rendering",
dockerImage: "node:20-alpine",
port: 3000,
icon: "nextjs",
},
// Add more frontend options here:
// react: {
// label: "React",
// description: "React with Vite",
// dockerImage: "node:20-alpine",
// port: 5173,
// icon: "react",
// },
},
},
backend: {
label: "Backend",
description: "Choose your backend runtime",
options: {
// Add backend options here when templates are created
},
},
database: {
label: "Database",
description: "Choose your database",
options: {
mongodb: {
label: "MongoDB",
description: "NoSQL document database",
dockerImage: "mongo:7",
port: 27017,
icon: "mongodb",
envVars: {
MONGODB_URI: "mongodb://root:example@localhost:27017",
MONGODB_ROOT_USERNAME: "root",
MONGODB_ROOT_PASSWORD: "example",
},
},
// Add more database options here when templates are created:
// postgres: {
// label: "PostgreSQL",
// description: "Relational database",
// dockerImage: "postgres:16-alpine",
// port: 5432,
// icon: "postgresql",
// envVars: {
// POSTGRES_USER: "dev",
// POSTGRES_PASSWORD: "dev",
// POSTGRES_DB: "BaseCompose_db",
// },
// },
// mysql: {
// label: "MySQL",
// description: "Relational database",
// dockerImage: "mysql:8.0",
// port: 3306,
// icon: "mysql",
// envVars: {
// MYSQL_ROOT_PASSWORD: "dev",
// MYSQL_DATABASE: "BaseCompose_db",
// },
// },
// redis: {
// label: "Redis",
// description: "In-memory cache",
// dockerImage: "redis:7-alpine",
// port: 6379,
// icon: "redis",
// },
},
},
auth: {
label: "Authentication",
description: "Choose your auth solution",
options: {
authjs: {
label: "Auth.js",
description: "NextAuth.js authentication",
icon: "nextauth",
requiresDatabase: true,
},
// Add more auth options here:
// clerk: {
// label: "Clerk",
// description: "Managed authentication",
// requiresDatabase: false,
// },
},
},
} as const;
// Type helpers
export type StackCategory = keyof typeof STACK_CONFIG;
export type StackOption<T extends StackCategory> = keyof typeof STACK_CONFIG[T]["options"];
/**
* Resolution rules - define how technologies interact
* Add new rules here when technologies have dependencies
*/
export const RESOLUTION_RULES: Array<{
name: string;
condition: (stack: any) => boolean;
apply: (stack: any) => void;
}> = [];
/**
* Helper to get all available options for a category
*/
export function getOptions<T extends StackCategory>(category: T) {
return Object.entries(STACK_CONFIG[category].options).map(([key, value]) => ({
key,
...value,
}));
}
/**
* Helper to get option config
*/
export function getOptionConfig(
category: StackCategory,
option: string
): any {
const categoryConfig = STACK_CONFIG[category];
if (!categoryConfig) return null;
return (categoryConfig.options as Record<string, any>)[option];
}