Skip to content

imantung/boilerplate-go-backend

Repository files navigation

Boilerplate Go Backend

Boilerplate project for golang backend.

Getting Started

Prerequisite for this project:

Command lines:

# 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

Checklist

Study Case: Employee Clocking System

The project use employee clocking system as the study case

  • For Client App
    • Clock-in
    • Clock-out
  • For Backoffice Dashboard
    • Manage Employee
    • Employee Clock History

Notes

  • The project is OPINIONATED based on author knowledge and experience
  • The project is PRAGMATIC, it use the other popular/proven go library 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 this as his actual project reference 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

  1. Echo VS Fiber?

    Fiber is a popular and faster web framework compared to Echo. The caveat is that fiber is based on fasthttp and not compatible with net/http which is cumbersome if we use other net/http based project (in our case, go-oauth2).

  2. 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.

Author

[email protected]

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Boilerplate project for golang backend

Topics

Resources

License

Stars

Watchers

Forks

Languages