Vercel Edge Deployment
Deploy your MoroJS applications to Vercel Edge Runtime for ultra-fast performance and global distribution with zero cold starts.
On this page
Overview
Vercel Edge Runtime provides ultra-fast performance with zero cold starts and global distribution. MoroJS provides native support for Vercel Edge Runtime with the same API you use for Node.js development.
Edge Runtime Benefits
- • Zero cold start latency
- • Global edge deployment
- • Automatic scaling
- • Smaller bundle sizes
- • Enhanced security
Quick Start
1
Create an Edge Function
Create a file in the api/ directory:
api/hello.ts
typescript
2
Configure Vercel
Create a vercel.json file:
vercel.json
typescript
3
Deploy to Vercel
Deploy using the Vercel CLI:
Reference
Project Structure
Recommended Project Structure
typescript
Edge-Optimized Application
api/app.ts
typescript
Edge Database Integration
lib/edge-db.ts
typescript
Environment Variables
Environment Configuration
typescript
GitHub Actions Deployment
.github/workflows/deploy.yml
typescript
Troubleshooting
Function Timeout
Edge functions have a maximum execution time. Increase it in vercel.json:
Node.js APIs Not Available
Edge Runtime doesn't support all Node.js APIs. Use edge-compatible alternatives:
Environment Variables Not Loading
Ensure environment variables are set in Vercel dashboard or via CLI: