Adding Templates
React / Vue frontends and Python / Java backends are currently supported. Adding a framework requires changing both the template and the generator logic.
-
Create the template directory
终端窗口 mkdir -p templates/frontend-svelteBuild a complete project inside it with features equivalent to the existing templates, taking care to follow the established conventions of
templates/. -
Update the type definitions
Extend the union types in
src/generator.ts:export type FrontendType = 'react' | 'vue' | 'svelte';export type BackendType = 'python' | 'java'; -
Update the interactive options
Add the new option to
select()insrc/index.ts:{ value: 'svelte', label: 'Svelte' } -
Update the generation logic
Check the branches in
src/generator.tsthat depend on the template name:generateDevSh(): the new framework’s start command and dependency installation.generateBuildSh(): the new framework’s build/check command.generateDockerfile(): the new stack’s multi-stage build image.generateReadme(): the stack table and explanations.
-
Sync the documentation
When changing features, update in sync:
- The root
README.md AGENTS.md(conventions and business rules)generateReadme()(the README shipped with generated projects)- The corresponding page of this documentation site
- The root
-
Verify
Run the scaffold to generate a project with the new combination, then complete the build and startup verification.