Module Layout

CUE modules have a specific set of files and directories that make up the layout.


Both cue and hof will look for this directory and file, by walking up the directory tree until it finds them.

The cue.mod directory has a few important subdirectories

cue.mod directory

	module.cue  // indicates a CUE module
	sums.cue    // hashes for integrity
  /pkg        // where dependencies go
	/gen        // where `cue import` puts code
	/usr        // for extending or correcting /gen


The module.cue file is how cue knows the current module name and how hof records dependencies.


module: ""
cue: "0.5.0"

// Direct dependencies (managed by hof)
require: {
	"": "v0.2.0"
	"": "v0.8.4"

// Indirect dependencies (managed by hof)
indirect: { ... }

// Replace dependencies with remote or local, useful for co-development
replace: {
  "": "": "v0.2.1"
  "": "../mods/cli"


A CUE module is a collection of packages. These are similar to Go packages, and if you use them the same, then they will behave the same. However, CUE modules have several extensions. We recommend sticking to the Go style packages and imports, as this style is much easier for non-experts to understand. If you want to learn about the other variations, check out our page on - modules & packages.

The Go style of packages and imports:

  • use lowercase and underscores
  • have only one package per directory
  • name should be the same as the directory
  • use <module-path>/<package-path> for all imports

For example, in the module, we have imports like: - hof.cue

package hof

import (
	// CUE stdlib

	// dependency import

	// module-local import

Cli: gen.#Generator & {
	Outdir: "./"
	Cli:    design.#CLI
	WatchGlobs: ["./design/**/*"]