A simple example project showing how to build a REST API in Go using Gin, Gorm, and configuration files (config.yaml and .env).
go-restapi-example-with-gin/
βββ config/ # Configuration files
β βββ config.yaml
β βββ config.go
βββ internal/ # Core business logic
β βββ handler/
β βββ routes/
β βββ database/
β βββ utils/
β βββ model/
βββ .env
βββ main.go # Entry point
βββ go.mod
βββ go.sum
βββ .gitignore
βββ README.md
server:
port: 8080
database:
db_host: localhost
db_port: 5432
db_user: postgres
db_name: example_db
db_sslmode: disableπ Example .env
DB_PASSWORD="your_password"π§© Technologies Used Go 1.25.3
Gin β HTTP web framework
Gorm β ORM for database access
PostgreSQL
YAML / env
π Getting Started
git clone https://github.com/Dima-Melnik/go-restapi-example-with-gin.git
cd go-restapi-example-with-gin
go mod tidy
go run main.go