https://github.com/sanjayheaven/ggb
Go Gin Boilerplate. A development boilerplate based on the Gin framework, aimed at helping developers quickly build and develop web applications.
https://github.com/sanjayheaven/ggb
gin gin-boilerplate gin-template go go-gin go-gin-boilerplate go-gin-template project-layout
Last synced: about 1 year ago
JSON representation
Go Gin Boilerplate. A development boilerplate based on the Gin framework, aimed at helping developers quickly build and develop web applications.
- Host: GitHub
- URL: https://github.com/sanjayheaven/ggb
- Owner: sanjayheaven
- License: mit
- Created: 2024-01-09T06:47:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T03:16:41.000Z (over 2 years ago)
- Last Synced: 2025-03-23T07:59:15.567Z (over 1 year ago)
- Topics: gin, gin-boilerplate, gin-template, go, go-gin, go-gin-boilerplate, go-gin-template, project-layout
- Language: Go
- Homepage: https://sanjayheaven.github.io/ggb/
- Size: 13 MB
- Stars: 291
- Watchers: 1
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Gin Boilerplate




## π Documents
- [Project Document](https://sanjayheaven.github.io/ggb/)
- [Swagger Api Document](https://ggb.gganbu.services/swagger/index.html)
## π¬ Introduction
A development boilerplate based on the Gin framework, aimed at helping developers quickly build and develop web applications.
- [English](./README.md)
- [δΈζδ»η»](./README_zh.md)
## π Keywords
[Go](https://github.com/golang/go)
[Gin](https://github.com/gin-gonic/gin)
[Cobra](https://github.com/spf13/cobra)
[Viper](https://github.com/spf13/viper)
[Gorm](https://github.com/go-gorm/gorm)
[Gin-Swagger](https://github.com/swaggo/gin-swagger)
[Air](https://github.com/cosmtrek/air)
[Logrus](https://github.com/sirupsen/logrus)
[Lumberjack](https://github.com/natefinch/lumberjack)
[Zap](https://github.com/uber-go/zap)
[Jwt](https://github.com/golang-jwt/jwt)
## β¨ Features
- **Fast Development**: Using the **Gin** framework and related tools to speed up the development and iteration process of the project..
- **Easy to use**: Follow the [project-layout](https://github.com/golang-standards/project-layout/tree/master) specification and provide a clear and simple code structure so that even beginners can easily get started.
- **Advanced CLI**: Using **Cobra** to build modern command line tools to simplify project management and operations.
- **Hot Reload**: Using **Air** tool, support hot reload, improve development efficiency.
- **Logging system**: Integrated **Logrus**, **Zap** and **Lumberjack** to achieve all-round log recording and management.
- **Database Support**: Integrated **Gorm**, support mainstream databases such as MySQL, PostgreSQL, etc.
- **Flexible Middleware**: Integrate common middleware to easily implement functions such as logging, authentication, cross-domain, and flow control.
- **API Document**: Use **Gin-Swagger** to generate API documents for easy viewing and debugging of interfaces.
## π Quick Start
```sh
git clone https://github.com/sanjayheaven/ggb.git
cd ggb
go mod download
```
### Configuration Setup
- Navigate to the `configs` directory, copy the `config.example.yaml` file, and rename it to `config.yaml`.
```sh
cp configs/config.example.yaml configs/config.yaml
```
- Modify the configuration items in the `config.yaml` file.
```sh
vi configs/config.yaml
```
### Run the Application
- Run the project using [air](https://github.com/cosmtrek/air) **γRecommendedγ**
```sh
air
```
- Run the project using [go run](https://golang.org/cmd/go/#hdr-Compile_and_run_Go_program)
```sh
go run main.go server
```
## π¨ Build
```sh
make build
```
## πͺ€ Deployment
### docker-compose
Deploy the application using **_docker-compose_**.
Ensure that Docker is installed on the server, and you are familiar with the usage of docker compose.
- Copy the `deployments/docker-compose.yml` configuration file to the project root directory.
- Execute the following command to start the application
```sh
docker compose up -d
```
## π€ Support
- Star π the project
- Welcome to submit [issue](https://github.com/sanjayheaven/ggb/issues). Thank you for your support
- Help promote it on social media and recommend it to friends
[](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fsanjayheaven%2Fggb)
[](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fgithub.com%2Fsanjayheaven%2Fggb)
[](https://api.whatsapp.com/send?text=Wow:%20https%3A%2F%2Fgithub.com%2Fsanjayheaven%2Fggb)
[](https://t.me/share/url?url=https%3A%2F%2Fgithub.com%2Fsanjayheaven%2Fggb)
- You can also sponsor a cup of coffee on [Ko-Fi](https://ko-fi.com/dorvan) or [Buy Me A Coffee](https://www.buymeacoffee.com/dorvan)