Application Generator
nx g @naxodev/gonx:application my-go-appOptions
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
| name | string | null | Name of the Go application |
| directory | string | *required | The directory of the new application |
| template | standard | cli | tui | standard | The template of application to generate |
| tags | string | null | Add tags to the application (used for linting) |
| skipFormat | boolean | false | Skip formatting files |
Examples
Section titled “Examples”Generate a standard application (default)
Section titled “Generate a standard application (default)”nx g @naxodev/gonx:application my-go-appGenerate a CLI application
Section titled “Generate a CLI application”nx g @naxodev/gonx:application my-cli-app --template=cliGenerate a TUI application
Section titled “Generate a TUI application”nx g @naxodev/gonx:application my-tui-app --template=tuiGenerate an application in a specific directory
Section titled “Generate an application in a specific directory”nx g @naxodev/gonx:application apps/my-go-appor
nx g @naxodev/gonx:application --name=go-app --directory=apps/my-go-appGenerate an application with tags
Section titled “Generate an application with tags”[!NOTE] Tags will only work when the project was created with a project.json file
nx g @naxodev/gonx:application my-go-app --tags="json yaml"Output
Section titled “Output”The generator creates different structures based on the application template:
Standard Application (default)
Section titled “Standard Application (default)”my-go-app/├── main.go├── main_test.go└── go.modCLI Application (—template=cli)
Section titled “CLI Application (—template=cli)”my-cli-app/├── main.go├── main_test.go├── go.mod└── cmd/ ├── root.go ├── version.go └── cmd_test.goTUI Application (—template=tui)
Section titled “TUI Application (—template=tui)”my-tui-app/├── main.go├── main_test.go├── go.mod├── cmd/ └── root.go└── internal/ └── models/ ├── model.go ├── model_test.go └── styles/ ├── styles.go- Unlike the original nx-go, gonx does not generate a project.json file
- Uses inferred tasks, so you can immediately use
nx build,nx serve, etc. - CLI applications use Cobra for professional command-line interfaces
- TUI applications use Bubble Tea and Lipgloss for interactive terminal UIs
- For CLI and TUI apps, run
nx tidy <app-name>after generation to download dependencies