Scaffold-Gen
English | 简体中文
A modern, extensible scaffolding generator for creating project templates across multiple frameworks and programming languages.
Features
- 🚀 Modern Architecture: Clean, modular design based on Rust traits
- 🏗️ Three-Layer Generator Architecture: Project, Language, and Framework level generation
- 🔌 Unified Generator Interface: Consistent API across all framework generators
- ⚡ Post-Processing Pipeline: Extensible hooks for custom project setup
- 💻 Interactive CLI: User-friendly prompts for project configuration
- ✅ Environment Validation: Automatic checking of required tools and dependencies
Supported Frameworks
| Language | Framework | Status |
|---|---|---|
| Go | Gin | ✅ |
| Go | Go-Zero | ✅ |
| Rust | CLI App | ✅ |
| Rust | Tauri | ✅ |
| TypeScript | Vue 3 | ✅ |
| TypeScript | React | ✅ |
| Python | Basic | ✅ |
Installation
From crates.io
From Source
Pre-built Binaries
Download pre-built binaries from the Releases page.
Quick Start
Interactive Mode (Recommended)
The CLI will guide you through:
- Language selection (Go, Rust, TypeScript, Python)
- Framework selection (Gin, Go-Zero, Tauri, Vue3, React, etc.)
- Project configuration (host, port, features)
- License selection
Direct Framework Specification
# Create a Gin project
# Create a Go-Zero project
# Create a Tauri project
# Create a Vue3 project
# Create a React project
Architecture
Three-Layer Generator Architecture
┌─────────────────────────────────────────┐
│ GeneratorOrchestrator │
│ (Coordinates all generators) │
└─────────────────┬───────────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌────────┐ ┌──────────┐ ┌───────────┐
│ Project │ │ Language │ │ Framework │
│Generator│ │Generator │ │ Generator │
└────────┘ └──────────┘ └───────────┘
│ │ │
▼ ▼ ▼
LICENSE Go/Rust/ Gin/Tauri/
Git/README Python/TS Vue3/React
1. Project Generator
Handles common project files:
- LICENSE file generation
- Git repository initialization
- Pre-commit hooks installation
- README file generation
2. Language Generator
Sets up language-specific environment:
- GoGenerator: Go module initialization, dependency management
- RustGenerator: Cargo project initialization
- PythonGenerator: Python project structure
- TypeScriptGenerator: Node.js/npm configuration
3. Framework Generator
Generates framework-specific code structure:
- GinGenerator: Gin web framework project structure
- GoZeroGenerator: Go-Zero microservice framework structure
- TauriGenerator: Tauri desktop application structure
- Vue3Generator: Vue 3 frontend project structure
- ReactGenerator: React frontend project structure
Template System
The generator uses a hierarchical template system:
templates/
├── frameworks/ # Framework-specific templates
│ ├── go/
│ │ ├── gin/ # Gin framework templates
│ │ └── go-zero/ # Go-Zero framework templates
│ ├── rust/
│ │ └── tauri/ # Tauri framework templates
│ └── typescript/
│ ├── vue3/ # Vue 3 framework templates
│ └── react/ # React framework templates
├── languages/ # Language-specific templates
│ ├── go/
│ ├── rust/
│ ├── python/
│ └── typescript/
└── licenses/ # License templates
├── MIT.tmpl
├── Apache-2.0.tmpl
└── GPL-3.0.tmpl
Template Variables
Common Variables
{{project_name}}- Project name{{author}}- Project author{{license}}- License type{{year}}- Current year
Framework-Specific Variables
{{host}}- Server host (default: localhost){{port}}- HTTP port (default: 8080){{grpc_port}}- gRPC port (Go-Zero specific){{enable_swagger}}- Enable Swagger documentation{{enable_database}}- Enable database support
Development
Build Commands
# Debug build
# Release build
# Run tests
# Run linter
# Format code
# Run all CI checks
Project Structure
src/
├── commands/ # CLI command implementations
├── generators/ # Generator modules
│ ├── core/ # Core generator traits and utilities
│ ├── project/ # Project-level generator
│ ├── language/ # Language-level generators
│ ├── framework/ # Framework-level generators
│ └── orchestrator.rs # Generator orchestrator
├── scaffold.rs # Core scaffolding system
├── template_engine.rs # Template processing engine
└── utils/ # Utility modules
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.