Skip to content

lucasdengcn/gin-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gin boot starter application

Overview

for fast starting a microservice application on top of Gin framework.

Project Structures

Name Description Reference Link
config configuration per env. including dev, sit, uat, prod etc Yaml files
apis/controllers apis implementation follow OpenAPI 3.0 specification
apis/models definition of request input models and response models
core define application errors
core/middlewares request middleware, interceptor, global error handler etc
core/logging context logger
core/otel initializer OTEL tracer, metric, logging provider
core/validators initialize model fields validator, e.g Gender
core/enums define enums, e.g Gender
infra infra resources connectivity and management
infra/db database connection, transaction
infra/mq MQ connection e.g. Kafka, RabbitMQ
infra/cache cache connection e.g. Redis
jobs schedule jobs implementation e.g. cron job
messaging event-driven integration between micro-services
messaging/events definition of events follow cloud event specification
messaging/consumers consumer implementation, calling domain service methods
migrations database schema changes
persistence/entity data entity mapping to database schema
persistence/repository data handling over database using Context to manage transaction
server implement routers, server, CDI
services business login implementation using Context to manage transaction
wire-config CDI initializer

Schema

in General, migration files should be put in a dedicated repo, and run with a dedicated restricted User.

migrations

Go migrate

Tech stack

PostgreSQL

SqlX

Gin

Go migrate

testify

yaml

Viper

CDI

Open API

Logging

RFC7807

OTEL

pprof

[JWT](https://github.com/golang-jwt/jwt https://github.com/MicahParks/keyfunc)

[ACL casbin] (https://casbin.org/)

Practices

Panic or return

Repository SHOULD return error, SHOULD NOT Panic.

Service MUST Panic if error and NEED to stop execution.

Global Recovery/Defer function SHOULD handle error and response.

Column Default value

Always set DEFAULT value on database table column, so that can avoid can't convert from NULL to yyy error

Reference

zerolog

validation

OTEL

Performance Reference

DB Packages

Git hooks

git config core.hooksPath .git-hooks 

Tools

revive

pre-commit

golangci-lint

Golangci-lint aggregates dozens of tools with hundreds of checks. Revive is one of such tools

About

gin framework boot starter for fast starting a micro-service development

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published