Goose CLI Overview
The Goose CLI is a command-line tool for scaffolding and managing Goose framework applications.
Features
- Application Scaffolding - Create new API, Web, or CLI applications
- Module Generation - Add modules to existing projects
- Code Generation - Generate controllers, services, entities
- Project Management - Manage application configuration
Quick Start
# Install the CLI
go install github.com/awesome-goose/cli@latest
# Create a new API application
goose app --name=myapi --template=api
# Navigate to project
cd myapi
# Run the application
go mod tidy && go run main.go
Available Commands
| Command | Description |
|---|---|
goose app |
Create a new application |
goose g module |
Generate a new module |
goose generate module |
Generate a new module (full form) |
goose --version |
Show CLI version |
goose --help |
Show help information |
Command Structure
goose <command> [subcommand] [flags]
Examples
# Create applications
goose app --name=myapi --template=api
goose app --name=myweb --template=web
goose app --name=mycli --template=cli
goose app --name=mymulti --template=multi
# Generate modules
goose g module --name=users --type=plain
goose g module --name=products --type=resource
goose generate module --name=orders --type=resource --template=api
Use Cases
Starting a New Project
# Create a REST API
goose app --name=blog-api --template=api
# Project structure is created:
# blog-api/
# โโโ .env
# โโโ go.mod
# โโโ main.go
# โโโ app/
# โโโ app.module.go
# โโโ app.controller.go
# โโโ app.service.go
# โโโ app.routes.go
# โโโ app.dtos.go
Adding Features
# Add a users module
cd blog-api
goose g module --name=users --type=resource
# Module is created:
# app/users/
# โโโ users.module.go
# โโโ users.controller.go
# โโโ users.service.go
# โโโ users.routes.go
# โโโ users.dtos.go
# โโโ users.entity.go
Multi-Platform Project
# Create a project with API, Web, and CLI
goose app --name=myproject --template=multi
# Includes separate modules for each platform:
# app/
# โโโ api/
# โโโ web/
# โโโ cli/
# โโโ shared/
Configuration
The CLI uses sensible defaults but can be customized:
# Specify output directory
goose app --name=myapp --template=api --path=/projects
# Auto-detect platform from existing project
goose g module --name=users --type=resource # Detects from main.go
Next Steps
- Installation - Install the CLI
- Creating Applications - Create new projects
- Generating Modules - Add modules
- Command Reference - Full command documentation