/go-boilerplate

Golang boilerplate for WebApp Generator

Primary LanguageGo


GO Boilerplate

GO boilerplate is an application that is developed to generate application by API specification and Database schema with the collaboration with webapp-generator.

Report Bug

Table of Contents

  1. About The Project
  2. Usage
  3. Roadmap
  4. Requirements
  5. Acknowledgements

About The Project

Project Structure

📦go-boilerplate
 ┣ 📂cmd
 ┃ ┣ 📂admin
 ┃ ┣ 📂app
 ┃ ┣ 📂cli
 ┣ 📂config
 ┣ 📂database
 ┃ ┗ 📂migrations
 ┣ 📂deployments
 ┣ 📂docs
 ┣ 📂internal
 ┃ ┣ 📂http
 ┃ ┣ 📂models
 ┃ ┗ 📂repositories
 ┣ 📂pkg
 ┃ ┣ 📂database
 ┣ 📂templates
 ┃ ┣ 📂api
 ┃ ┣ 📂database

Directory explanation

/cmd

Main applications for this project. The directory name for each application should match the name of the executable you want to have (e.g., /cmd/myapp).

/config

Configuration file templates or default configs.

/database

Contains database related file. (eg., /database/migrations)

/deployments

Contains deployment related file. (eg., aws codebuild, codepipeline, dockerfiles)

/docs

Contains project documents. (eg., app api docs, admin api docs, database schema etc.)

/internal

Private application and library code. This is the code you don't want others importing in their applications or libraries. Note that this layout pattern is enforced by the Go compiler itself.

/pkg

Library code that's ok to use by external applications (e.g., /pkg/mypubliclib). Other projects will import these libraries expecting them to work, so think twice before you put something here :-)

This tool is developed by following Standard Go project layout

App Structure

Repositories

Repositories are the gateway to get entities(model).

Services

Services are business logic layers.

Handlers

  • Handlers are entry points of all APIs and they should have the following things only
  • Validate request and build request objects
  • Call set of service methods
  • Build response object
  • You should not write any business logics on handler methods directly.

This project is using Uber’s dig as dependency injection toolkit.

Usage

Please check WebApp Generator readme section check the usage process of go boilerplate.

Roadmap

The roadmap is useful for planning large pieces of work several months in advance at the Epic level within a single project. Simple planning and dependency management features help teams visualize and manage work better together.

See the open issues for a list of proposed features (and known issues).

Requirements

  • Go^1.18

Acknowledgements