RepositoryGoBDBangladesh
hrshadhin

hrshadhin/fiber-go-boilerplate

🚀 Production-ready Golang based boilerplate application with Fiber web framework

101sao
36fork
0issue
1lượt xem

Fiber Go Boilerplate

Is a production-ready golang based boilerplate application with Fiber Go web framework. For any fiber go application, just clone the repo & rename the application name.

Fiber is an Express.js inspired web framework build on top of Fasthttp, the fastest HTTP engine for Go. Designed to ease things up for fast development with zero memory allocation and performance in mind.

Tools & Libraries used

⚡️ Quick start

  • Install docker, golang-migrate & swag
  • Rename .env.example to .env
  • Run project by this command:
    make docker.run
    
  • Visit http://localhost:5000 or http://localhost:5000/swagger/
  • Stop make docker.stop

APIs

📦 Used packages

NameVersionType
gofiber/fiberv2.7.1core
gofiber/jwtv2.2.1middleware
arsmn/fiber-swaggerv2.6.0middleware
stretchr/testifyv1.7.0tests
dgrijalva/jwt-gov3.2.2auth
joho/godotenvv1.3.0config
jmoiron/sqlxv1.3.3database
jackc/pgxv4.11.0database
sirupsen/logrusv1.8.1logging
swaggo/swagv1.7.0utils
google/uuidv1.2.0utils
go-playground/validatorv10.5.0utils

🗄 Project structure

/app

Folder with business logic only. This directory doesn't care about what database driver you're using.

  • /app/controller folder for functional controller (used in routes)
  • /app/dto Data Transfer Objects(DTO) folder for transform data before sent to API clients
  • /app/model folder for describe business models and methods of your project
  • /app/repository folder for perform database operations for models of your project

/cmd

Main applications for this project.

The directory name for each application should match the name of the executable you want to have (e.g., /cmd/server /cmd/cron). Don't put a lot of code in the application directory. If you think the code can be imported and used in other projects, then it should live in the /pkg directory.

/docs

Folder with API Documentation.

This directory contains config files for auto-generated API Docs by Swagger, screenshots and any other documents related to this project.

/pkg

Folder with project-specific functionality. This directory contains all the project-specific code tailored only for your business use case.

  • /pkg/config folder for configuration functions
  • /pkg/middleware folder for add middleware (Fiber built-in and yours)
  • /pkg/route folder for describe routes of your project
  • /pkg/validator folder with validation functions

/platform

Folder with platform-level logic. This directory contains all the platform-level logic that will build up the actual project, like setting up the database, logger instance and storing migrations, seeds(demo data).

  • /platform/database folder with database setup functions (by default, PostgreSQL)
  • /platform/logger folder with better logger setup functions (by default, Logrus)
  • /platform/migrations folder with migration files (used with golang-migrate/migrate tool)
  • /platform/seeds folder with demo data for application rapid setup. mostly sql scripts

⚙️ Configuration

# .env
# APP settings:
APP_HOST="0.0.0.0"
APP_PORT=5000
APP_READ_TIMEOUT=30
APP_DEBUG=false

# JWT settings:
JWT_SECRET_KEY="super_secret_here"
JWT_SECRET_KEY_EXPIRE_MINUTES_COUNT=120

# Database settings:
DB_HOST=fibergb-postgres
DB_PORT=5432
DB_USER=dev
DB_PASSWORD=dev
DB_NAME=fiber_go_api
DB_SSL_MODE=disable
DB_DEBUG=true
DB_MAX_OPEN_CONNECTIONS=3
DB_MAX_IDLE_CONNECTIONS=1
DB_MAX_LIFETIME_CONNECTIONS=10

🔨 Docker development

  • Install docker, docker-compose & golang-migrate
  • Rename .env.example to .env
  • Start db container docker-compose up db
  • Run migrations make migrate.up
  • Now start api server with hot reloading make docker.dev
  • Visit http://localhost:5000 or http://localhost:5000/swagger/

🔨 Local Development

  • Install PostgreSQL golang >= 1.16 golang-migrate gosec & swag
  • Rename .env.example to .env and fill it with your environment values
  • Migrate db & seed some demo data
    make migrate.up
    make seed
    
  • Run project by this command:
    make run
    
  • Visit http://localhost:5000 or http://localhost:5000/swagger/
  • Check Makefile for more commands
    # drop migration
    make migrate.down
    
    # force migration to specific version
    migrate.force
    
    # run test
    make test
    ...
    

⚠️ License

MIT © H.R. Shadhin

Dự án tương tự

Khám phá các dự án và mô hình AI khác có sự tương đồng.

RepositoryGo
gofiber/fiber

⚡️ Express inspired web framework written in Go

40.4k
Dec 1, 2026
RepositoryGo
emarifer/gofiber-templ-htmx

Go/Fiber🧬+</>Templ to-do list app with user login and HTMx-powered frontend.

142
Jul 7, 2024
RepositoryGo
avelino/awesome-go

A curated list of awesome Go frameworks, libraries and software

197.2k
Dec 2, 2026
RepositoryGo
ollama/ollama

Get up and running with Inkling, Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

188.9k
Dec 2, 2026
RepositoryGo
golang/go

The Go programming language

140.0k
Dec 1, 2026
RepositoryGo
moby/moby

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

72.3k
Nov 26, 2026
RepositoryGo
traefik/traefik

The Cloud Native Application Proxy

65.9k
Dec 2, 2026
RepositoryGo
rclone/rclone

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

61.4k
Nov 27, 2026
RepositoryGo
go-gitea/gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD

59.4k
Dec 1, 2026