src/routes, and betterRouter() already registers @/ and @vitejs/plugin-react.
1. Install better-router
Use the Quickstart through step 2 (plugin enabled, default Vite entry files removed). You will add_document.tsx in step 2 below for global CSS.
2. Tailwind CSS v4
src/styles/globals.css):
src/styles/globals.css
src/routes/_document.tsx (see Document (_document) — side-effect import; the plugin mirrors it on the client entry):
src/routes/_document.tsx
3. TypeScript paths
Add the@/* alias to tsconfig.json (same as the shadcn docs). If you kept Vite’s split config instead of the Quickstart tsconfig.json, add the same paths block to tsconfig.app.json:
tsconfig.json
betterRouter() also sets @ → src in Vite. You still want the tsconfig paths so the editor and shadcn CLI agree.
4. Vite config
Do not add@vitejs/plugin-react again. Add Tailwind next to betterRouter():
vite.config.ts
@ alias in vite.config.ts, you can skip it — the plugin already resolves @/ to src/.
5. Initialize shadcn/ui
From the project root:components.json, updates src/styles/globals.css with theme tokens, and adds utilities under src/lib (and often a starter component under src/components/ui).
6. Add a component and use it on a route
src/routes/index.tsx
7. Run and preview
http://localhost:5173 and confirm the button renders with shadcn styles.
npm run build still emits dist/client and dist/server. For a static asset check only, vite preview serves client assets — it is not the full SSR app. Use npm run dev or your production server (see Deployment) to verify SSR + hydration.
Client env with shadcn
Only variables prefixed withPUBLIC_ are exposed to the browser via import.meta.env. See Environment and secrets.