Skip to main content

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:
The build process:
  1. Bundles client code - Creates optimized JavaScript bundles
  2. Bundles server code - Creates a production server bundle
  3. Generates manifests - Creates asset manifests for SSR
  4. Optimizes assets - Minifies and compresses static files
  5. Code splitting - Splits code by route for optimal loading

Hosting Platforms

Nitro-based Deployment

TanStack Start uses Nitro for universal deployment:
Reference: examples/react/start-basic/vite.config.ts:1-22

Vercel

Deploy to Vercel with zero configuration:
Deployment steps:
  1. Install Vercel CLI: pnpm add -g vercel
  2. Run: vercel
  3. Follow the prompts

Netlify

Configure Netlify deployment:

Cloudflare Workers

Deploy to Cloudflare Workers:
Deploy with Wrangler:

AWS Lambda

Deploy to AWS Lambda:
Deploy with AWS CDK:

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:
This transforms all asset URLs:
Reference: packages/start-server-core/src/createStartHandler.ts:59-111

Dynamic CDN URLs

Use different CDN URLs per request:
Reference: 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