Skip to content

Frontend Architecture

The locraft dashboard is a modern single-page application built with a carefully chosen stack optimized for developer experience and performance.

LayerTechnologyWhy
BuildVite 7 + SWC20x faster than Babel, native ESM dev server
UIReact 19Concurrent features, server actions ready
RoutingTanStack RouterType-safe routes with autoCodeSplitting: true
DataTanStack QuerySmart caching, background refetching, intent-based preload
StylingTailwind v4Zero-config via @tailwindcss/vite, no PostCSS needed
TypesTypeScript strictProject references, bundler module resolution
LintingESLint flat configstrictTypeChecked + query plugin + hooks plugin

TanStack Router’s autoCodeSplitting: true means every route is automatically chunked — no manual React.lazy() wrappers needed. Combined with Vite’s built-in tree-shaking, only the code for the current page is loaded.

Fonts are loaded via @fontsource packages (Inter, Manrope, Monaspace Krypton) — zero CDN requests, fully offline-capable, and no GDPR concerns.

The theme uses OKLch colors defined in theme.css, providing perceptually uniform lightness across the palette. This makes it trivial to create accessible contrast ratios and consistent UI.

// No retry on client errors (4xx)
// 10s stale time
// Intent-based preloading on hover

The QueryClient is configured to avoid hammering the API on user errors while keeping data fresh enough for a real-time feel.

Vendor chunks are split for optimal caching:

ChunkContentsRationale
react-vendorReact + ReactDOM (~140KB gz)Rarely changes, long cache life
routerTanStack RouterUpdates independently from app code
queryTanStack QuerySame — stable library, separate cache

Everything else uses Vite’s automatic chunking plus TanStack Router’s per-route splits.

These defaults are already optimal and don’t need overriding:

  • tsconfig.json — strict mode, ES2020 target, bundler resolution
  • eslint.config.js — flat config with all relevant plugins
  • Tailwind — v4 @tailwindcss/vite + @theme inline = zero config
  • index.html — clean, proper favicon strategy, meta tags
  • tw-animate-css — confirmed used by 15+ files for enter/exit animations