boilerplate
Install
Use go get -u github.com/michilu/boilerplate
.
OR
$ git clone --depth=1 https://github.com/michilu/boilerplate.git
$ cd boilerplate
$ make
develop
dependencies
require go1.14
protobuf
go generate
$ go get -u github.com/cheekybits/genny
$ GO111MODULE=on go get -u github.com/rjeczalik/interfaces/cmd/interfacer
build
-
make
-
make golang
build Go code
-
make proto
generate Go codes from proto
-
make generate
generate Go codes via go-generate
-
make gox
: cross compile
-
make channel
: push out self update files to develop channel
-
make release
: push out self update files to release channel
-
make uml
: generate PlantUML from Go codes
-
make godoc
: generate GoDoc from Go codes
-
make gopherjs
-
make serve
-
make clean
: clean up
launch
$ ./assets/daemon/loop ./boilerplate --debug --verbose --trace --profiler --update run
Architecture
DDD
Each directory contains:
domain
: Domain Service, Domain Rule, Entity, Value Object, Repository Interface
- Layered architecture: Domain
- Hexagonal architecture: Domain Model
- Onion architecture: Domain Model, Domain Service
- Clean architecture: Entities
application
: Application, Handler of Entity/Value Object, Dataflow
- Layered architecture: Application
- Hexagonal architecture: Application
- Onion architecture: Application Service
- Clean architecture: Use Cases, Controllers
infra
: Repository
- Layered architecture: Infrastructure
- Hexagonal architecture: Adapter
- Onion architecture: Infrastructure
- Clean architecture: Gateways
presentation
: Endpoint
- Layered architecture: User Interface, Presentation
- Hexagonal architecture: Adapter
- Onion architecture: User Interface
- Clean architecture: Presentaters
usecase
: Use Case, Requirements
- The context in Agile software development, not DDD.
Event-driven architecture
NOT the Event Sourcing System.
deploy
$ make deploy
environment variables for Wercker
see: https://app.wercker.com/<organization>/<application>/environment
setup the workflows on Wercker
see: https://app.wercker.com/<organization>/<application>/workflows
optimize
- minify: https://github.com/gopherjs/gopherjs#performance-tips
:
7,196,874 bytes: 100%: $ gopherjs build
4,661,791 bytes: 65%: $ gopherjs build --minify
- UglifyJS 3: https://github.com/mishoo/UglifyJS2
:
4,547,810 bytes: 63%: $ gopherjs build --minify && uglifyjs
4,274,152 bytes: 59%: $ gopherjs build --minify && uglifyjs --compress
3,843,890 bytes: 53%: $ gopherjs build --minify && uglifyjs --compress --mangle
sync subtree
Add upstream:
$ git clone git@github.com:michilu/boilerplate.git .
$ git remote add upstream https://github.com/dart-lang/angular.git
$ git checkout upstream/master
$ git subtree split --prefix=examples/hacker_news_pwa -b examples/hacker_news_pwa
Sync to upstream:
$ git fetch upstream master
$ git checkout upstream/master
$ git subtree push --prefix=examples/hacker_news_pwa origin examples/hacker_news_pwa
$ git checkout upstream
$ git subtree pull --prefix=app origin examples/hacker_news_pwa
ref:
for proto
Add upstream:
$ git remote add googleapis https://github.com/googleapis/googleapis
$ git fetch --depth=1 --no-tags googleapis
$ git checkout googleapis/master
$ git subtree split --prefix=google/type -b google/type
Add subtree:
$ git checkout dev
$ git subtree add --prefix=vendor/github.com/googleapis/googleapis/google/type google/type
Sync to upstream:
$ git fetch --no-tags googleapis
(TBD)
$ git subtree pull --prefix=vendor/github.com/googleapis/googleapis/google/type origin google/type