Go Server
A scalable backend boilerplate built with Go, Gin, GORM, PostgreSQL, and Redis.
Technologies Used
- Go - Core language
- Gin - HTTP framework
- GORM - ORM for PostgreSQL
- Redis - In-memory caching
- Docker - Containerization (optional)
Features
- RESTful API using Gin
- PostgreSQL + Redis integration
- Modular service-based architecture
- Middleware support (CORS, Logging)
- Graceful shutdown handling
- Environment variable configuration
Getting Started
Installation
-
Create a
.envfile and configure database credentials:cp .env.example .env -
Install dependencies:
go mod tidy -
Run the database migrations (if applicable):
go run scripts/migrate.go -
Start the server:
go run main.goThe server should be running at http://localhost:8080
📂 Project Structure
├── config/ # Configuration files
├── controllers/ # API Controllers
├── models/ # Database Models
├── routes/ # Route Handlers
├── services/ # Business Logic Layer
├── database/ # DB Connection & Migrations
├── middleware/ # Middleware (CORS, Auth, Logging)
├── main.go # Entry Point
└── .env.example # Environment Config Sample