The production-ready template for building server-side rendered (SSR) React applications with Vite.
This repository complements the article: Building Production-Ready SSR React Applications
Add React or client-side libraries as regular dependencies:
npm install reactAdd server-side packages (e.g., express) as devDependencies:
npm install express --save-devThen, include the package in the server build by updating the tsup.config.ts:
import { defineConfig } from 'tsup'
export default defineConfig({
entry: ['server'],
outDir: 'dist/server',
target: 'node22',
format: ['cjs'],
clean: true,
minify: true,
external: ['lightningcss', 'esbuild', 'vite'],
noExternal: ['express', 'sirv', 'compression'], // Include server packages here
})