SSR Overview
TanStack Router
File-based routing Type-safe navigation
Vite SSR
Fast builds HMR support
Direct API Call
No HTTP overhead Fast response
TanStack Query
Automated Hydration Caching integration
Sonamu SSR Architecture
Sonamu implements SSR using TanStack Router + Vite.Core Components
entry-server.generated.tsx
Entry point for rendering React on the server (auto-generated):entry-client.tsx
Entry point for hydrating React on the client:TanStack Router Route Structure
Root Route
File Route
Dynamic Route
Vite Configuration
SSR vs CSR
Sonamu uses a hybrid approach:SSR Rendering (when data preloading)
- Fast First Contentful Paint
- SEO optimization
- Immediate display of initial data
CSR Rendering (default)
- Reduced server load
- Simple implementation
- Fast development
Development vs Production
Development Mode
dev all: API server integrates Vite to serve API + Web on a single port (HMR supported)dev api: Runs API only. Use when Web is not needed or when running Vite separatelydev web: Runs Vite dev server standalone. Pass Vite options after--
Production Build
Cautions
Next Steps
Data Preloading
How to use registerSSR
Hydration Strategies
Hydration optimization
Cache Control
TanStack Query caching
TanStack Router Docs
Router detailed guide