Prerequisites
- A Netlify account (sign up here)
- Node.js and pnpm (or npm/yarn) installed
- A TanStack Start application
Quick Start with CLI
The fastest way to deploy is using the Netlify CLI:1. Install Plugin
Install the official Netlify plugin for TanStack Start:2. Update Vite Config
Add the Netlify plugin to yourvite.config.ts:
3. Deploy
Use the Netlify CLI to deploy:- Link or create a new site
- Configure build settings (automatically detected)
Benefits of the Netlify Plugin
The@netlify/vite-plugin-tanstack-start plugin provides:
- Automatic build configuration for Netlify deployment
- Full platform emulation in local development
- Edge Functions support out of the box
- Image optimization integration
- Environment variables handling
Manual Configuration
If you prefer manual configuration, create anetlify.toml file:
You can also configure these settings directly in the Netlify dashboard under Site settings > Build & deploy.
Environment Variables
In Netlify Dashboard
- Go to Site settings > Environment variables
- Add your variables
- Choose the deploy context (production, preview, or branch)
In netlify.toml
Accessing Variables
Environment variables are available in your server functions:Deployment Methods
Netlify supports multiple deployment workflows:Git-Based Deployment
- Push your code to GitHub, GitLab, or Bitbucket
- Connect your repository in the Netlify dashboard
- Netlify automatically deploys on every push
- Automatic deployments on git push
- Deploy previews for pull requests
- Rollback to any previous deployment
CLI Deployment
Deploy directly from your terminal:Continuous Deployment
Netlify automatically builds and deploys when:- You push to your main branch (production)
- You open a pull request (deploy preview)
- You push to any branch (branch deploys, if enabled)
Build Configuration
Build Commands
Configure build commands innetlify.toml:
Post-Processing
Disable Netlify post-processing if needed:Advanced Features
Netlify Edge Functions
The Netlify plugin automatically configures your server functions to run on Netlify Edge Functions for optimal performance.Headers Configuration
Custom headers innetlify.toml:
Redirects and Rewrites
Split Testing
A/B test different branches:Deploy Previews
Netlify automatically creates deploy previews for pull requests:- Open a pull request
- Netlify builds and deploys a preview
- Preview URL is posted as a comment
- Test changes before merging
Configure Deploy Previews
Custom Domains
Add a Custom Domain
- Go to Site settings > Domain management
- Click Add custom domain
- Follow DNS configuration instructions
Domain Configuration in netlify.toml
Performance Optimization
Asset Optimization
Netlify automatically optimizes:- Image compression
- CSS and JavaScript minification
- Brotli compression
Caching
Control caching with headers:Monitoring and Analytics
Netlify provides built-in analytics:- Go to Analytics in your site dashboard
- Enable Netlify Analytics (paid feature)
- View traffic, top pages, and more
Resources
- Netlify Documentation
- TanStack Start on Netlify Guide
- Netlify CLI Documentation
- Netlify Plugin Repository
Troubleshooting
Build Failures
If your build fails:- Check the build logs in Netlify dashboard
- Verify Node.js version: add
NODE_VERSION = "20"to build environment - Ensure all dependencies are in
package.json - Clear cache and retry: Deploys > Trigger deploy > Clear cache and deploy site
Function Errors
For server function issues:- Check Functions tab in Netlify dashboard for logs
- Verify environment variables are set correctly
- Test locally with the Netlify plugin’s emulation
Deploy Preview Issues
If deploy previews aren’t working:- Check Site settings > Build & deploy > Deploy contexts
- Ensure deploy previews are enabled
- Verify branch deploy settings
Domain Issues
For custom domain problems:- Verify DNS records are configured correctly
- Wait for DNS propagation (can take up to 48 hours)
- Check Site settings > Domain management for status
- Ensure domain is not already used by another Netlify site