CLI Reference
The Ginji CLI provides powerful code generation tools to streamline your development workflow. From scaffolding new projects to generating boilerplate code, the CLI helps you get up and running quickly.
Installation
Install the Ginji CLI using Go:
go install github.com/ginjigo/ginji/cmd/ginji@latestMake sure your $GOPATH/bin is in your PATH:
export PATH=$PATH:$(go env GOPATH)/binVerify the installation:
ginji --helpAvailable Commands
ginji new
Create a new Ginji project with an interactive setup wizard. Choose your database, ORM, middleware, and deployment options.
ginji generate handler
Generate HTTP handler functions with optional JSON binding support.
ginji generate middleware
Generate custom middleware functions that fit seamlessly into the Ginji middleware chain.
ginji generate crud
Generate complete CRUD (Create, Read, Update, Delete) handlers for a resource with RESTful routes.
Quick Examples
Create a new project:
ginji new my-apiGenerate a handler:
ginji generate handler GetUser --jsonGenerate middleware:
ginji generate middleware AuthGenerate CRUD operations:
ginji generate crud UserCommand Aliases
The CLI supports short aliases for common commands:
g→generateh→handlermw→middleware
Example:
ginji g h GetUser --json
# Same as: ginji generate handler GetUser --jsonGetting Help
Display help for any command:
ginji --help
ginji generate --help