Heco Feature Gen
A pluggable, config-driven CLI tool that generates feature-based project structures with boilerplate code

About the Project
⚓︎Introduction
@heco-gen/features is a feature scaffolding CLI that generates consistent, feature-based folder structures with production-ready boilerplate code. Define your folder layout, templates, and naming conventions once — then generate consistently across your entire project.
Built for modern web stacks: React, TypeScript, TanStack Query, Zustand, and Zod. The tool supports custom generators, pluggable template engines (Handlebars built-in, EJS optional), and multiple file writing modes (skip, overwrite, ask, dry-run).
- Documentation: heco-feature-gen.vercel.app
- NPM Package: @heco-gen/features
- Source Code: GitHub Repository
⚓︎🚀 Key Features
Feature Scaffolding
Generate an entire feature directory with a single command:
npx heco generate user-profileThis creates src/features/user-profile/ with components, hooks, services, types, validation schemas, and a Zustand store — all pre-wired and ready to use.
Config-Driven Architecture
All folder names, paths, generators, and naming conventions are defined in a single hfg.config.json file. Customize every aspect of the output without touching the source code:
- Rename folder types (e.g.,
components→ui) - Change base output path
- Define custom generators for project-specific file structures
Custom Generators
Define your own file structures beyond the built-in feature generator:
- Component-only generators
- API route generators for Next.js
- Test file generators
- Full Next.js page generators with layout, hooks, and types
Template Engine
Handlebars built-in with support for naming variables ({{PascalName}}, {{camelName}}, {{snakeName}}, {{upperName}}). Optionally use EJS by registering the engine programmatically.
Safe File Writing
Multiple write modes to fit your workflow:
- Skip — never overwrite existing files (default)
- Overwrite — replace existing files
- Ask — prompt for each file
- Dry-run — preview without writing
Programmatic API
Use the generator directly in Node.js scripts:
import { generateFeature } from "@heco-gen/features";
await generateFeature("user-profile", { all: true });⚓︎💻 Technology Stack
- Runtime: Node.js 18+
- Language: TypeScript
- CLI Framework: Commander
- Template Engine: Handlebars (built-in), EJS (optional)
- Validation: Zod
- Format: Dual CJS/ESM with TypeScript declarations
Happy Coding! 🎉
