From Zero to Production in 5 Minutes
Deploy a production-ready Gati API in 5 minutes.
Minute 1: Create Project
bash
npx gatic create my-api
cd my-apiGenerated:
- Handler structure
- Configuration
- Docker setup
- K8s manifests
Minute 2: Write Handler
typescript
// src/handlers/users/[id].ts
export const handler: Handler = async (req, res, gctx) => {
const user = await gctx.modules['db'].users.findById(req.params.id);
res.json({ user });
};Auto-configured:
- Routing:
GET /users/:id - Validation
- Error handling
- Logging
Minute 3: Test Locally
bash
pnpm dev
curl http://localhost:3000/users/123Includes:
- Hot reload (50-200ms)
- Request tracking
- Debug playground
Minute 4: Build
bash
pnpm buildGenerates:
- Optimized bundle
- Docker image
- K8s manifests
- Health checks
Minute 5: Deploy
bash
gati deploy prod --provider awsAutomatic:
- Container build
- Registry push
- K8s deployment
- Auto-scaling
- Load balancing
What You Get
✅ Production-ready
- Health checks
- Metrics
- Logging
- Error tracking
✅ Auto-scaling
- HPA configured
- 2-10 replicas
- CPU-based scaling
✅ Zero-config
- No Dockerfile needed
- No K8s YAML needed
- No CI/CD setup needed
Traditional vs Gati
Traditional (2-3 days)
- Write code
- Write Dockerfile
- Write K8s manifests
- Setup CI/CD
- Configure monitoring
- Deploy
Gati (5 minutes)
- Write code
gati deploy prod
Real Example
bash
# Create
npx gatic create blog-api
# Add handler
cat > src/handlers/posts/[id].ts << EOF
export const handler: Handler = async (req, res, gctx) => {
const post = await gctx.modules['db'].posts.findById(req.params.id);
res.json({ post });
};
EOF
# Deploy
gati deploy prod --provider aws --cluster production
# Done! API live at https://api.example.comWhat's Happening Behind the Scenes
- Build: Optimized bundle with tree-shaking
- Containerize: Multi-stage Docker build
- Deploy: Rolling update to K8s
- Configure: HPA, Ingress, Service
- Monitor: Metrics, logs, traces
Next Steps
- Add more handlers
- Configure auto-scaling
- Setup custom domain
- Enable monitoring