An opionated production-ready starter template (included Swagger Docs) for deploying Go Fiber applications on Vercel's serverless platform.
- Go Fiber v2: High-performance web framework
- Vercel Deployment: Optimized for serverless deployment
- Swagger Documentation: API documentation using Swagger
- Hot Reload: Development with Air for automatic rebuilds
- Structured Logging: Using Uber's Zap logger
- High Performance: Using ByteDance's Sonic for JSON handling and Protocol Buffers for Data Representation
- Go 1.23.1 or later
- Vercel CLI (for deployment)
- Air (for development)
.
├── cmd/
│ └── app/
│ ├── development/ # Development environment entry
│ └── production/ # Production environment entry
├── pkg/ # Package code
├── tmp/ # Temporary build files
├── .air.toml # Air configuration for hot reload
├── go.mod # Go modules file
├── go.sum # Go modules checksum
└── vercel.json # Vercel deployment configuration
-
Clone the repository:
git clone <repository-url> cd go-fiber-vercel-starter
-
Install dependencies:
go mod download
-
Run development server (with hot reload):
air
The project uses Air for hot reload during development. The configuration in .air.toml watches for file changes and automatically rebuilds the application.
This project is configured for deployment on Vercel. The vercel.json configuration includes:
- Entry point:
cmd/app/production/main.go - Supported HTTP methods: GET, POST, PUT, DELETE, PATCH, OPTIONS
- Automatic routing configuration
To deploy:
-
Install Vercel CLI:
npm i -g vercel
-
Deploy to Vercel:
vercel
Key packages used in this project:
github.com/gofiber/fiber/v2: Web frameworkgithub.com/gofiber/contrib/swagger: API documentationgithub.com/gofiber/contrib/fiberzap/v2: Structured logginggithub.com/bytedance/sonic: Fast JSON serializationgo.uber.org/zap: Logging
This project is open-source and available under the MIT License.