go-fiber-template

command module
v0.0.0-...-63580ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 1 Imported by: 0

README

Go Fiber Web Server Template

A starter template for web-server in Go using Fiber, Cobra, and Viper

External Modules

  • Fiber v3 – HTTP web framework
  • Cobra – CLI framework, provides serve command for starting web server
  • Viper – Load and parse config files/env vars
  • Zerolog – Structured logging
  • invopop/validation – Lightweight request/config validation

Features

  • Fiber HTTP Server with example routes, error handling and graceful shutdown
  • CLI commands management using Cobra. Root command with common logic and Serve for Web Server
  • Config management via Viper, including config validation via invopop/validation
  • Dependency Injection Container structure

Setup

Prerequisites
  • Go ≥ 1.23
  • Task
    go install github.com/go-task/task/v3/cmd/task@latest
    
Installation
git clone https://github.com/PavleProd/go-fiber-template.git
cd go-fiber-template

go mod download

Commands

  • task run: Runs serve command in temporary binary
  • task build Builds binaries into /bin folder and Runs serve command
  • task test: Runs tests with formatted output
  • task lint: Runs code linting with premade configuration (.golangci.yml)

These commands can be easily used as GitHub Actions

Example Endpoint

curl -X POST "http://localhost:8080/example"   -H "Content-Type: application/json"   -d '{"message":"hello world"}'

Response: 200 OK

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL