Gin Postgre Boilerplate
Production-grade Go backend using Gin, GORM, Redis, and Swagger with clean architecture and fintech-ready infrastructure.
Install / Use
npx skills add antonio-gaskin/gin-postgre-boilerplateInstalls into whichever agent you are using.
README
Project Name
A professional Go backend using Gin, GORM, Redis, and Swagger designed for fintech-grade applications.
Features a clean architecture with Handler → Service → Repository → Model layers, CLI commands for migrations, seeding, and running the server, plus auto-generated Swagger API docs.
Features
- RESTful API using Gin
- GORM ORM with auto-migrations and seed data
- Redis caching layer for high performance
- Structured logging using Zap with request IDs
- Versioned API routes (
/api/v1/...) - CLI commands for DB migration, seeding, and running server
- Auto-generated Swagger / OpenAPI documentation
Tech Stack
- Go 1.21+
- Gin Web Framework
- GORM ORM (Postgres / MySQL / SQLite)
- Redis
- Zap Logger
- Swaggo for Swagger Documentation
Installing Golang
sudo apt update
sudo apt upgrade -y
wget https://go.dev/dl/go1.21.2.linux-amd64.tar.gz # You can change version
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.2.linux-amd64.tar.gz
nano ~/.profile
# Go environment
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
Project Structure
cmd/
├─ api/ # HTTP server entrypoint
│ └─ main.go
└─ cli/
├─ main.go # CLI commands for migrate, seed, run
└─ create_db.go # CLI commands for create db
internal/
├─ config/ # Environment / config loader
├─ observability/ # Logger + request ID middleware
├─ server/ # Gin engine
├─ routes/ # Route registration
├─ handler/ # HTTP handlers (controllers)
├─ service/ # Business logic
├─ repository/ # GORM models + DB queries
├─ cache/ # Redis client wrapper
├─ model/ # Pure data structures (optional)
├─ services/ # Business Logic
└─ middleware/ # Middleware
Setup Environment Variables
APP_ENV=local
APP_PORT=8080
LOG_LEVEL=info
NODE_ENV=development
# Security
API_KEY=local-dev-key
# Database (optional)
DB_HOST=localhost
DB_PORT=5433
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=app
DB_LOG_MODE=false
# Cache
REDIS_ADDR=localhost:6379
Install dependencies
go mod tidy
Create the Database
This step is optional if your database already exists. You can create the database manually:
-- PostgreSQL example
CREATE DATABASE dbname;
Or using a CLI command if implemented
go run ./cmd/api/main.go create-db
Run Database Migration
To create tables based on your GORM models
go run ./cmd/api/main.go migrate
Or, if AUTO_MIGRATE=true in .env, migrations will run automatically when starting the server.
Seed Initial Data(optional)
Populate your database with initial test data
go run ./cmd/api/main.go seed
Start the Server
go run ./cmd/api/main.go run
Server will start at:
http://localhost:8080
Related Skills
career-ops
63.2kOpen-source AI job search: scan job portals, evaluate listings with a structured A-F rubric into a 1.0-5.0 score, tailor your CV, track applications — runs locally in your AI coding CLI (Claude Code, Codex, OpenCode, Antigravity…)
dbx
13.6k20 MB lightweight cross-platform database client for 70+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker.
product
Cloud-agnostic Kubernetes infrastructure with Terraform & Helm for homelabs, edge, and production clusters.
ghidra-mcp
3.2kGhidra MCP Server — 200+ MCP tools for AI-powered reverse engineering. GUI plugin + headless server, lazy tool loading, convention enforcement, batch operations, Ghidra Server integration, and Docker deployment.
