Deployment
TanStack Start can be deployed to various hosting platforms. This guide covers deployment strategies and platform-specific configurations.Build Process
Before deploying, build your application:.output directory.
Deployment Targets
TanStack Start uses Nitro as its server engine, supporting multiple deployment targets.Node.js Server
Deploy as a standalone Node.js application:Configuration
Build and Run
Environment Variables
Docker Deployment
Cloudflare Workers
Deploy to Cloudflare’s edge network:Configuration
Deploy
wrangler.toml
Using Cloudflare Bindings
Vercel
Deploy to Vercel’s platform:Configuration
Deploy
Environment Variables
Add environment variables in the Vercel dashboard:- Settings → Environment Variables
- Add variables for each environment (Production, Preview, Development)
Netlify
Deploy to Netlify:netlify.toml
Deploy
AWS
AWS Lambda
Deploy as Lambda functions:AWS EC2
Deploy to EC2 instances:- Build the application
- Upload to EC2
- Install dependencies
- Run with PM2:
Static Hosting
For static-only deployments (no server functions):Configuration
Build
.output/public directory to:
- Cloudflare Pages
- GitHub Pages
- Amazon S3
- Any static host
Reverse Proxy
Run behind a reverse proxy (nginx):Environment Management
Environment Variables
Create environment-specific files:Loading Environment Variables
Performance Optimization
Caching
Implement caching strategies:Compression
Enable compression:Asset Optimization
Health Checks
Implement health check endpoints:Monitoring
Error Tracking
Integrate error tracking:Logging
Implement structured logging:CI/CD
GitHub Actions
Best Practices
-
Environment Variables
- Never commit secrets
- Use different values per environment
- Prefix client variables with
VITE_
-
Build Optimization
- Enable compression
- Split vendor bundles
- Optimize images and assets
-
Monitoring
- Set up error tracking
- Implement health checks
- Monitor performance metrics
-
Security
- Use HTTPS in production
- Set security headers
- Implement rate limiting
- Keep dependencies updated
-
Scaling
- Use CDN for static assets
- Implement caching strategies
- Consider serverless for auto-scaling
-
Backup & Recovery
- Automate database backups
- Document recovery procedures
- Test disaster recovery
Troubleshooting
Build Errors
Runtime Errors
Check logs:Performance Issues
- Enable compression
- Check database query performance
- Review bundle sizes
- Implement caching
Next Steps
- Learn about Static Generation
- Explore API Routes
- Review Middleware patterns