bccli is a simple cli tool for setting up go server project based on Three-layered Archictecture combined with Domain Driven Design.
Make sure you have Go installed on your device.
go install github.com/bccfilkom-be/bccli
Usage:
bccli [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
domain Generate domain components like handler, usecase, and repository.
help Help about any command
infra Infra layer command
init Initialize a new Go REST server project structure.
Flags:
-h, --help help for bccli
The init
command sets up the initial project structure.
mkdir go-server
cd go-server
bccli init github.com/bccfilkom-be/go-server
This will bootstrap the current directory with the following structure:
cmd/
└── api/
└── main.go
Dockerfile
go.mod
go.sum
Makefile
The domain generate
command used to create a new domain entity with its layer.
bccli domain generate todo
This command generates todo domain representation and with its three-layered app in the following structure:
internal/
├── domain/
│ └── todo.go
└── todo/
├── interface/
│ └── rest/
│ └── todo.go
├── repository/
└── usecase/
└── todo.go
The infra generate
command is used to generate 3rd party service libraries config or other external component of the app.
bccli infra generate postgresql
This command generates a basic MySQL configuration file:
internal/
└── infra/
└── postgresql.go
You can choose another database like mysql or mariadb.
This repository is licensed under the MIT License.