This repository started-out as a fork of go-wagen but a lot of its parts have been rewritten and this project combines the original boilerplate generated by [] along with the structure as per Golang Standards Project Layout and adds further customizations to modularize the code and add support for HTML templating and scratch docker image
Single binary web application generator for Go.
Creates boilerplate and does routine on a project start.
Less than in a minute you've got simple, clean and dockerized app:
- project layout, according to community best practices
- Makefile for wrapping project related routines
- Dockerfile and docker-compose for local development
- containers for code, tests and golangci-lint
- configuration management with viper
- logging with logrus or zap
- routing with gorilla/mux or chi
- default health check, http handler and logger middleware
goboiler is a starter pack for typical web application in Golang.
It doesn't aim to generalize the whole project workflow, push framework, or architecture. Consists of framework-agnostic components that are very common.
All contributions, issues, requests or feedback are warmly welcome.
Install pre-built binary on releases page:
curl -LJO https://github.com/shammishailaj/goboiler/releases/download/v1.0.0/goboiler-osx.tar.gz
tar -f goboiler-osx.tar.gz -x
or build from source code:
Clone the repository and cd
into the cloned directory
git clone https://github.com/shammishailaj/goboiler && cd goboiler
Following will install packr to wrap templates to binary
go install github.com/gobuffalo/packr/v2/packr2@latest
or you can just run the following:
make install
Next run the following to compile and build the executable
make build
To push releases install goreleaser via the following:
go install github.com/goreleaser/goreleaser@latest
GoReleaser's project page
Binary doesn't need to be in $GOPATH
and works without any dependencies.
./goboiler --path=/absoule/path/to/project
and select dependenciescd /absoule/path/to/project
go mod vendor
make run
- will build and run container with codemake test
- to run container with testsmake lint
- to run linter for source code
To see help:
goboiler -h
Application generated with goboiler will have following structure:
├── Makefile
├── cmd
│ └── example
│ └── example.go - app entrypoint
├── config - config presets for each env of default pipline
│ ├── app.dev.yml
│ ├── app.local.yml
│ └── app.yml
├── deploy
│ ├── Dockerfile
│ └── docker-compose.yml
├── go.mod
├── internal - for shared internal tools
│ └── app
│ └── example
│ ├── cmd
│ │ ├── docs.go
│ │ ├── root.go
│ │ ├── serve.go
│ │ └── version.go
│ └── server
│ ├── handlers
│ │ ├── hello.go
│ │ └── ping.go
│ ├── middleware
│ │ └── log.go
│ └── routes
│ ├── list.go
│ └── routes.go
├── pkg
│ ├── http
│ │ └── response
│ │ ├── html
│ │ │ ├── doc.go
│ │ │ ├── html.go
│ │ │ └── html_test.go
│ │ ├── json
│ │ │ ├── doc.go
│ │ │ ├── json.go
│ │ │ └── json_test.go
│ │ ├── xml
│ │ │ ├── doc.go
│ │ │ ├── xml.go
│ │ │ └── xml_test.go
│ │ ├── builder.go
│ │ ├── builder_test.go
│ │ └── doc.go
│ ├── schemas
│ │ ├── home.go
│ │ └── semver.go
│ └── utils
│ ├── array.go
│ ├── constants.go
│ ├── couchbase_config.go
│ ├── couchbasedb.go
│ ├── filesystem.go
│ ├── http_request.go
│ ├── rdbms.go
│ ├── rdbms_utils.go
│ ├── reflection.go
│ ├── system.go
│ ├── template.go
│ ├── time.go
│ ├── utils.go
│ └── uuid.go
├── storage - db/storages
├── vendor - downloaded modules
├── web - web templates and related files
│ └── template
│ └── default
│ ├── pages
│ │ └── home.gohtml
│ ├── partials
│ │ ├── footer.gohtml
│ │ ├── header.gohtml
│ │ ├── javascript.gohtml
│ │ ├── navbar.gohtml
│ │ └── style.gohtml
│ ├── static
│ │ ├── datetime.js
│ │ ├── default.css
│ │ ├── domready.js
│ │ └── lib.js
│ └── base.gohtml
└── VERSION - stores the application version