@adityum/studio 0.0.0-stage → 0.1.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 +21 -2
- package/bin/adi-studio.js +2 -0
- package/dist/bin/adi-studio.d.ts +1 -0
- package/dist/bin/adi-studio.js +140 -0
- package/dist/engines/blueprints.d.ts +24 -0
- package/dist/engines/blueprints.js +724 -0
- package/dist/engines/codegen.d.ts +32 -0
- package/dist/engines/codegen.js +427 -0
- package/dist/engines/types.d.ts +114 -0
- package/dist/engines/types.js +1 -0
- package/dist/engines/validator.d.ts +7 -0
- package/dist/engines/validator.js +311 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +32 -4
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
export const SERVICE_KIND_META = {
|
|
2
|
+
tunnel: {
|
|
3
|
+
label: "Cloudflare Tunnel",
|
|
4
|
+
shortTag: "EDGE",
|
|
5
|
+
accent: "#F59E0B",
|
|
6
|
+
defaultRuntime: "cloudflared",
|
|
7
|
+
defaultPort: 443,
|
|
8
|
+
defaultCpu: 0.25,
|
|
9
|
+
defaultMemoryMb: 128,
|
|
10
|
+
defaultPublic: true,
|
|
11
|
+
tier: 0,
|
|
12
|
+
},
|
|
13
|
+
web: {
|
|
14
|
+
label: "Web Frontend",
|
|
15
|
+
shortTag: "WEB",
|
|
16
|
+
accent: "#A78BFA",
|
|
17
|
+
defaultRuntime: "nextjs",
|
|
18
|
+
defaultPort: 3000,
|
|
19
|
+
defaultCpu: 0.5,
|
|
20
|
+
defaultMemoryMb: 512,
|
|
21
|
+
defaultPublic: true,
|
|
22
|
+
tier: 1,
|
|
23
|
+
},
|
|
24
|
+
api: {
|
|
25
|
+
label: "API Microservice",
|
|
26
|
+
shortTag: "API",
|
|
27
|
+
accent: "#10B981",
|
|
28
|
+
defaultRuntime: "nodejs",
|
|
29
|
+
defaultPort: 8000,
|
|
30
|
+
defaultCpu: 1,
|
|
31
|
+
defaultMemoryMb: 512,
|
|
32
|
+
defaultPublic: false,
|
|
33
|
+
tier: 2,
|
|
34
|
+
},
|
|
35
|
+
worker: {
|
|
36
|
+
label: "Async Worker",
|
|
37
|
+
shortTag: "WORKER",
|
|
38
|
+
accent: "#22D3EE",
|
|
39
|
+
defaultRuntime: "python",
|
|
40
|
+
defaultPort: 8080,
|
|
41
|
+
defaultCpu: 1,
|
|
42
|
+
defaultMemoryMb: 512,
|
|
43
|
+
defaultPublic: false,
|
|
44
|
+
tier: 2,
|
|
45
|
+
},
|
|
46
|
+
cron: {
|
|
47
|
+
label: "Scheduled Cron",
|
|
48
|
+
shortTag: "CRON",
|
|
49
|
+
accent: "#FB923C",
|
|
50
|
+
defaultRuntime: "nodejs",
|
|
51
|
+
defaultPort: 8090,
|
|
52
|
+
defaultCpu: 0.25,
|
|
53
|
+
defaultMemoryMb: 256,
|
|
54
|
+
defaultPublic: false,
|
|
55
|
+
tier: 2,
|
|
56
|
+
},
|
|
57
|
+
postgres: {
|
|
58
|
+
label: "PostgreSQL 16",
|
|
59
|
+
shortTag: "DB",
|
|
60
|
+
accent: "#818CF8",
|
|
61
|
+
defaultRuntime: "postgres16",
|
|
62
|
+
defaultPort: 5432,
|
|
63
|
+
defaultCpu: 1,
|
|
64
|
+
defaultMemoryMb: 1024,
|
|
65
|
+
defaultPublic: false,
|
|
66
|
+
tier: 3,
|
|
67
|
+
},
|
|
68
|
+
redis: {
|
|
69
|
+
label: "Redis 7 Cache",
|
|
70
|
+
shortTag: "CACHE",
|
|
71
|
+
accent: "#EF4444",
|
|
72
|
+
defaultRuntime: "redis7",
|
|
73
|
+
defaultPort: 6379,
|
|
74
|
+
defaultCpu: 0.5,
|
|
75
|
+
defaultMemoryMb: 256,
|
|
76
|
+
defaultPublic: false,
|
|
77
|
+
tier: 3,
|
|
78
|
+
},
|
|
79
|
+
storage: {
|
|
80
|
+
label: "Adityum R2 Vault",
|
|
81
|
+
shortTag: "R2",
|
|
82
|
+
accent: "#10B981",
|
|
83
|
+
defaultRuntime: "r2-bucket",
|
|
84
|
+
defaultPort: 443,
|
|
85
|
+
defaultCpu: 0,
|
|
86
|
+
defaultMemoryMb: 0,
|
|
87
|
+
defaultPublic: false,
|
|
88
|
+
tier: 3,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
export function inferEdgeProtocol(source, target) {
|
|
92
|
+
if (target.kind === "postgres") {
|
|
93
|
+
return { protocol: "postgres-tls", label: "PG TLS :5432", encrypted: true };
|
|
94
|
+
}
|
|
95
|
+
if (target.kind === "redis") {
|
|
96
|
+
return { protocol: "redis-tls", label: "Redis :6379", encrypted: true };
|
|
97
|
+
}
|
|
98
|
+
if (target.kind === "storage") {
|
|
99
|
+
return { protocol: "s3-sigv4", label: "ADI1 SigV4", encrypted: true };
|
|
100
|
+
}
|
|
101
|
+
if (source.kind === "tunnel") {
|
|
102
|
+
return { protocol: "https", label: "Tunnel Ingress", encrypted: true };
|
|
103
|
+
}
|
|
104
|
+
return { protocol: "http-internal", label: `Internal :${target.port}`, encrypted: true };
|
|
105
|
+
}
|
|
106
|
+
export function createServiceNode(kind, existingNodes) {
|
|
107
|
+
const meta = SERVICE_KIND_META[kind];
|
|
108
|
+
const baseSlug = kind === "tunnel"
|
|
109
|
+
? "edge-tunnel"
|
|
110
|
+
: kind === "web"
|
|
111
|
+
? "web-app"
|
|
112
|
+
: kind === "api"
|
|
113
|
+
? "core-api"
|
|
114
|
+
: kind === "worker"
|
|
115
|
+
? "bg-worker"
|
|
116
|
+
: kind === "cron"
|
|
117
|
+
? "watchdog-cron"
|
|
118
|
+
: kind === "postgres"
|
|
119
|
+
? "primary-db"
|
|
120
|
+
: kind === "redis"
|
|
121
|
+
? "session-cache"
|
|
122
|
+
: "r2-vault";
|
|
123
|
+
let suffix = 1;
|
|
124
|
+
let candidateName = baseSlug;
|
|
125
|
+
const usedNames = new Set(existingNodes.map((n) => n.name));
|
|
126
|
+
while (usedNames.has(candidateName)) {
|
|
127
|
+
suffix += 1;
|
|
128
|
+
candidateName = `${baseSlug}-${suffix}`;
|
|
129
|
+
}
|
|
130
|
+
const tierNodes = existingNodes.filter((n) => SERVICE_KIND_META[n.kind].tier === meta.tier);
|
|
131
|
+
const x = 60 + meta.tier * 280;
|
|
132
|
+
const y = 70 + tierNodes.length * 160;
|
|
133
|
+
const id = `node-${candidateName}-${Math.random().toString(36).slice(2, 7)}`;
|
|
134
|
+
const isCompute = kind === "web" || kind === "api" || kind === "worker" || kind === "cron";
|
|
135
|
+
return {
|
|
136
|
+
id,
|
|
137
|
+
name: candidateName,
|
|
138
|
+
label: suffix > 1 ? `${meta.label} ${suffix}` : meta.label,
|
|
139
|
+
kind,
|
|
140
|
+
runtime: meta.defaultRuntime,
|
|
141
|
+
x,
|
|
142
|
+
y,
|
|
143
|
+
port: meta.defaultPort,
|
|
144
|
+
publicIngress: meta.defaultPublic,
|
|
145
|
+
replicas: 1,
|
|
146
|
+
cpuLimit: meta.defaultCpu,
|
|
147
|
+
memoryMb: meta.defaultMemoryMb,
|
|
148
|
+
gitRepoUrl: isCompute ? "https://github.com/adityumgroups-dev/starter-app" : undefined,
|
|
149
|
+
gitBranch: isCompute ? "main" : undefined,
|
|
150
|
+
healthcheckPath: kind === "web" || kind === "api"
|
|
151
|
+
? "/api/v1/health"
|
|
152
|
+
: kind === "worker"
|
|
153
|
+
? "/healthz"
|
|
154
|
+
: undefined,
|
|
155
|
+
volumePath: kind === "postgres"
|
|
156
|
+
? "/var/lib/postgresql/data"
|
|
157
|
+
: kind === "redis"
|
|
158
|
+
? "/data"
|
|
159
|
+
: undefined,
|
|
160
|
+
nonRootUser: true,
|
|
161
|
+
readOnlyRootFs: kind === "tunnel" || kind === "api",
|
|
162
|
+
envVars: kind === "postgres"
|
|
163
|
+
? [
|
|
164
|
+
{ key: "POSTGRES_DB", value: "adityum_prod", isSecret: false },
|
|
165
|
+
{ key: "POSTGRES_USER", value: "adityum", isSecret: false },
|
|
166
|
+
{ key: "POSTGRES_PASSWORD", value: "${VAULT:POSTGRES_PASSWORD}", isSecret: true },
|
|
167
|
+
]
|
|
168
|
+
: kind === "api"
|
|
169
|
+
? [
|
|
170
|
+
{ key: "NODE_ENV", value: "production", isSecret: false },
|
|
171
|
+
{ key: "ADI_MASTER_KEY_V1", value: "${VAULT:ADI_MASTER_KEY_V1}", isSecret: true },
|
|
172
|
+
]
|
|
173
|
+
: kind === "web"
|
|
174
|
+
? [{ key: "NODE_ENV", value: "production", isSecret: false }]
|
|
175
|
+
: [],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Deterministic left-to-right architectural tier layout (20px grid snapped).
|
|
180
|
+
*/
|
|
181
|
+
export function autoLayoutTopology(topology) {
|
|
182
|
+
const buckets = new Map();
|
|
183
|
+
for (const node of topology.nodes) {
|
|
184
|
+
const tier = SERVICE_KIND_META[node.kind].tier;
|
|
185
|
+
const list = buckets.get(tier) || [];
|
|
186
|
+
list.push(node);
|
|
187
|
+
buckets.set(tier, list);
|
|
188
|
+
}
|
|
189
|
+
const laidOutNodes = topology.nodes.map((node) => {
|
|
190
|
+
const tier = SERVICE_KIND_META[node.kind].tier;
|
|
191
|
+
const group = buckets.get(tier) || [];
|
|
192
|
+
const idx = group.findIndex((n) => n.id === node.id);
|
|
193
|
+
const total = group.length;
|
|
194
|
+
const baseOffset = total === 1 ? 160 : total === 2 ? 80 : 40;
|
|
195
|
+
const x = Math.round((40 + tier * 260) / 20) * 20;
|
|
196
|
+
const y = Math.round((baseOffset + idx * 160) / 20) * 20;
|
|
197
|
+
return { ...node, x, y };
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
...topology,
|
|
201
|
+
nodes: laidOutNodes,
|
|
202
|
+
updatedAt: new Date().toISOString(),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export const STUDIO_BLUEPRINTS = [
|
|
206
|
+
{
|
|
207
|
+
id: "saas-nextjs-postgres",
|
|
208
|
+
name: "Sovereign Full-Stack SaaS",
|
|
209
|
+
tagline: "Zero-port Cloudflare Tunnel → Next.js Web → Node API → PostgreSQL 16 + Redis 7 + Encrypted R2 Vault",
|
|
210
|
+
category: "Full-Stack SaaS",
|
|
211
|
+
complianceProfile: "cert-in-180d",
|
|
212
|
+
badge: "RECOMMENDED",
|
|
213
|
+
create: () => {
|
|
214
|
+
const nodes = [
|
|
215
|
+
{
|
|
216
|
+
id: "n-tunnel",
|
|
217
|
+
name: "edge-tunnel",
|
|
218
|
+
label: "Cloudflare Tunnel",
|
|
219
|
+
kind: "tunnel",
|
|
220
|
+
runtime: "cloudflared",
|
|
221
|
+
x: 40,
|
|
222
|
+
y: 160,
|
|
223
|
+
port: 443,
|
|
224
|
+
publicIngress: true,
|
|
225
|
+
replicas: 1,
|
|
226
|
+
cpuLimit: 0.25,
|
|
227
|
+
memoryMb: 128,
|
|
228
|
+
nonRootUser: true,
|
|
229
|
+
readOnlyRootFs: true,
|
|
230
|
+
envVars: [{ key: "TUNNEL_TOKEN", value: "${VAULT:TUNNEL_TOKEN}", isSecret: true }],
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: "n-web",
|
|
234
|
+
name: "web-frontend",
|
|
235
|
+
label: "Next.js Web App",
|
|
236
|
+
kind: "web",
|
|
237
|
+
runtime: "nextjs",
|
|
238
|
+
x: 300,
|
|
239
|
+
y: 80,
|
|
240
|
+
port: 3000,
|
|
241
|
+
publicIngress: true,
|
|
242
|
+
replicas: 2,
|
|
243
|
+
cpuLimit: 0.5,
|
|
244
|
+
memoryMb: 512,
|
|
245
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/saas-web",
|
|
246
|
+
gitBranch: "main",
|
|
247
|
+
healthcheckPath: "/api/v1/health",
|
|
248
|
+
nonRootUser: true,
|
|
249
|
+
readOnlyRootFs: false,
|
|
250
|
+
envVars: [
|
|
251
|
+
{ key: "NODE_ENV", value: "production", isSecret: false },
|
|
252
|
+
{ key: "API_INTERNAL_URL", value: "http://core-api:8000", isSecret: false, fromServiceId: "n-api" },
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
id: "n-api",
|
|
257
|
+
name: "core-api",
|
|
258
|
+
label: "Core API Service",
|
|
259
|
+
kind: "api",
|
|
260
|
+
runtime: "nodejs",
|
|
261
|
+
x: 560,
|
|
262
|
+
y: 160,
|
|
263
|
+
port: 8000,
|
|
264
|
+
publicIngress: false,
|
|
265
|
+
replicas: 2,
|
|
266
|
+
cpuLimit: 1,
|
|
267
|
+
memoryMb: 512,
|
|
268
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/saas-api",
|
|
269
|
+
gitBranch: "main",
|
|
270
|
+
healthcheckPath: "/api/v1/health",
|
|
271
|
+
nonRootUser: true,
|
|
272
|
+
readOnlyRootFs: true,
|
|
273
|
+
envVars: [
|
|
274
|
+
{ key: "NODE_ENV", value: "production", isSecret: false },
|
|
275
|
+
{
|
|
276
|
+
key: "DATABASE_URL",
|
|
277
|
+
value: "postgresql://adityum:${POSTGRES_PASSWORD}@primary-db:5432/adityum_prod?sslmode=require",
|
|
278
|
+
isSecret: true,
|
|
279
|
+
fromServiceId: "n-db",
|
|
280
|
+
},
|
|
281
|
+
{ key: "REDIS_URL", value: "redis://session-cache:6379", isSecret: false, fromServiceId: "n-redis" },
|
|
282
|
+
{ key: "ADI_MASTER_KEY_V1", value: "${VAULT:ADI_MASTER_KEY_V1}", isSecret: true },
|
|
283
|
+
],
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
id: "n-db",
|
|
287
|
+
name: "primary-db",
|
|
288
|
+
label: "PostgreSQL 16",
|
|
289
|
+
kind: "postgres",
|
|
290
|
+
runtime: "postgres16",
|
|
291
|
+
x: 820,
|
|
292
|
+
y: 40,
|
|
293
|
+
port: 5432,
|
|
294
|
+
publicIngress: false,
|
|
295
|
+
replicas: 1,
|
|
296
|
+
cpuLimit: 1,
|
|
297
|
+
memoryMb: 1024,
|
|
298
|
+
volumePath: "/var/lib/postgresql/data",
|
|
299
|
+
nonRootUser: true,
|
|
300
|
+
readOnlyRootFs: false,
|
|
301
|
+
envVars: [
|
|
302
|
+
{ key: "POSTGRES_DB", value: "adityum_prod", isSecret: false },
|
|
303
|
+
{ key: "POSTGRES_USER", value: "adityum", isSecret: false },
|
|
304
|
+
{ key: "POSTGRES_PASSWORD", value: "${VAULT:POSTGRES_PASSWORD}", isSecret: true },
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "n-redis",
|
|
309
|
+
name: "session-cache",
|
|
310
|
+
label: "Redis 7 Cache",
|
|
311
|
+
kind: "redis",
|
|
312
|
+
runtime: "redis7",
|
|
313
|
+
x: 820,
|
|
314
|
+
y: 200,
|
|
315
|
+
port: 6379,
|
|
316
|
+
publicIngress: false,
|
|
317
|
+
replicas: 1,
|
|
318
|
+
cpuLimit: 0.5,
|
|
319
|
+
memoryMb: 256,
|
|
320
|
+
volumePath: "/data",
|
|
321
|
+
nonRootUser: true,
|
|
322
|
+
readOnlyRootFs: false,
|
|
323
|
+
envVars: [],
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "n-r2",
|
|
327
|
+
name: "r2-backups",
|
|
328
|
+
label: "Adityum R2 Vault",
|
|
329
|
+
kind: "storage",
|
|
330
|
+
runtime: "r2-bucket",
|
|
331
|
+
x: 820,
|
|
332
|
+
y: 360,
|
|
333
|
+
port: 443,
|
|
334
|
+
publicIngress: false,
|
|
335
|
+
replicas: 1,
|
|
336
|
+
cpuLimit: 0,
|
|
337
|
+
memoryMb: 0,
|
|
338
|
+
nonRootUser: true,
|
|
339
|
+
readOnlyRootFs: true,
|
|
340
|
+
envVars: [
|
|
341
|
+
{ key: "R2_ACCESS_KEY_ID", value: "${VAULT:R2_ACCESS_KEY_ID}", isSecret: true },
|
|
342
|
+
{ key: "R2_SECRET_ACCESS_KEY", value: "${VAULT:R2_SECRET_ACCESS_KEY}", isSecret: true },
|
|
343
|
+
],
|
|
344
|
+
},
|
|
345
|
+
];
|
|
346
|
+
const edges = [
|
|
347
|
+
{ id: "e-1", sourceId: "n-tunnel", targetId: "n-web", protocol: "https", label: "HTTPS Edge", encrypted: true },
|
|
348
|
+
{ id: "e-2", sourceId: "n-tunnel", targetId: "n-api", protocol: "https", label: "/api/v1/*", encrypted: true },
|
|
349
|
+
{ id: "e-3", sourceId: "n-web", targetId: "n-api", protocol: "http-internal", label: "Internal :8000", encrypted: true },
|
|
350
|
+
{ id: "e-4", sourceId: "n-api", targetId: "n-db", protocol: "postgres-tls", label: "PG TLS :5432", encrypted: true },
|
|
351
|
+
{ id: "e-5", sourceId: "n-api", targetId: "n-redis", protocol: "redis-tls", label: "Redis :6379", encrypted: true },
|
|
352
|
+
{ id: "e-6", sourceId: "n-db", targetId: "n-r2", protocol: "s3-sigv4", label: "ADI1 Backups", encrypted: true },
|
|
353
|
+
];
|
|
354
|
+
return {
|
|
355
|
+
id: "bp-saas-nextjs-postgres",
|
|
356
|
+
name: "sovereign-saas-stack",
|
|
357
|
+
description: "Production multi-tier SaaS stack with zero exposed ports, internal DB isolation, and ADI1 encrypted R2 backups.",
|
|
358
|
+
region: "blr1",
|
|
359
|
+
complianceProfile: "cert-in-180d",
|
|
360
|
+
domain: "app.your-domain.dev",
|
|
361
|
+
nodes,
|
|
362
|
+
edges,
|
|
363
|
+
updatedAt: new Date().toISOString(),
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
id: "ai-inference-stack",
|
|
369
|
+
name: "Sovereign AI & Vector Pipeline",
|
|
370
|
+
tagline: "FastAPI Gateway + Python Embedding Worker + PostgreSQL 16 Vector Store + Redis Queue",
|
|
371
|
+
category: "AI & Data",
|
|
372
|
+
complianceProfile: "dpdp-strict",
|
|
373
|
+
badge: "AI READY",
|
|
374
|
+
create: () => {
|
|
375
|
+
const nodes = [
|
|
376
|
+
{
|
|
377
|
+
id: "ai-tunnel",
|
|
378
|
+
name: "edge-tunnel",
|
|
379
|
+
label: "Cloudflare Tunnel",
|
|
380
|
+
kind: "tunnel",
|
|
381
|
+
runtime: "cloudflared",
|
|
382
|
+
x: 40,
|
|
383
|
+
y: 160,
|
|
384
|
+
port: 443,
|
|
385
|
+
publicIngress: true,
|
|
386
|
+
replicas: 1,
|
|
387
|
+
cpuLimit: 0.25,
|
|
388
|
+
memoryMb: 128,
|
|
389
|
+
nonRootUser: true,
|
|
390
|
+
readOnlyRootFs: true,
|
|
391
|
+
envVars: [{ key: "TUNNEL_TOKEN", value: "${VAULT:TUNNEL_TOKEN}", isSecret: true }],
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
id: "ai-api",
|
|
395
|
+
name: "inference-gateway",
|
|
396
|
+
label: "FastAPI Gateway",
|
|
397
|
+
kind: "api",
|
|
398
|
+
runtime: "python",
|
|
399
|
+
x: 320,
|
|
400
|
+
y: 100,
|
|
401
|
+
port: 8000,
|
|
402
|
+
publicIngress: true,
|
|
403
|
+
replicas: 2,
|
|
404
|
+
cpuLimit: 1,
|
|
405
|
+
memoryMb: 1024,
|
|
406
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/ai-gateway",
|
|
407
|
+
gitBranch: "main",
|
|
408
|
+
healthcheckPath: "/api/v1/health",
|
|
409
|
+
nonRootUser: true,
|
|
410
|
+
readOnlyRootFs: false,
|
|
411
|
+
envVars: [
|
|
412
|
+
{ key: "MODEL_API_KEY", value: "${VAULT:MODEL_API_KEY}", isSecret: true },
|
|
413
|
+
{ key: "REDIS_URL", value: "redis://job-queue:6379", isSecret: false, fromServiceId: "ai-redis" },
|
|
414
|
+
],
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
id: "ai-worker",
|
|
418
|
+
name: "embedding-worker",
|
|
419
|
+
label: "Python Embedding Worker",
|
|
420
|
+
kind: "worker",
|
|
421
|
+
runtime: "python",
|
|
422
|
+
x: 560,
|
|
423
|
+
y: 260,
|
|
424
|
+
port: 8080,
|
|
425
|
+
publicIngress: false,
|
|
426
|
+
replicas: 2,
|
|
427
|
+
cpuLimit: 2,
|
|
428
|
+
memoryMb: 2048,
|
|
429
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/ai-worker",
|
|
430
|
+
gitBranch: "main",
|
|
431
|
+
healthcheckPath: "/healthz",
|
|
432
|
+
nonRootUser: true,
|
|
433
|
+
readOnlyRootFs: false,
|
|
434
|
+
envVars: [
|
|
435
|
+
{ key: "DATABASE_URL", value: "postgresql://adityum:${POSTGRES_PASSWORD}@vector-db:5432/vectors?sslmode=require", isSecret: true, fromServiceId: "ai-db" },
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
id: "ai-db",
|
|
440
|
+
name: "vector-db",
|
|
441
|
+
label: "PostgreSQL 16 (PgVector)",
|
|
442
|
+
kind: "postgres",
|
|
443
|
+
runtime: "postgres16",
|
|
444
|
+
x: 820,
|
|
445
|
+
y: 80,
|
|
446
|
+
port: 5432,
|
|
447
|
+
publicIngress: false,
|
|
448
|
+
replicas: 1,
|
|
449
|
+
cpuLimit: 2,
|
|
450
|
+
memoryMb: 2048,
|
|
451
|
+
volumePath: "/var/lib/postgresql/data",
|
|
452
|
+
nonRootUser: true,
|
|
453
|
+
readOnlyRootFs: false,
|
|
454
|
+
envVars: [
|
|
455
|
+
{ key: "POSTGRES_DB", value: "vectors", isSecret: false },
|
|
456
|
+
{ key: "POSTGRES_USER", value: "adityum", isSecret: false },
|
|
457
|
+
{ key: "POSTGRES_PASSWORD", value: "${VAULT:POSTGRES_PASSWORD}", isSecret: true },
|
|
458
|
+
],
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: "ai-redis",
|
|
462
|
+
name: "job-queue",
|
|
463
|
+
label: "Redis 7 Queue",
|
|
464
|
+
kind: "redis",
|
|
465
|
+
runtime: "redis7",
|
|
466
|
+
x: 820,
|
|
467
|
+
y: 260,
|
|
468
|
+
port: 6379,
|
|
469
|
+
publicIngress: false,
|
|
470
|
+
replicas: 1,
|
|
471
|
+
cpuLimit: 0.5,
|
|
472
|
+
memoryMb: 512,
|
|
473
|
+
volumePath: "/data",
|
|
474
|
+
nonRootUser: true,
|
|
475
|
+
readOnlyRootFs: false,
|
|
476
|
+
envVars: [],
|
|
477
|
+
},
|
|
478
|
+
];
|
|
479
|
+
const edges = [
|
|
480
|
+
{ id: "ae-1", sourceId: "ai-tunnel", targetId: "ai-api", protocol: "https", label: "/api/v1/*", encrypted: true },
|
|
481
|
+
{ id: "ae-2", sourceId: "ai-api", targetId: "ai-redis", protocol: "redis-tls", label: "Enqueue Jobs", encrypted: true },
|
|
482
|
+
{ id: "ae-3", sourceId: "ai-worker", targetId: "ai-redis", protocol: "redis-tls", label: "Consume Queue", encrypted: true },
|
|
483
|
+
{ id: "ae-4", sourceId: "ai-worker", targetId: "ai-db", protocol: "postgres-tls", label: "Upsert Vectors", encrypted: true },
|
|
484
|
+
{ id: "ae-5", sourceId: "ai-api", targetId: "ai-db", protocol: "postgres-tls", label: "Vector Search", encrypted: true },
|
|
485
|
+
];
|
|
486
|
+
return {
|
|
487
|
+
id: "bp-ai-inference-stack",
|
|
488
|
+
name: "sovereign-ai-pipeline",
|
|
489
|
+
description: "DPDP-compliant self-hosted AI API gateway with asynchronous vector indexing workers.",
|
|
490
|
+
region: "blr1",
|
|
491
|
+
complianceProfile: "dpdp-strict",
|
|
492
|
+
domain: "ai.your-domain.dev",
|
|
493
|
+
nodes,
|
|
494
|
+
edges,
|
|
495
|
+
updatedAt: new Date().toISOString(),
|
|
496
|
+
};
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
id: "event-driven-fintech",
|
|
501
|
+
name: "CERT-In 180-Day FinTech Ledger",
|
|
502
|
+
tagline: "Hardened Ledger API + Hash-Chain Audit Cron + PostgreSQL 16 + Immutable 180d R2 Archive",
|
|
503
|
+
category: "FinTech / Compliance",
|
|
504
|
+
complianceProfile: "cert-in-180d",
|
|
505
|
+
badge: "CERT-IN 180D",
|
|
506
|
+
create: () => {
|
|
507
|
+
const nodes = [
|
|
508
|
+
{
|
|
509
|
+
id: "ft-tunnel",
|
|
510
|
+
name: "edge-tunnel",
|
|
511
|
+
label: "Cloudflare Tunnel",
|
|
512
|
+
kind: "tunnel",
|
|
513
|
+
runtime: "cloudflared",
|
|
514
|
+
x: 40,
|
|
515
|
+
y: 160,
|
|
516
|
+
port: 443,
|
|
517
|
+
publicIngress: true,
|
|
518
|
+
replicas: 1,
|
|
519
|
+
cpuLimit: 0.25,
|
|
520
|
+
memoryMb: 128,
|
|
521
|
+
nonRootUser: true,
|
|
522
|
+
readOnlyRootFs: true,
|
|
523
|
+
envVars: [{ key: "TUNNEL_TOKEN", value: "${VAULT:TUNNEL_TOKEN}", isSecret: true }],
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
id: "ft-api",
|
|
527
|
+
name: "ledger-api",
|
|
528
|
+
label: "Go Ledger API",
|
|
529
|
+
kind: "api",
|
|
530
|
+
runtime: "go",
|
|
531
|
+
x: 340,
|
|
532
|
+
y: 100,
|
|
533
|
+
port: 8080,
|
|
534
|
+
publicIngress: true,
|
|
535
|
+
replicas: 2,
|
|
536
|
+
cpuLimit: 1,
|
|
537
|
+
memoryMb: 512,
|
|
538
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/ledger-api",
|
|
539
|
+
gitBranch: "main",
|
|
540
|
+
healthcheckPath: "/api/v1/health",
|
|
541
|
+
nonRootUser: true,
|
|
542
|
+
readOnlyRootFs: true,
|
|
543
|
+
envVars: [
|
|
544
|
+
{ key: "ADI_MASTER_KEY_V1", value: "${VAULT:ADI_MASTER_KEY_V1}", isSecret: true },
|
|
545
|
+
{ key: "NTP_SERVER", value: "time.nplindia.org", isSecret: false },
|
|
546
|
+
],
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
id: "ft-cron",
|
|
550
|
+
name: "audit-sealer",
|
|
551
|
+
label: "Hash-Chain Sealer Cron",
|
|
552
|
+
kind: "cron",
|
|
553
|
+
runtime: "nodejs",
|
|
554
|
+
x: 560,
|
|
555
|
+
y: 260,
|
|
556
|
+
port: 8090,
|
|
557
|
+
publicIngress: false,
|
|
558
|
+
replicas: 1,
|
|
559
|
+
cpuLimit: 0.25,
|
|
560
|
+
memoryMb: 256,
|
|
561
|
+
gitRepoUrl: "https://github.com/adityumgroups-dev/audit-sealer",
|
|
562
|
+
gitBranch: "main",
|
|
563
|
+
healthcheckPath: "/healthz",
|
|
564
|
+
nonRootUser: true,
|
|
565
|
+
readOnlyRootFs: true,
|
|
566
|
+
envVars: [{ key: "CRON_SECRET", value: "${VAULT:CRON_SECRET}", isSecret: true }],
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
id: "ft-db",
|
|
570
|
+
name: "ledger-db",
|
|
571
|
+
label: "PostgreSQL 16",
|
|
572
|
+
kind: "postgres",
|
|
573
|
+
runtime: "postgres16",
|
|
574
|
+
x: 820,
|
|
575
|
+
y: 80,
|
|
576
|
+
port: 5432,
|
|
577
|
+
publicIngress: false,
|
|
578
|
+
replicas: 1,
|
|
579
|
+
cpuLimit: 2,
|
|
580
|
+
memoryMb: 2048,
|
|
581
|
+
volumePath: "/var/lib/postgresql/data",
|
|
582
|
+
nonRootUser: true,
|
|
583
|
+
readOnlyRootFs: false,
|
|
584
|
+
envVars: [
|
|
585
|
+
{ key: "POSTGRES_DB", value: "ledger", isSecret: false },
|
|
586
|
+
{ key: "POSTGRES_USER", value: "ledger_svc", isSecret: false },
|
|
587
|
+
{ key: "POSTGRES_PASSWORD", value: "${VAULT:POSTGRES_PASSWORD}", isSecret: true },
|
|
588
|
+
],
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
id: "ft-r2",
|
|
592
|
+
name: "certin-180d-vault",
|
|
593
|
+
label: "180-Day R2 Archive",
|
|
594
|
+
kind: "storage",
|
|
595
|
+
runtime: "r2-bucket",
|
|
596
|
+
x: 820,
|
|
597
|
+
y: 260,
|
|
598
|
+
port: 443,
|
|
599
|
+
publicIngress: false,
|
|
600
|
+
replicas: 1,
|
|
601
|
+
cpuLimit: 0,
|
|
602
|
+
memoryMb: 0,
|
|
603
|
+
nonRootUser: true,
|
|
604
|
+
readOnlyRootFs: true,
|
|
605
|
+
envVars: [],
|
|
606
|
+
},
|
|
607
|
+
];
|
|
608
|
+
const edges = [
|
|
609
|
+
{ id: "fe-1", sourceId: "ft-tunnel", targetId: "ft-api", protocol: "https", label: "/api/v1/*", encrypted: true },
|
|
610
|
+
{ id: "fe-2", sourceId: "ft-api", targetId: "ft-db", protocol: "postgres-tls", label: "ACID Ledger", encrypted: true },
|
|
611
|
+
{ id: "fe-3", sourceId: "ft-cron", targetId: "ft-db", protocol: "postgres-tls", label: "Read Audit Log", encrypted: true },
|
|
612
|
+
{ id: "fe-4", sourceId: "ft-cron", targetId: "ft-r2", protocol: "s3-sigv4", label: "180d Immutable Push", encrypted: true },
|
|
613
|
+
];
|
|
614
|
+
return {
|
|
615
|
+
id: "bp-event-driven-fintech",
|
|
616
|
+
name: "certin-fintech-ledger",
|
|
617
|
+
description: "India CERT-In compliant financial API with read-only rootfs containers and 180-day immutable R2 log sealing.",
|
|
618
|
+
region: "bom1",
|
|
619
|
+
complianceProfile: "cert-in-180d",
|
|
620
|
+
domain: "ledger.your-domain.dev",
|
|
621
|
+
nodes,
|
|
622
|
+
edges,
|
|
623
|
+
updatedAt: new Date().toISOString(),
|
|
624
|
+
};
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
id: "minimal-starter",
|
|
629
|
+
name: "Minimal BYOC Starter",
|
|
630
|
+
tagline: "Lean single-node Next.js Full-Stack app + PostgreSQL 16 behind Cloudflare Tunnel (~₹450/mo VPS)",
|
|
631
|
+
category: "Starter",
|
|
632
|
+
complianceProfile: "standard",
|
|
633
|
+
badge: "LOW COST",
|
|
634
|
+
create: () => {
|
|
635
|
+
const nodes = [
|
|
636
|
+
{
|
|
637
|
+
id: "ms-tunnel",
|
|
638
|
+
name: "edge-tunnel",
|
|
639
|
+
label: "Cloudflare Tunnel",
|
|
640
|
+
kind: "tunnel",
|
|
641
|
+
runtime: "cloudflared",
|
|
642
|
+
x: 60,
|
|
643
|
+
y: 160,
|
|
644
|
+
port: 443,
|
|
645
|
+
publicIngress: true,
|
|
646
|
+
replicas: 1,
|
|
647
|
+
cpuLimit: 0.25,
|
|
648
|
+
memoryMb: 128,
|
|
649
|
+
nonRootUser: true,
|
|
650
|
+
readOnlyRootFs: true,
|
|
651
|
+
envVars: [{ key: "TUNNEL_TOKEN", value: "${VAULT:TUNNEL_TOKEN}", isSecret: true }],
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
id: "ms-web",
|
|
655
|
+
name: "fullstack-web",
|
|
656
|
+
label: "Next.js Full-Stack",
|
|
657
|
+
kind: "web",
|
|
658
|
+
runtime: "nextjs",
|
|
659
|
+
x: 380,
|
|
660
|
+
y: 160,
|
|
661
|
+
port: 3000,
|
|
662
|
+
publicIngress: true,
|
|
663
|
+
replicas: 1,
|
|
664
|
+
cpuLimit: 0.5,
|
|
665
|
+
memoryMb: 512,
|
|
666
|
+
gitRepoUrl: "https://github.com/vercel/next-learn",
|
|
667
|
+
gitBranch: "main",
|
|
668
|
+
healthcheckPath: "/api/v1/health",
|
|
669
|
+
nonRootUser: true,
|
|
670
|
+
readOnlyRootFs: false,
|
|
671
|
+
envVars: [
|
|
672
|
+
{ key: "NODE_ENV", value: "production", isSecret: false },
|
|
673
|
+
{
|
|
674
|
+
key: "DATABASE_URL",
|
|
675
|
+
value: "postgresql://adityum:${POSTGRES_PASSWORD}@app-db:5432/app?sslmode=require",
|
|
676
|
+
isSecret: true,
|
|
677
|
+
fromServiceId: "ms-db",
|
|
678
|
+
},
|
|
679
|
+
],
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
id: "ms-db",
|
|
683
|
+
name: "app-db",
|
|
684
|
+
label: "PostgreSQL 16",
|
|
685
|
+
kind: "postgres",
|
|
686
|
+
runtime: "postgres16",
|
|
687
|
+
x: 700,
|
|
688
|
+
y: 160,
|
|
689
|
+
port: 5432,
|
|
690
|
+
publicIngress: false,
|
|
691
|
+
replicas: 1,
|
|
692
|
+
cpuLimit: 0.5,
|
|
693
|
+
memoryMb: 512,
|
|
694
|
+
volumePath: "/var/lib/postgresql/data",
|
|
695
|
+
nonRootUser: true,
|
|
696
|
+
readOnlyRootFs: false,
|
|
697
|
+
envVars: [
|
|
698
|
+
{ key: "POSTGRES_DB", value: "app", isSecret: false },
|
|
699
|
+
{ key: "POSTGRES_USER", value: "adityum", isSecret: false },
|
|
700
|
+
{ key: "POSTGRES_PASSWORD", value: "${VAULT:POSTGRES_PASSWORD}", isSecret: true },
|
|
701
|
+
],
|
|
702
|
+
},
|
|
703
|
+
];
|
|
704
|
+
const edges = [
|
|
705
|
+
{ id: "me-1", sourceId: "ms-tunnel", targetId: "ms-web", protocol: "https", label: "HTTPS Edge", encrypted: true },
|
|
706
|
+
{ id: "me-2", sourceId: "ms-web", targetId: "ms-db", protocol: "postgres-tls", label: "PG TLS :5432", encrypted: true },
|
|
707
|
+
];
|
|
708
|
+
return {
|
|
709
|
+
id: "bp-minimal-starter",
|
|
710
|
+
name: "minimal-byoc-starter",
|
|
711
|
+
description: "Fastest path to sovereign deployment on a single ₹450/mo VPS with 0% Adityum compute markup.",
|
|
712
|
+
region: "blr1",
|
|
713
|
+
complianceProfile: "standard",
|
|
714
|
+
domain: "starter.your-domain.dev",
|
|
715
|
+
nodes,
|
|
716
|
+
edges,
|
|
717
|
+
updatedAt: new Date().toISOString(),
|
|
718
|
+
};
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
];
|
|
722
|
+
export function getDefaultStudioTopology() {
|
|
723
|
+
return STUDIO_BLUEPRINTS[0].create();
|
|
724
|
+
}
|