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/bccliUsage:
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.
middleware Middleware layer command
Flags:
-h, --help help for bccli
The init command sets up the initial project structure.
bccli init -iAfter that, this command will ask you for:
- Project Name
- HTTP Framework
- Database Driver
This will bootstrap the current directory with the following structure:
cmd/
└── api/
└── main.go
internal/
├── middleware/
│ └── authentication.go
└── infra/
└── (database driver).go
Dockerfile
go.mod
go.sum
Makefile
The domain generate command used to create a new domain entity with its layer.
bccli domain generate todoThis 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 postgresqlThis command generates a basic MySQL configuration file:
internal/
└── infra/
└── postgresql.go
You can choose another database like mysql or mariadb.
The middleware generate command is used to generate middleware inside internal folder
bccli middleware generate todoThis command generates a basic MySQL configuration file:
internal/
└── middleware/
└── todo.go
This repository is licensed under the MIT License.