Deployment Overview
Deploy your MoroJS API anywhere. Step-by-step guides for each platform, quick reference tables, and troubleshooting tips.
What You'll Learn
- How to deploy to different runtime environments
- Platform-specific configuration and optimizations
- Runtime comparison and performance characteristics
- Common deployment patterns and best practices
1
Choose Your Runtime
MoroJS works across multiple runtime environments. Choose based on your needs:
Node.js
Traditional server deployment with full feature support
- Full HTTP/WebSocket support
- File system access
Vercel Edge
Ultra-fast edge runtime for global distribution
- Global edge network
- Instant cold starts
AWS Lambda
Serverless deployment with AWS ecosystem integration
- Pay per request
- Auto-scaling
Cloudflare Workers
Edge computing with global distribution
- V8 isolates
- Global network
💡 Tip: Your code works the same across all platforms. MoroJS automatically adapts to each runtime.
2
Write Universal Code
Write your API once. It works on all platforms:
src/server.ts - Works everywhere
typescript
✓ What this does: Creates a universal API that works on Node.js, Vercel, Lambda, and Cloudflare Workers.
Runtime Comparison
| Runtime | Cold Start | Throughput | Best For |
|---|---|---|---|
| Node.js | ~200ms | 136k+ req/sec | APIs, WebSockets, File processing |
| Vercel Edge | ~50ms | 45k+ req/sec | Global APIs, CDN integration |
| AWS Lambda | ~300ms | 40k+ req/sec | Event processing, AWS integration |
| Cloudflare Workers | ~10ms | 50k+ req/sec | Edge computing, Global distribution |
Common Deployment Patterns
Vercel Deployment
vercel.json
typescript
api/[...route].ts
typescript
Docker Deployment
Dockerfile
typescript
Troubleshooting
Common Issues
- •Cold start delays: Use edge runtimes (Vercel Edge, Cloudflare Workers) for faster cold starts
- •Environment variables: Ensure all required env vars are set in your deployment platform
- •File system access: Some runtimes (Lambda, Workers) have limited file system access
- •WebSocket support: Only Node.js runtime supports WebSockets natively
Best Practices
- Use environment variables for configuration
- Test locally before deploying
- Monitor cold start times and optimize
- Use platform-specific adapters for optimal performance