import type { StackSelectionState } from "@/stack/stack-translation"; import { PRESET_ALIASES, type PresetId } from "@/catalog/preset-ids"; import { STARTER_TRACK_DEFINITIONS } from "@/stack/starter-tracks"; type PresetStack = Partial; export type PresetOptionChoice = { id: string; name: string; description: string; stack: PresetStack; }; export const PRESET_OPTION_IDS = ["framework", "effect"] as const; export type PresetOptionId = (typeof PRESET_OPTION_IDS)[number]; export type PresetOption = { id: PresetOptionId; name: string; choices: readonly [PresetOptionChoice, ...PresetOptionChoice[]]; }; export type PresetDefinition = { id: PresetId; name: string; description: string; category: PresetCategoryId; stack: PresetStack; options?: readonly PresetOption[]; }; export const PRESET_CATEGORIES = [ { id: "future", name: "Future Stack", icon: "solid", ecosystem: "typescript" }, { id: "next", name: "Next.js", icon: "next", ecosystem: "typescript" }, { id: "react", name: "React", icon: "react-router", ecosystem: "typescript" }, { id: "tanstack", name: "TanStack", icon: "tanstack-start", ecosystem: "typescript" }, { id: "svelte", name: "Svelte", icon: "svelte", ecosystem: "typescript" }, { id: "nuxt", name: "Vue / Nuxt", icon: "nuxt", ecosystem: "typescript" }, { id: "astro", name: "Astro", icon: "astro", ecosystem: "typescript" }, { id: "angular", name: "Angular", icon: "angular", ecosystem: "typescript" }, { id: "qwik", name: "Qwik", icon: "qwik", ecosystem: "typescript" }, { id: "mobile", name: "Mobile", icon: "native-uniwind", ecosystem: "react-native" }, { id: "ai-tools", name: "AI Tools", icon: "ai-cli", ecosystem: "typescript" }, { id: "examples", name: "Examples", icon: "vercel-ai", ecosystem: "typescript" }, { id: "rust", name: "Rust", icon: "", ecosystem: "rust" }, { id: "python", name: "Python", icon: "fastapi", ecosystem: "python" }, { id: "go", name: "Go", icon: "gin", ecosystem: "go" }, { id: "java", name: "Java", icon: "java", ecosystem: "java" }, { id: "elixir", name: "Elixir", icon: "phoenix", ecosystem: "elixir" }, { id: "dotnet", name: ".NET", icon: "dotnet", ecosystem: "dotnet" }, ] as const; export type PresetCategoryId = (typeof PRESET_CATEGORIES)[number]["id"]; const STARTER_TRACK_SELECTION_BY_PRESET = new Map( STARTER_TRACK_DEFINITIONS.map((track) => [track.presetId, track.selection]), ); function starterTrackSelection(presetId: string): StackSelectionState { const selection = STARTER_TRACK_SELECTION_BY_PRESET.get(presetId); if (!selection) throw new Error(`Missing starter track selection for preset '${presetId}'.`); return selection; } // Example apps are only reachable through these presets; the builder has no Examples section. const EXAMPLE_BASE: PresetStack = { database: "none", orm: "none", dbSetup: "none", auth: "none", cssFramework: "tailwind", }; export const PRESET_DEFINITIONS: readonly PresetDefinition[] = [ { id: "future-stack", name: "Future Stack", description: "Solid + Effect + the TanStack libraries, with oRPC, Drizzle, SQLite and Better Auth, plus a working showcase", category: "future", stack: { projectName: "my-app", webFrontend: ["solid-start"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "none", runtime: "none", backend: "self-solid-start", database: "sqlite", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "effect-full", validation: "effect-schema", stateManagement: "tanstack-store", forms: "tanstack-form", codeQuality: ["biome"], documentation: [], appPlatforms: [ "turborepo", "tanstack-query", "tanstack-table", "tanstack-virtual", "tanstack-db", "tanstack-pacer", ], packageManager: "bun", examples: ["tanstack-showcase"], git: "true", install: "true", api: "orpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, options: [ { id: "framework", name: "Framework", choices: [ { id: "solid-start", name: "SolidStart", description: "SolidStart 2 with file routes and its own server", stack: { webFrontend: ["solid-start"], backend: "self-solid-start" }, }, { id: "tanstack-start", name: "TanStack Start", description: "TanStack Start on Solid with TanStack Router", stack: { webFrontend: ["tanstack-start-solid"], backend: "self-tanstack-start-solid" }, }, ], }, { id: "effect", name: "Effect", choices: [ { id: "app", name: "In the app", description: "oRPC handlers run as Effect programs inside the framework server", stack: {}, }, { id: "server", name: "Separate server", description: "A standalone Effect server on Bun serves the API", stack: { backend: "effect", runtime: "bun" }, }, ], }, ], }, { id: "t3", name: "T3 Stack", description: "Next.js + tRPC + Prisma + PostgreSQL + Better Auth", category: "next", stack: { projectName: "my-app", webFrontend: ["next"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "none", backend: "self-next", database: "postgres", orm: "prisma", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: ["biome"], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "trpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "nextjs-saas", name: "Next.js SaaS", description: "Next.js + Stripe + Drizzle + PostgreSQL + Auth + React Email", category: "next", stack: starterTrackSelection("nextjs-saas"), }, { id: "nextjs-minimal", name: "Next.js Minimal", description: "Next.js + Tailwind + shadcn/ui - no database or backend", category: "next", stack: { projectName: "my-app", webFrontend: ["next"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "none", backend: "self-next", database: "none", orm: "none", dbSetup: "none", auth: "none", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "none", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "mern", name: "MERN Stack", description: "MongoDB + Express + React Router + Node.js", category: "react", stack: { projectName: "my-app", webFrontend: ["react-router"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "node", backend: "express", database: "mongodb", orm: "mongoose", dbSetup: "mongodb-atlas", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "orpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "pern", name: "PERN Stack", description: "PostgreSQL + Express + TanStack Router + Node.js", category: "react", stack: { projectName: "my-app", webFrontend: ["tanstack-router"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "node", backend: "express", database: "postgres", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "trpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "tanstack-start", name: "TanStack Start", description: "TanStack Start fullstack + tRPC + Drizzle + SQLite", category: "tanstack", stack: { projectName: "my-app", webFrontend: ["tanstack-start"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "none", backend: "self-tanstack-start", database: "sqlite", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "trpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "tanstack-hono", name: "TanStack + Hono", description: "TanStack Router + Hono + tRPC + Drizzle + PostgreSQL", category: "tanstack", stack: starterTrackSelection("tanstack-hono"), }, { id: "sveltekit-fullstack", name: "SvelteKit Fullstack", description: "SvelteKit + oRPC + Drizzle + SQLite + Better Auth", category: "svelte", stack: { projectName: "my-app", webFrontend: ["svelte"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "none", runtime: "none", backend: "self-svelte", database: "sqlite", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "orpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "nuxt-fullstack", name: "Nuxt Fullstack", description: "Nuxt + oRPC + Prisma + PostgreSQL + Better Auth", category: "nuxt", stack: { projectName: "my-app", webFrontend: ["nuxt"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "none", runtime: "none", backend: "self-nuxt", database: "postgres", orm: "prisma", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "orpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "astro-fullstack", name: "Fullstack Astro", description: "Astro with React using built-in API routes (fullstack mode)", category: "astro", stack: { projectName: "my-app", webFrontend: ["astro"], nativeFrontend: ["none"], astroIntegration: "react", cssFramework: "tailwind", uiLibrary: "daisyui", runtime: "none", backend: "self-astro", database: "sqlite", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "trpc", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "tanstack-fullstack", name: "TanStack Fullstack", description: "Full TanStack ecosystem: Start + oRPC + Query + Store + Form + Table + Virtual + Pacer + AI (with Showcase)", category: "tanstack", stack: { projectName: "my-app", webFrontend: ["tanstack-start"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "shadcn-ui", runtime: "none", backend: "self-tanstack-start", database: "postgres", orm: "drizzle", dbSetup: "none", auth: "better-auth", payments: "none", email: "none", backendLibraries: "none", stateManagement: "tanstack-store", forms: "tanstack-form", codeQuality: ["biome"], documentation: [], appPlatforms: [ "turborepo", "tanstack-table", "tanstack-virtual", "tanstack-query", "tanstack-pacer", ], packageManager: "bun", examples: ["tanstack-showcase"], git: "true", install: "true", api: "orpc", aiSdk: "tanstack-ai", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "angular-express", name: "Angular + Express", description: "Angular + Express + Prisma + PostgreSQL", category: "angular", stack: { projectName: "my-app", webFrontend: ["angular"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "none", runtime: "node", backend: "express", database: "postgres", orm: "prisma", dbSetup: "none", auth: "none", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "none", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "qwik-city", name: "Qwik City", description: "Qwik with built-in server + Tailwind", category: "qwik", stack: { projectName: "my-app", webFrontend: ["qwik"], nativeFrontend: ["none"], astroIntegration: "none", cssFramework: "tailwind", uiLibrary: "none", runtime: "none", backend: "none", database: "none", orm: "none", dbSetup: "none", auth: "none", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: ["turborepo"], packageManager: "bun", examples: [], git: "true", install: "true", api: "none", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "uniwind", name: "Uniwind Native", description: "Expo + Uniwind native app with no backend", category: "mobile", stack: starterTrackSelection("uniwind"), }, { id: "expo-bare", name: "Expo Bare", description: "Expo with bare workflow - no backend", category: "mobile", stack: { ecosystem: "react-native", projectName: "my-app", webFrontend: ["none"], nativeFrontend: ["native-bare"], astroIntegration: "none", cssFramework: "none", uiLibrary: "none", runtime: "none", backend: "none", database: "none", orm: "none", dbSetup: "none", auth: "none", payments: "none", email: "none", backendLibraries: "none", stateManagement: "none", codeQuality: [], documentation: [], appPlatforms: [], packageManager: "bun", examples: [], git: "true", install: "true", api: "none", webDeploy: "none", serverDeploy: "none", yolo: "false", }, }, { id: "ai-cli-agent-workbench", name: "AI CLI Agent Workbench", description: "Next.js + AI CLI + MCP + Skills + Ruler + complete AI docs", category: "ai-tools", stack: starterTrackSelection("ai-cli-agent-workbench"), }, { id: "rust-fullstack", name: "Rust Fullstack", description: "Axum + Leptos + SeaORM - full-stack Rust with SSR", category: "rust", stack: { ecosystem: "rust", projectName: "my-app", rustWebFramework: "axum", rustFrontend: "leptos", rustOrm: "sea-orm", rustApi: "none", rustCli: "none", rustLibraries: [], aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "rust-api", name: "Rust API", description: "Axum + SeaORM - backend REST API, no frontend", category: "rust", stack: starterTrackSelection("rust-api"), }, { id: "rust-grpc", name: "Rust gRPC", description: "Axum + Tonic + SQLx - gRPC microservice", category: "rust", stack: { ecosystem: "rust", projectName: "my-app", rustWebFramework: "axum", rustFrontend: "none", rustOrm: "sqlx", rustApi: "tonic", rustCli: "none", rustLibraries: [], aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "rust-cli", name: "Rust CLI", description: "Clap + Ratatui - terminal UI application", category: "rust", stack: { ecosystem: "rust", projectName: "my-app", rustWebFramework: "none", rustFrontend: "none", rustOrm: "none", rustApi: "none", rustCli: "ratatui", rustLibraries: [], aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "python-fastapi", name: "FastAPI", description: "FastAPI + SQLAlchemy + Pydantic + Ruff", category: "python", stack: starterTrackSelection("python-fastapi"), }, { id: "python-django", name: "Django", description: "Django + SQLAlchemy + Pydantic + Ruff", category: "python", stack: { ecosystem: "python", projectName: "my-app", pythonWebFramework: "django", pythonOrm: "sqlalchemy", pythonValidation: "pydantic", pythonAi: [], pythonAuth: "none", pythonApi: "django-rest-framework", pythonTaskQueue: "none", pythonGraphql: "none", pythonQuality: "ruff", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "python-ai-agent", name: "AI Agent", description: "FastAPI + LangChain + Pydantic - AI-powered API", category: "python", stack: { ecosystem: "python", projectName: "my-app", pythonWebFramework: "fastapi", pythonOrm: "sqlmodel", pythonValidation: "pydantic", pythonAi: ["langchain"], pythonAuth: "none", pythonApi: "none", pythonTaskQueue: "none", pythonGraphql: "none", pythonQuality: "ruff", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "python-ai-anthropic", name: "AI Agent (Anthropic)", description: "FastAPI + Anthropic SDK + Pydantic - Claude-powered API", category: "python", stack: { ecosystem: "python", projectName: "my-app", pythonWebFramework: "fastapi", pythonOrm: "sqlmodel", pythonValidation: "pydantic", pythonAi: ["anthropic-sdk"], pythonAuth: "none", pythonApi: "none", pythonTaskQueue: "none", pythonGraphql: "none", pythonQuality: "ruff", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "go-gin", name: "Go API (Gin)", description: "Gin + GORM + Zap - REST API with structured logging", category: "go", stack: { ecosystem: "go", projectName: "my-app", goWebFramework: "gin", goOrm: "gorm", goApi: "none", goCli: "none", goLogging: "zap", goAuth: "none", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "go-echo", name: "Go API (Echo)", description: "Echo + SQLC + Zap - type-safe SQL with Echo", category: "go", stack: { ecosystem: "go", projectName: "my-app", goWebFramework: "echo", goOrm: "sqlc", goApi: "none", goCli: "none", goLogging: "zap", goAuth: "none", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "go-grpc", name: "Go gRPC", description: "Gin + gRPC-Go + GORM + Zap - gRPC microservice", category: "go", stack: { ecosystem: "go", projectName: "my-app", goWebFramework: "gin", goOrm: "gorm", goApi: "grpc-go", goCli: "none", goLogging: "zap", goAuth: "none", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "go-cli", name: "Go CLI", description: "Cobra + Bubbletea - interactive terminal application", category: "go", stack: { ecosystem: "go", projectName: "my-app", goWebFramework: "none", goOrm: "none", goApi: "none", goCli: "bubbletea", goLogging: "none", goAuth: "none", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "java-spring", name: "Spring Boot API", description: "Spring Boot + Maven + JUnit 5", category: "java", stack: { ecosystem: "java", projectName: "my-app", javaWebFramework: "spring-boot", javaBuildTool: "maven", javaOrm: "none", javaAuth: "none", javaLibraries: [], javaTestingLibraries: ["junit5"], aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "java-jpa", name: "Spring Data JPA", description: "Spring Boot + Spring Data JPA + JUnit 5", category: "java", stack: { ecosystem: "java", projectName: "my-app", javaWebFramework: "spring-boot", javaBuildTool: "maven", javaOrm: "spring-data-jpa", javaAuth: "none", javaLibraries: ["flyway", "spring-validation"], javaTestingLibraries: ["junit5", "mockito"], aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "java-secure", name: "Secure Spring Boot", description: "Spring Boot + Spring Security + JPA + Testcontainers", category: "java", stack: starterTrackSelection("java-secure"), }, { id: "dotnet-minimal-api", name: ".NET Minimal API", description: "ASP.NET Core Minimal APIs + EF Core + SignalR", category: "dotnet", stack: { ecosystem: "dotnet", projectName: "my-app", dotnetWebFramework: "aspnet-minimal", dotnetOrm: "ef-core", dotnetAuth: "aspnet-identity", dotnetApi: "minimal-api", dotnetTesting: ["xunit"], dotnetJobQueue: "none", dotnetRealtime: "signalr", dotnetObservability: ["serilog"], dotnetCaching: "none", dotnetDeploy: "docker", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "dotnet-graphql", name: ".NET GraphQL", description: "ASP.NET Core + Hot Chocolate + EF Core", category: "dotnet", stack: { ecosystem: "dotnet", projectName: "my-app", dotnetWebFramework: "aspnet-minimal", dotnetOrm: "ef-core", dotnetAuth: "none", dotnetApi: "graphql-hotchocolate", dotnetTesting: ["xunit", "testcontainers-dotnet"], dotnetJobQueue: "none", dotnetRealtime: "none", dotnetObservability: ["serilog", "health-checks"], dotnetCaching: "none", dotnetDeploy: "docker", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "dotnet-worker", name: ".NET Worker", description: "ASP.NET Core hosted services + Quartz.NET", category: "dotnet", stack: { ecosystem: "dotnet", projectName: "my-app", dotnetWebFramework: "aspnet-minimal", dotnetOrm: "none", dotnetAuth: "none", dotnetApi: "none", dotnetTesting: ["xunit"], dotnetJobQueue: "quartz-net", dotnetRealtime: "none", dotnetObservability: ["serilog", "opentelemetry-dotnet"], dotnetCaching: "memory-cache", dotnetDeploy: "docker", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "elixir-phoenix-api", name: "Phoenix API", description: "Phoenix + Ecto SQL + REST + Channels", category: "elixir", stack: { ecosystem: "elixir", projectName: "my-app", elixirWebFramework: "phoenix", elixirOrm: "ecto-sql", elixirAuth: "none", elixirApi: "rest", elixirRealtime: "channels", elixirJobs: "none", elixirValidation: "ecto-changesets", elixirHttp: "req", elixirJson: "jason", elixirEmail: "none", elixirCaching: "none", elixirObservability: "telemetry", elixirTesting: "ex_unit", elixirQuality: "credo", elixirI18n: "none", elixirHttpServer: "cowboy", elixirApplicationFramework: "none", elixirDocumentation: "none", elixirClustering: "none", elixirLogging: "none", elixirConfig: "none", elixirMessageQueue: "none", elixirTemplating: "none", elixirCli: "none", elixirDeploy: "docker", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "elixir-liveview-full", name: "LiveView Fullstack", description: "Phoenix LiveView + Ecto + Auth + Oban", category: "elixir", stack: { ecosystem: "elixir", projectName: "my-app", elixirWebFramework: "phoenix-live-view", elixirOrm: "ecto-sql", elixirAuth: "phx-gen-auth", elixirApi: "absinthe", elixirRealtime: "presence", elixirJobs: "oban", elixirValidation: "ecto-changesets", elixirHttp: "req", elixirJson: "jason", elixirEmail: "swoosh", elixirCaching: "cachex", elixirObservability: "telemetry", elixirTesting: "ex_unit", elixirQuality: "sobelow", elixirI18n: "none", elixirHttpServer: "cowboy", elixirApplicationFramework: "none", elixirDocumentation: "none", elixirClustering: "none", elixirLogging: "none", elixirConfig: "none", elixirMessageQueue: "none", elixirTemplating: "none", elixirCli: "none", elixirDeploy: "docker", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "elixir-plain-worker", name: "Plain Elixir Worker", description: "Mix app + Quantum + Req - no Phoenix", category: "elixir", stack: { ecosystem: "elixir", projectName: "my-app", elixirWebFramework: "none", elixirOrm: "none", elixirAuth: "none", elixirApi: "none", elixirRealtime: "none", elixirJobs: "quantum", elixirValidation: "none", elixirHttp: "req", elixirJson: "jason", elixirEmail: "none", elixirCaching: "cachex", elixirObservability: "none", elixirTesting: "ex_unit", elixirQuality: "credo", elixirI18n: "none", elixirHttpServer: "none", elixirApplicationFramework: "none", elixirDocumentation: "none", elixirClustering: "none", elixirLogging: "none", elixirConfig: "none", elixirMessageQueue: "none", elixirTemplating: "none", elixirCli: "none", elixirDeploy: "mix-release", aiDocs: ["claude-md"], git: "true", install: "true", }, }, { id: "example-ai-chat", name: "AI Chat Example", description: "Next.js + Vercel AI SDK with a working streaming chat example", category: "examples", stack: { ...EXAMPLE_BASE, webFrontend: ["next"], backend: "self-next", runtime: "none", uiLibrary: "shadcn-ui", aiSdk: "vercel-ai", examples: ["ai"], }, }, { id: "example-slack-bot", name: "Slack Bot Example", description: "Next.js + Chat SDK with a Slack bot example", category: "examples", stack: { ...EXAMPLE_BASE, webFrontend: ["next"], backend: "self-next", runtime: "none", uiLibrary: "shadcn-ui", examples: ["chat-sdk"], }, }, { id: "example-discord-bot", name: "Discord Bot Example", description: "Nuxt + Chat SDK + Vercel AI SDK with a Discord bot example", category: "examples", stack: { ...EXAMPLE_BASE, webFrontend: ["nuxt"], backend: "self-nuxt", runtime: "none", uiLibrary: "none", api: "orpc", aiSdk: "vercel-ai", examples: ["chat-sdk"], }, }, { id: "example-github-review-bot", name: "GitHub Review Bot Example", description: "Hono on Node + Chat SDK + Vercel AI SDK with a GitHub review bot example", category: "examples", stack: { ...EXAMPLE_BASE, backend: "hono", runtime: "node", aiSdk: "vercel-ai", examples: ["chat-sdk"], }, }, ]; export type PresetOptionSelection = Readonly>>; export function resolvePresetId(id: string): PresetId | undefined { const target = (PRESET_ALIASES as Record)[id] ?? id; return PRESET_DEFINITIONS.find((preset) => preset.id === target)?.id; } export function getPreset(id: string): PresetDefinition | undefined { const resolved = resolvePresetId(id); return PRESET_DEFINITIONS.find((preset) => preset.id === resolved); } export function validatePresetOptions( preset: PresetDefinition, selection: PresetOptionSelection, ): string | null { for (const [optionId, choiceId] of Object.entries(selection) as [string, string | undefined][]) { if (choiceId === undefined) continue; const option = preset.options?.find((candidate) => candidate.id === optionId); if (!option) return `Preset '${preset.id}' has no '${optionId}' option.`; if (!option.choices.some((choice) => choice.id === choiceId)) { const valid = option.choices.map((choice) => choice.id).join(", "); return `Unknown ${optionId} '${choiceId}' for preset '${preset.id}'. Choose one of: ${valid}.`; } } return null; } export function applyPresetOptions( preset: PresetDefinition, selection: PresetOptionSelection = {}, ): PresetStack { const error = validatePresetOptions(preset, selection); if (error) throw new Error(error); const stack: PresetStack = { ecosystem: getPresetEcosystem(preset), ...preset.stack }; for (const option of preset.options ?? []) { const choice = option.choices.find((candidate) => candidate.id === selection[option.id]) ?? option.choices[0]; Object.assign(stack, choice.stack); } return stack; } export function getPresetEcosystem(preset: PresetDefinition) { return ( PRESET_CATEGORIES.find((category) => category.id === preset.category)?.ecosystem ?? "typescript" ); } export function getPresetVariants(preset: PresetDefinition): PresetOptionSelection[] { return (preset.options ?? []).reduce( (variants, option) => variants.flatMap((variant) => option.choices.map((choice) => ({ ...variant, [option.id]: choice.id })), ), [{}], ); }