Deployment
TanStack Start applications can be deployed to any hosting platform that supports Node.js. This guide covers deployment strategies, platform-specific configurations, and production optimizations.Build Process
Before deploying, build your application for production:- Bundles client code - Creates optimized JavaScript bundles
- Bundles server code - Creates a production server bundle
- Generates manifests - Creates asset manifests for SSR
- Optimizes assets - Minifies and compresses static files
- Code splitting - Splits code by route for optimal loading
Hosting Platforms
Nitro-based Deployment
TanStack Start uses Nitro for universal deployment:examples/react/start-basic/vite.config.ts:1-22
Vercel
Deploy to Vercel with zero configuration:- Install Vercel CLI:
pnpm add -g vercel - Run:
vercel - Follow the prompts
Netlify
Configure Netlify deployment:Cloudflare Workers
Deploy to Cloudflare Workers:AWS Lambda
Deploy to AWS Lambda:Docker
Deploy with Docker:Self-hosted / VPS
Deploy to a VPS with Node.js:Environment Variables
Manage environment variables securely:Development
Production
Accessing in Code
Asset Optimization
CDN Configuration
Serve static assets from a CDN:packages/start-server-core/src/createStartHandler.ts:59-111
Dynamic CDN URLs
Use different CDN URLs per request:packages/start-server-core/src/createStartHandler.ts:83-95
Cache Headers
Set aggressive caching for static assets:Performance Optimization
1. Enable Compression
2. Database Connection Pooling
3. Response Caching
4. Code Splitting
Lazy load routes and components:5. Bundle Analysis
Monitoring and Logging
Error Tracking
Performance Monitoring
Security
1. Security Headers
2. Rate Limiting
3. CORS Configuration
Health Checks
Rollback Strategy
Implement safe deployments:Next Steps
- Explore Full-Stack Architecture to understand how it all fits together
- Learn about Server Functions for client-server communication
- Review SSR for server-side rendering concepts
- Understand Streaming for progressive data loading