Generators have a common files and a directory structure.

Typical directory structure

# CUE files for our schema and hof generator

# files used by the hof generator

# sample usage of our generator

You will often have other files depending on the languages or technologies you choose. A common example are the files for dependency management like package.json and go.mod. There are no restrictions or limits on what you can include.


Almost every hof generator is also a CUE module. hof mod is a subcommand for working with Go style module systems. We use it as an iterim tool until cue mod is implemented upstream.

For more information about hof mod, see


Through the first-example section, we will be developing a hof geneartor as a module. The following steps will get your project setup.

1. Start a CUE module

mkdir first-example && cd first-example
hof mod init cue

2. In cue.mods - add hof as a dependency

require v0.6.2

3. Fetch CUE dependencies

hof mod vendor cue

4. Create common sub-directories

mkdir schema gen templates partials static examples

Your working directory should now look like:

Module layout

├── examples/
├── gen/
├── partials/
├── schema/
├── static/
├── templates/
├── cue.mods
├── cue.sums
└── cue.mod/
    ├── module.cue
    └── pkg/
            └── hofstadter-io/
                ├── ghacue/...
                ├── hof/...
                ├── hofmod-cli/...
                └── hofmod-cuefig/...
2022 Hofstadter, Inc