A modern CLI tool for scaffolding JavaScript/TypeScript projects with best practices built-in.
Stacksmith helps you bootstrap new projects with sensible defaults and modern tooling, so you can focus on building instead of configuring.
- π― Interactive CLI - Guided prompts for project setup
- β‘οΈ React + Vite - Fast development with HMR
- π¦ Smart Defaults - TypeScript, Biome, Vitest pre-configured
- π§ Flexible - Choose JavaScript or TypeScript
- π¨ Feature Selection - Add only what you need
- π Well Tested - 95%+ code coverage with comprehensive test suite
# Run directly with npm/pnpm/yarn
npx stacksmith create my-app
# Or install globally
npm install -g stacksmith
stacksmith create my-appSimply run stacksmith create and follow the prompts:
stacksmith createYou'll be asked to configure:
- Project name - Validated against npm package rules
- Template - React App (more coming soon)
- Language - TypeScript (default) or JavaScript
- Package Manager - pnpm (default), npm, or yarn
- Features - Vitest, Biome, VSCode config, and more
Pass options to skip prompts:
stacksmith create my-app \
--template react-app \
--typescript \
--package-manager pnpm \
--features vitest,biome,vscode--template <name>- Project template (currently:react-app)--typescript- Use TypeScript (default)--javascript- Use JavaScript instead--package-manager <pm>- Package manager (pnpm,npm,yarn)--features <list>- Comma-separated feature list--with <flags>- Native adapter flags (e.g.,--with "--template blog --typescript strict")--adapter-command <cmd>- Full native create command to parse--adapter-flags <flags>- Comma-separated adapter-specific flags (key=value,key2=value2). Example:--adapter-flags template=blog,typescript=strictfor Astro;--adapter-flags tailwind=truefor Next.js.--config <path>- Path to config file (default:.stacksmithrcin cwd or home directory)--dry-run- Preview configuration and commands without executing
Some official template adapters (e.g. Next.js, Astro) support additional flags beyond Stacksmith's core options. Use --adapter-flags to pass them through directly. These are forwarded to the underlying create-* command.
Conflict Handling:
- If you specify a language flag via adapter (e.g.
javascript=true) that conflicts with the CLI choice (--typescript), Stacksmith will warn and ask for confirmation (interactive mode) or ignore the conflicting adapter flag (non-interactive mode). - Accepted boolean forms:
flag=trueadds--flag;flag=falseskips adding it. Any other value is passed as--flag <value>.
Examples:
# Astro strict TypeScript mode and custom template (using --with for clean syntax)
stacksmith create my-site --template astro-app --with "--template blog --typescript strict"
# Next.js with Tailwind override (forcing inclusion even if not in feature list)
stacksmith create my-app --template next-app --with "--tailwind"
# Or use full native command (infers template and project name)
stacksmith create --adapter-command "npm create astro@latest my-site -- --template blog --typescript strict"
# Legacy key=value syntax still supported
stacksmith create my-site --template astro-app --adapter-flags template=blog,typescript=strictStacksmith can auto-detect native create commands without requiring --adapter-command:
# Simply paste the native command as the first argument
stacksmith create npm create astro@latest my-site -- --template blog --typescript strict
# Works with any package manager
stacksmith create pnpm create next-app my-app --typescript --tailwind
stacksmith create yarn create astro my-site -- --template minimal
stacksmith create npx create-next-app@latest my-appThe command is auto-detected if it:
- Starts with a package manager (
npm,pnpm,yarn,npx) - Contains
"create" - Contains a known template (
astro,next)
Preview what would be executed without creating any files:
# See what would happen before committing
stacksmith create my-app --template next-app --with "--tailwind" --dry-run
# Output shows:
# - Parsed configuration
# - Adapter flags that would be passed
# - Conflicts detected and how they'd be resolved
# - Final command that would executeDry run is useful for:
- Debugging flag parsing and precedence
- Understanding conflict resolution
- Verifying adapter command construction
- Testing configurations before execution
Create a .stacksmithrc file to set default preferences and avoid typing the same options repeatedly:
Local config (.stacksmithrc in project directory):
{
"template": "react-app",
"language": "typescript",
"packageManager": "pnpm",
"features": ["vitest", "biome", "tailwind", "vscode"],
"adapterFlags": {
"template": "minimal"
}
}Home config (~/.stacksmithrc):
{
"packageManager": "pnpm",
"language": "typescript",
"features": ["vitest", "biome"]
}Usage:
# Uses config file defaults, only prompts for missing fields
stacksmith create my-app
# CLI flags override config file values
stacksmith create my-app --template next-app --features storybook,playwright
# Specify custom config location
stacksmith create my-app --config ./my-config.jsonPrecedence (highest to lowest):
- CLI flags (
--template,--features, etc.) - Explicit config file (
--config path/to/config.json) - Local
.stacksmithrc(in current directory) - Home
.stacksmithrc(~/.stacksmithrc) - Interactive prompts (for missing values)
Supported fields:
template-"react-app","next-app","astro-app","library","monorepo"language-"typescript"or"javascript"packageManager-"pnpm","npm", or"yarn"features- Array of feature namesgit- Boolean to enable/disable git initializationadapterFlags- Object with adapter-specific flags
All fields are optional. Missing fields will be prompted interactively or use CLI defaults.
A modern React application powered by Vite:
- React 18 with TypeScript or JavaScript
- Vite for blazing fast HMR
- Modern React patterns
- Production-ready build configuration
Coming Soon:
- Next.js App
- Library Package
- Monorepo (Turborepo)
Currently supported features you can add to your project:
- β Vitest - Fast unit testing with coverage
- β Biome - Lightning-fast linting and formatting
- β VSCode Config - Settings and recommended extensions
- π§ Playwright - E2E testing (config only)
- π§ Storybook - Component development (config only)
- π§ Tailwind CSS - Utility-first CSS (config only)
- π§ Git Hooks - Pre-commit hooks (config only)
- π§ Commitizen - Conventional commits (config only)
- π§ Changesets - Version management (config only)
- π§ Turbo - Build system (config only)
- π§ Docker - Container setup (config only)
Note: Features marked with π§ generate basic configuration files but may require additional setup.
Want to contribute or modify Stacksmith? Here's how to get started:
# Clone the repository
git clone https://github.com/yourusername/stacksmith.git
cd stacksmith
# Install dependencies (requires pnpm)
pnpm install
# Build the project
pnpm build
# Link for local testing
pnpm link --global
# Run tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Lint and format
pnpm lintstacksmith/
βββ src/
β βββ cli.ts # CLI entry point
β βββ commands/ # Command implementations
β β βββ create.ts # Create command with prompts
β βββ generators/ # Project generators
β β βββ project.ts # Main project generator
β β βββ features.ts # Feature file generators
β βββ git.ts # Git initialization
β βββ project-config.ts # Configuration builder
β βββ validation.ts # Input validation
β βββ types.ts # TypeScript types
βββ test/ # Comprehensive test suite
β βββ validation.test.ts
β βββ project-config.test.ts
β βββ git-init.test.ts
β βββ integration.test.ts
β βββ cli-prompts.test.ts
β βββ cli.test.ts
β βββ bootstrap-validation.test.ts
βββ docs/ # Additional documentation
See CONTRIBUTING.md for detailed contribution guidelines.
- Contributing Guide - How to contribute to Stacksmith
- Architecture - Technical design and decisions
- Prompts Guide - Detailed CLI prompt specifications
- β React + Vite template
- β TypeScript/JavaScript support
- β Interactive CLI with validation
- β Basic feature generation (Vitest, Biome, VSCode)
- β Git initialization
- Complete feature implementations (Playwright, Storybook, Tailwind)
- Next.js template
- Library template
-
stacksmith addcommand for existing projects
- Monorepo template with Turborepo
- CI/CD workflow generation
- Plugin system for custom templates
- Config file support for reproducible setups
Contributions are welcome! Please read our Contributing Guide to get started.
- Test-Driven Development - All features have comprehensive tests
- Type Safety - Full TypeScript with strict mode
- User Experience - Clear prompts, helpful errors, great defaults
- Extensibility - Easy to add new templates and features
MIT License - see LICENSE for details
Built with:
- Commander.js - CLI framework
- Inquirer.js - Interactive prompts
- Vite - Build tool
- Biome - Linter and formatter
- Vitest - Testing framework
Developed with AI assistance as a productivity multiplier. All architectural decisions, testing strategies, and code validation done by humans.
Made with β€οΈ for the JavaScript community