API Vercel
An API template optimized for Vercel deployment
jzero new simpleapi-vercel --branch api-vercel
Features
- RESTful API structure
- Vercel serverless deployment
- Built-in middleware
Getting Started Guide
API Vercel Template Guide
Overview
jzero deeply integrates with Vercel ecosystem, bringing Go developers a frontend-level deployment experience! Automatically generate Vercel-compliant serverless functions from .api definitions, no need to deploy to your own servers.
Core Value
- ✅ Zero-Config Deployment: Deploy directly from Git repository, no extra configuration needed, no servers required, no CI/CD pipeline
- ✅ Global Edge Network: Deploy Go functions to edge nodes nearest to users using Vercel's global infrastructure, achieving millisecond-level response
- ✅ Free Domain & HTTPS: Automatically get
.vercel.appproduction-grade domain with built-in CDN acceleration and SSL certificates - ✅ Preview Environments: Automatically generate independent preview URLs for each PR
Quick Start
Install jzero
# Install jzero
go install github.com/jzero-io/jzero@latest
# Install related tools
jzero check
go install github.com/jzero-io/gorename@latestCreate Vercel Project
# Create new Vercel serverless project from remote template
jzero new jzero-api-vercel-example --remote https://github.com/jzero-io/templates --branch api-vercel
# Add new api
jzero add api test
# Generate code
jzero genProject Structure
jzero-api-vercel-example/
├── vercel/
│ └── client.go # Vercel Go runtime entry
├── desc/ # API definitions
│ └── api/ # .api files
├── server/ # Server side
│ ├── handler/ # HTTP handlers
│ ├── logic/ # Business logic
│ └── types/ # Type definitions
├── vercel.json # Vercel platform configuration
├── main.go # Local runtime entry
└── go.mod # Go module fileDeploy to Vercel
Git Push to Deploy
jzero-generated projects are fully compatible with Vercel's Git workflow for automatic deployment:
cd jzero-api-vercel-example
# Initialize git
git init
git add .
git commit -m "Initial commit"
# Create repository on GitHub and push
git remote add origin https://github.com/your-username/jzero-api-vercel-example.git
git push -u origin mainVercel Platform Auto-Detection
- Visit Vercel Dashboard
- Click "Add New Project"
- Import your GitHub repository
vercel.jsonconfiguration lets Vercel automatically recognize it as a Go project- Click "Deploy"
🎉 Deployment complete! Your Go API is now connected to Vercel's global network