
Template details
vercel-golang
A Go framework on Vercel based on Gin, supporting API routes and html/template.
About this template
vercel-golang is a Go boilerplate built on the Gin framework that lets you deploy a serverless API or HTML-rendering service to Vercel, with MySQL, Redis, logging, and notification integrations wired in.
What is vercel-golang?
vercel-golang is an open-source template by iszmxw for running Go (Gin) applications on Vercel's serverless platform. It accepts your Go route handlers, GORM models, and html/template views plus a JSON configuration, and compiles them into a Vercel deployment. The template includes a one-click Deploy with Vercel button that clones the repository and prompts for the required CONFIG environment variable.
Key Features
- Gin-based framework — Wraps Gin in a secondary framework layer that supports both API routes and Go's html/template for server-rendered pages.
- One-click Vercel deploy — The repository includes a Deploy with Vercel button that creates a new project, clones the repo, and sets the CONFIG environment variable.
- GORM model generator — A bundled tool at
bin/gormt.goconnects to a MySQL database and auto-refreshes the GORM model files under./app/modelswhen you rungo run bin/gormt.go. - Dual configuration modes — Local development reads
application.yaml(activated by settingDEV=1andTLS=falsein a.envfile), while Vercel deployments read a JSON string from theCONFIGenvironment variable. - Database and cache support — Pre-configured to work with MySQL and Redis, including Vercel KV storage, with prefix support for tables (
DB_PREFIX). - Logging and notifications — Logs can be written to MySQL with debug, error, and warning toggles, and the template includes Bark (iOS push) and WeChat bot integration via URL and GUID keys.
- Local development workflow — After installing Go 1.18.10+ and pnpm, you run
go mod tidy, install the Vercel CLI globally, and usevercel devfor local serverless testing.
Who is it for?
- Go developers who want to run a Gin server on Vercel without maintaining a separate serverless adapter.
- Full-stack developers who need API endpoints plus server-rendered HTML pages in one Go deployment.
- Developers already using MySQL or Redis who want a template that wires in GORM, connection settings, and Vercel KV storage out of the box.
- Teams that want notifications after events — the template supports Bark and WeChat bot push with minimal JSON setup.
What can you do with it?
- Build serverless REST APIs — Define Gin routes that run as Vercel functions, with MySQL and Redis support.
- Serve dynamic HTML pages — Use Go's html/template engine to render pages that share the same backend logic as your API.
- Automate model generation — Generate GORM models from an existing database schema using the included
gormt.gotool. - Send push notifications — Trigger Bark iOS notifications or WeChat bot messages from any route by supplying the pre-wired keys.
How does vercel-golang work?
Start by forking the repository and cloning it locally. Then run go mod tidy, install the Vercel CLI with pnpm, and log in with vercel login. For local development, copy .env.example to .env, set TLS=false, and provide a CONFIG JSON string, then run vercel dev or go run main.go with DEV=1 in .env to use application.yaml instead. For deployment, set the same CONFIG JSON in the Vercel dashboard's environment variables and deploy.
FAQ
Is vercel-golang free to use?
Yes, the template is open source and does not require a paid license. You only pay Vercel's hosting costs, which have a free tier for hobby projects.
What Go version is required?
The repository recommends Go 1.18.10 or higher for local development. Vercel's Go runtime will use the supported Go version available at deploy time.
How do I configure MySQL and Redis?
Set the database and cache fields inside the CONFIG JSON environment variable, including DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD, REDIS_HOST, and REDIS_PORT. The template also supports a table prefix via DB_PREFIX.
Does it support server-side HTML templates?
Yes, the framework wraps Gin to serve Go's html/template views, so you can render dynamic pages from the same application.
What is the DEV=1 environment variable for?
When running locally without Vercel, setting DEV=1 in a .env file tells the application to load application.yaml instead of the CONFIG environment variable, so you can develop against a plain Go server.
















