# jondot/hygen

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/jondot-hygen).**

5,935 stars · 273 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/jondot/hygen
- Homepage: http://www.hygen.io
- awesome-repositories: https://awesome-repositories.com/repository/jondot-hygen.md

## Topics

`cli` `generator` `nodejs` `tools`

## Description

Hygen is a code generator CLI and interactive template engine that scaffolds new files and injects code into existing ones using project-local templates. It operates as a Node.js code generator library that can be embedded inside custom binaries for tailored workflows, and also functions as a project scaffolding tool for bootstrapping new projects or folders from remote template repositories.

The tool discovers templates by scanning a project's `_templates` directory at runtime, mapping folder and file names directly to generator commands and actions. It collects user input through interactive prompts before rendering, then passes answers as template variables using EJS templating. Each generator runs as a sequence of discrete file operations—add, inject, append—with independent template rendering, and a duplicate-injection guard prevents repeated code insertion by tracking injection markers within target files.

Hygen supports injecting template content into existing files at specified locations while preventing duplicate injections, and can clone a Git repository into a temporary directory to copy its template structure into the local `_templates` folder. The core generation logic is exposed as a library that can be required and invoked programmatically from custom scripts.

## Tags

### Programming Languages & Runtimes

- [Project-Local Template Generators](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-generators/specification-from-code-generators/natural-language-code-generators/template-based-code-generators/project-local-template-generators.md) — Scaffolding new files and injecting code into existing ones using project-local templates and a fast command-line interface.
- [Code Generators](https://awesome-repositories.com/f/programming-languages-runtimes/node-js-network-libraries/node-js-assertion-libraries/code-generators.md) — Embedding the generation engine as a library inside custom Node.js binaries for tailored workflows.

### Business & Productivity Software

- [Prompt-Driven Template Engines](https://awesome-repositories.com/f/business-productivity-software/interactive-template-prompts/prompt-driven-template-engines.md) — Collecting user input through prompts during generation to dynamically fill template variables.

### Development Tools & Productivity

- [Action Execution Pipelines](https://awesome-repositories.com/f/development-tools-productivity/action-execution-pipelines.md) — Runs each generator as a sequence of discrete file operations (add, inject, append) with independent template rendering.
- [Interactive Variable Prompts](https://awesome-repositories.com/f/development-tools-productivity/dynamic-variable-evaluators/interactive-variable-prompts.md) — Collects user input via interactive prompts before rendering, then passes answers as template locals.
- [Project Scaffolders](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/project-scaffolding-configuration/project-scaffolding/project-scaffolders.md) — Bootstrapping new projects or folders from remote template repositories with a single command.
- [Local Template Scaffolders](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/project-scaffolding-configuration/project-scaffolding/project-scaffolders/local-template-scaffolders.md) — Generate new files from project-local templates using a CLI command that mirrors folder structure. ([source](https://cdn.jsdelivr.net/gh/jondot/hygen@master/README.md))
- [Embeddable Code Generators](https://awesome-repositories.com/f/development-tools-productivity/embeddable-code-generators.md) — Exposes the core generation logic as a library that can be required and invoked programmatically from custom scripts.
- [Remote Template Bootstrappers](https://awesome-repositories.com/f/development-tools-productivity/project-scaffolding-config-code-generation/project-scaffolding-configuration/repository-templates/remote-template-bootstrappers.md) — Bootstrap a new project or folder from a remote template repository. ([source](https://cdn.jsdelivr.net/gh/jondot/hygen@master/README.md))
- [Remote Repository Cloning](https://awesome-repositories.com/f/development-tools-productivity/remote-repository-managers/remote-repository-cloning.md) — Clones a Git repository into a temporary directory, then copies its template structure into the local _templates folder.

### Operating Systems & Systems Programming

- [Runtime Template Scanners](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-systems/file-template-generators/runtime-template-scanners.md) — Scans the project's _templates directory at runtime to map folder and file names directly to generator commands and actions.

### User Interface & Experience

- [EJS Renderers](https://awesome-repositories.com/f/user-interface-experience/layout-utilities/presentation-engines/template-engines/server-side-rendering-engines/html-template-renderers/ejs-renderers.md) — Uses Embedded JavaScript templating to interpolate user-provided variables and prompt responses into generated file content.

### Web Development

- [Source Code Injection](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/marker-based-injection-utilities/source-code-injection.md) — Insert template content into an existing file at a specified location while preventing duplicate injections. ([source](https://cdn.jsdelivr.net/gh/jondot/hygen@master/README.md))
- [Duplicate Injection Guards](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/marker-based-injection-utilities/source-code-injection/duplicate-injection-guards.md) — Prevents repeated code insertion by tracking injection markers (start/end delimiters) within target files.
- [Duplicate-Protected Injections](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/marker-based-injection-utilities/source-code-injection/duplicate-protected-injections.md) — Inserting template content into an existing file at a specified location while preventing duplicate injections.

### Artificial Intelligence & ML

- [Embeddable Generator Engines](https://awesome-repositories.com/f/artificial-intelligence-ml/ai-coding-assistants/automated-workflow-generators/custom-workflow-generators/embeddable-generator-engines.md) — Embed the generator engine as a library inside a custom Node.js binary to build tailored workflows. ([source](https://cdn.jsdelivr.net/gh/jondot/hygen@master/README.md))
