Skip to content

Preset Generator

Terminal window
npx create-nx-workspace go-workspace --preset=@naxodev/gonx

When you run this command, you’ll be prompted to select a template type:

  • Binary - Creates a Go application using the standard gonx generator
  • Library - Creates a Go library using the gonx library generator
  • Go Blueprint - Creates a Go application using Go Blueprint templates
OptionTypeDefaultDescription
typestring”binary”Template type: “binary”, “library”, “go-blueprint”
directorystring*requiredThe directory of the new project
namestringnullThe name of the project
tagsstringnullAdd tags to the project (used for linting)
skipFormatbooleanfalseSkip formatting files
addGoDotWorkbooleanfalseAdd this project to go.work file

When type is set to “go-blueprint”, additional options become available:

OptionTypeDefaultDescription
frameworkstring”gin”Web framework (chi, gin, fiber, gorilla/mux, httprouter, standard-library, echo)
driverstring”none”Database driver (mysql, postgres, sqlite, mongo, redis, scylla, none)
gitstring”skip”Git handling (commit, stage, skip)
featurearray[]Advanced features (react, htmx, githubaction, websocket, tailwind, docker)
Terminal window
npx create-nx-workspace my-go-workspace --preset=@naxodev/gonx

This will prompt you to select the template type and configure all options interactively.

Terminal window
npx create-nx-workspace go-app --preset=@naxodev/gonx --type=binary
Terminal window
npx create-nx-workspace go-lib --preset=@naxodev/gonx --type=library
Terminal window
npx create-nx-workspace go-api --preset=@naxodev/gonx --type=go-blueprint --framework=gin --driver=postgres --git=commit
Terminal window
npx create-nx-workspace go-app --preset=@naxodev/gonx \
--type=go-blueprint \
--framework=fiber \
--driver=mysql \
--git=stage \
--feature=docker,githubaction
Terminal window
npx create-nx-workspace go-workspace --preset=@naxodev/gonx \
--type=go-blueprint \
--framework=echo \
--driver=sqlite \
--addGoDotWork=true
  • Creates a standard Go application using gonx’s application generator
  • Simple main.go with basic structure
  • Ready for immediate development with nx build, nx serve, etc.
  • Creates a Go library using gonx’s library generator
  • Includes example library code and tests
  • Configured for sharing and reuse
  • Uses Go Blueprint for advanced scaffolding
  • Provides multiple web frameworks and database integrations
  • Includes optional features like Docker, GitHub Actions, WebSockets, etc.
  • Go Blueprint binary is included with the package
my-go-project/
├── main.go (or library code)
├── go.mod
├── go.sum
└── nx.json

The structure varies based on selected framework and features, but typically includes:

my-go-project/
├── main.go
├── go.mod
├── go.sum
├── handlers/
├── models/
├── database/
├── static/
├── Dockerfile (if docker feature selected)
└── ... (additional files based on features)
  • Creates a new Nx workspace with gonx pre-configured
  • Sets up the workspace with Go support and inferred tasks
  • Ready to use immediately for Go development
  • Go Blueprint binary is bundled with the package
  • Creates go.work file only when explicitly requested via the addGoDotWork option
  • All template types support the full gonx toolchain (build, test, lint, etc.)

After workspace creation, all standard Nx commands work immediately:

Terminal window
# Build your project
nx build
# Run your application
nx serve
# Run tests
nx test
# Lint code
nx lint
# View project graph
nx graph