CLI
CLI Reference
The bkgo CLI scaffolds new projects, generates/removes modules following Hexagonal Architecture conventions, and manages the bkgo dependency itself.
Install
go install github.com/BounkhongDev/bkgo/cmd/bkgo@latestRequires Go 1.22+. The CLI binary is embedded with all templates — no separate files needed.
bkgo new
Scaffold a new Go project with the full bkgo structure.
bkgo new myapp
bkgo new myapp --module github.com/yourname/myappGenerated structure:
myapp/
├── cmd/api/main.go ← wired app entry point
├── internal/ ← your modules go here
├── migrations/ ← SQL migration files
├── .env.example ← environment template
├── docker-compose.yml ← postgres + redis + minio
├── Makefile ← run, test, migrate targets
├── .gitignore
└── go.modbkgo generate (g)
Generate a full module or individual files. Alias: g
Full module
bkgo generate module user
bkgo g module product
bkgo g module orderItem # camelCase → order_item packageGenerated files:
internal/user/
├── domain.go ← entity struct + Repository interface (PORT)
├── usecase.go ← business logic (depends on PORT only)
├── handler.go ← Fiber HTTP handler + route registration
├── repository.go ← PostgreSQL implementation (ADAPTER)
└── usecase_test.go ← unit test with mock.DatabaseIndividual files
bkgo generate handler product
bkgo generate service product
bkgo generate repository productGenerates only the specified file inside internal/product/.
bkgo remove (rm)
Delete a module directory or individual files. Alias: rm
bkgo remove module user # deletes internal/user/ entirely
bkgo rm module user # same (rm alias)
bkgo remove handler product # deletes internal/product/handler.go
bkgo remove service product # deletes internal/product/usecase.go
bkgo remove repository product # deletes internal/product/repository.gobkgo upgrade (up)
Bump the bkgo package in your project, or reinstall the CLI binary. Alias: up
Project dependency
bkgo upgrade # → latest release
bkgo up # same (up alias)
bkgo upgrade --version v0.2.7 # pin a version (upgrade or downgrade)
bkgo upgrade --deps # also upgrade bkgo's own dependenciesRuns go get followed by go mod tidy and reports the version change. If your go.mod replaces bkgo with a local checkout, upgrade warns you that bumping the require version won't change what your build actually uses.
CLI binary
bkgo upgrade --cli # go install .../cmd/bkgo@latest
bkgo upgrade --cli --version v0.2.7Runs go install — works from any directory, no go.mod required.
bkgo uninstall
Remove the bkgo package from your project, or delete the installed CLI binary.
Project dependency
bkgo uninstall # drop from go.mod + go mod tidy
bkgo uninstall --force # drop it even while code imports bkgoRefuses while any .go file still imports bkgo — go mod tidy would just put the requirement straight back. It lists the offending files first. Any replace directive on bkgo is dropped along with the require.
CLI binary
bkgo uninstall --cli # deletes $GOBIN/bkgo (asks first)
bkgo uninstall --cli --yes # no promptDeletes the binary from GOBIN (or GOPATH/bin). Asks for confirmation unless you pass --yes.
Name conventions
Module names are normalized automatically — you can pass any case:
| Input | Package (dir) | Struct name |
|---|---|---|
user | user | User |
orderItem | order_item | OrderItem |
order-item | order_item | OrderItem |
order_item | order_item | OrderItem |