GitHub - joelbugarini/hix: Flexible code generator with template-driven rendering and model-based output

2 min read Original article โ†—

Stop rewriting boilerplate. Start generating structure.

Hix is a template-driven code generator that turns simple JSON models into full-featured source code โ€” from backend models and database schema to HTML forms and API handlers.

Designed for developers who value consistency, automation, and clean architecture, Hix helps you build smarter, faster, and with fewer bugs.

  • ๐Ÿ” One model โ†’ many files
  • ๐Ÿงฉ Template everything: Python, TypeScript, HTML, SQL, C#, you name it
  • โš™๏ธ Drop-in CLI with Windows installer and editor integration
  • ๐Ÿง  Built with Haskell for safe, predictable rendering

"Build once. Template forever. Let Hix do the repetition."

Hix ๐Ÿงฉ โ€“ Flexible Code Generator

Hix is a flexible, template-driven code generator for developers who love clean, structured automation.**

Whether you're generating classes, config files, or scaffolding code, Hix combines the power of JSON models and expressive templates to deliver clean, readable output.

Documentation

Full documentation is available at:

๐Ÿ“„ https://joelbugarini.github.io/hix/


โœจ Features

  • ๐Ÿ” [[prop]] loops over model properties
  • โ“ [[if ...]], [[else]] conditionals
  • ๐Ÿ”ค Text transformation functions: [[upper ...]], [[lower ...]], [[snake_case ...]], [[kebab_case ...]], [[lowerFirst ...]]
  • ๐Ÿง  Full AST parser and golden test suite
  • ๐ŸŽจ VS Code / TextMate grammar for syntax highlighting
  • ๐ŸชŸ Windows installer with PATH integration

๐Ÿš€ Getting Started

1. Using the CLI (Windows)

Download and run the latest installer:

๐Ÿ“ฆ Download hix-setup.exe

Then open a terminal and run:

hix template.hix model.json

2. Using the CLI (Dev / Haskell)

stack install --local-bin-path=dist
dist/hix template.hix model.json

๐Ÿ“‚ Template Syntax

[[prop]]
[[if prop.type=bool]]
  <input type="checkbox" name="[[prop.name]]">
[[else]]
  <input type="text" name="[[snake_case prop.name]]">
[[/if]]
[[/prop]]

๐Ÿงช Tests

Includes golden tests for templates and rendering.


๐ŸŽจ Syntax Highlighting

You can generate a .tmLanguage.json file for use in VS Code or any TextMate-compatible editor:

hix --gen-grammar hix.tmLanguage.json

๐Ÿ“ฆ Packaging (Windows)

Build and package using Inno Setup:

stack install --local-bin-path=dist
cd utils/installer
Open hix_installer.iss in Inno Setup and click Compile

๐Ÿ“„ License

Licensed under GNU GPL v2, like Git.


๐Ÿค Contributing

Pull requests are welcome! Open an issue to discuss new features, syntax extensions, or improvements.


๐Ÿง  Roadmap

  • [[include file]] support for template partials
  • Custom filters and functions
  • Model validation
  • LSP integration / live preview

Made with โค๏ธ by Joel Bugarini