# First setup for mac (for other OS, please refer to respective documentation)
brew install go
brew install go-task
brew install golang-migrate
task --list-all # Show available tasks
task run # Run the project
task clean # Clean the dev local environment
task gen-oapi # Generate open-api controller from api-spec.yaml
task gen-dotenv # Generate .env file from config struct
task gen-entity # Generate entity/repo from database table
task gen-converter # Generate converter from DAO to Entity and vice-versa
task create-migration NAME=create_some_table # Create new migration file
Tech Overview
Framework/library:
Echo: High performance, minimalist Go web framework
OApi-CodeGen: Generate Go client and server boilerplate from OpenAPI 3 specifications
Go-Auth2: OAuth 2.0 server library for the Go programming language
Go-Mock: a mocking framework for the Go programming language
Dig: A reflection based dependency injection toolkit for Go.
The project use employee clocking system as the study case
Client App API
Clock-in
Clock-out
Backoffice Dashboard API
Manage Employee
Employee Clock History
Notes
The project is OPINIONATED based on author knowledge and experience
The project is PRAGMATIC, it use proven libraries/frameworks as much as possible without reinvented the wheel
The project is MONOLITH BACKEND, you may need to customize code for microservices needs
This is CONTINUOUS PROJECT, the author use it as his actual work and keep improve it
The project is OPEN-FOR-DISCUSSION, feel free to ping the author for any feedback/question and/or open issue ticket
FAQ
Echo VS Fiber?
Fiber is arguably better than Echo but is not compatible with net/http (it is based on fasthttp). We use go-oauth2 who only support net/http, therefore we choose to use Echo instead.
Pgx for postgres?
Pgx is a faster and more compatible postgres driver compared with pq. There are 2 ways to use pgx: through database/sql and direct implementation (which offer more capability) but not compatible with database/sql. We want to keep compatibility with database/sql to give flexibility to use other library.