Skip to content

bccfilkom-be/bccli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bccli

bccli is a simple cli tool for setting up go server project based on Three-layered Archictecture combined with Domain Driven Design.

Installation

Make sure you have Go installed on your device.

go install github.com/bccfilkom-be/bccli

Usage

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.
  middleware  Middleware layer command

Flags:
  -h, --help   help for bccli

Command Overview

Initialize a new project

The init command sets up the initial project structure.

bccli init -i

After 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

Create a domain entity

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

Set up Infrastucture

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.

Set up Middleware

The middleware generate command is used to generate middleware inside internal folder

bccli middleware generate todo

This command generates a basic MySQL configuration file:

internal/
└── middleware/
    └── todo.go

License

This repository is licensed under the MIT License.

About

artisan like cli for gophers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 6