Categorygithub.com/thinhlh/go-web-101
module
0.0.0-20240806164408-8a51e34afa6f
Repository: https://github.com/thinhlh/go-web-101.git
Documentation: pkg.go.dev

# README

Golang microservice Template

Prerequisite

  • Docker/Docker compose
  • Golang
  • Makefile (optional)
  • Copy env
    cp .env.example .env
    

Boot

  1. Local (Boot whole stack)
    make run
    
  2. Dev
    make pre-run
    make services-dev
    
  3. Prod
    make pre-run
    make services
    

A production ready GoLabg template with Domain Driven Design architecture and predefined configurations

Features

Environment configuration

Built-in exception filter

Base universial RestAPI response with OpenAPI support

SQL Database connection with TypeORM

Commithook & commitlint

Error handling

Database migration

TODO items

  • Server Configs

  • Application Configs

  • Deployments

  • Others

    • Dev Mode - Reload on changes

    • Database migration

      • Using gorm AutoMigration
      - Does not have versioning strategy
      - Does not support rollback
      - Does not isolate between infrastructure & application
      + Suggest using other tools that run migration before running application
      // https://www.reddit.com/r/golang/comments/12mypec/how_do_you_handle_migrations/
      
      • Current solution: Using golang-migration. Need to add a docker-compose version
      - No tracking & schema -> sql generation
      - Have to write SQL up & down manually
      + Separation of concern
      

      Usage

      make migration-create migration_msg="create_table_product" # Create new migration then filling up & down sql script
      make migration-up step= # Up migration. step=N/"" for N step up or all up
      make migration-down step= # Down migration. step=N/"-all" for N step down or all down
      
    • Linting & Commit Lint

    • Business Error handling

    • Sample CRUD

    • CI/CD pipeline

    • CQRS

    • BaseModule, BaseCRUD

    • Pagination

    • Locking mechanism

    • Feature flag

    • HttpServices

    • Auth

    • Logging, Tracing & Monitoring

    • Deployment

    • Caching

    • MessageQueue

    • GraphQL

    • gRPC

    • Monorepo

    • CMS Integration

    • High-level application architecture docs

# Packages

No description provided by the author
No description provided by the author