obsidian/wiki/tech-patterns/react-vite-typescript.md
2026-04-15 10:48:47 +01:00

3.5 KiB

title aliases tags sources created updated
React + Vite + TypeScript Frontend
react-vite
frontend-stack
react
vite
typescript
frontend
tailwind
shadcn
01 Projects/gmal-scope-builder
01 Projects/modcomms
01 Projects/semblance
01 Projects/video-accessibility
01 Projects/lusa-back-planner
01 Projects/build-a-squad
01 Projects/baic_dashboard
2026-04-15 2026-04-15

React + Vite + TypeScript Frontend

The standard Oliver frontend stack. React (18 or 19) + Vite + TypeScript, commonly paired with Tailwind CSS and shadcn/ui.

Key Takeaways

  • React 18 or 19 + Vite is the default for all new SPAs
  • Tailwind CSS (CDN for simple tools, npm for complex apps) + shadcn/ui for component-heavy UIs
  • axios for API calls; react-router for routing
  • For PDF: pdfjs-dist (parse) + jsPDF + html2canvas (export)
  • shadcn/ui (Radix UI + Tailwind) used in premium UI tools (Semblance, LUSA Back Planner)
  • Recharts for data visualization (BAIC Dashboard)

When to Use

Any new Oliver UI that needs interactivity beyond a simple HTML page.

Key Details

  • Port conventions: 3000 (default), 3010 (GMAL), 5137 (Semblance), 5173 (Vite default)
  • State management: Zustand for auth (Sandbox NotebookLM) or local state
  • API proxy: Vite proxy to backend — increase timeout for AI calls (5 min)
  • Build: npm run builddist/ folder served by nginx or Node
  • MSAL v5: use clearCache() for logout (not logout() — breaking change in v5)

Styling Variants

Tool Styling
Semblance Tailwind + shadcn/ui
LUSA Back Planner Tailwind + shadcn/ui
GMAL Scope Builder React + Vite + Axios
Mod Comms React 18 + Vite
Video Accessibility React 18 + Vite
Build A Squad React 19 + Vite
BAIC Dashboard React + Vite + Recharts

Projects Using This Pattern

Gotchas & Lessons

  • Vite proxy timeout defaults are too low for AI requests — set proxy: { timeout: 300000 } in vite.config
  • MSAL v5 breaking change: clearCache() not logout() for sign-out (GMAL fix 2026-03-30)
  • Send ID token (not Graph access token) to backend for Azure AD validation (GMAL fix 2026-03-30)
  • shadcn/ui components are copied into src/components/ui/ — they're not an npm import at runtime
  • PapaParse for CSV export is lightweight and works browser-side