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