Next.js Frontend
The frontend is a modern Next.js 16 application using the App Router, React 19, and a comprehensive UI component library built on Radix UI primitives.Technology Stack
Core Dependencies
package.json
Application Structure
App Router Architecture
LatentGEO uses the Next.js App Router with React Server Components:Root Layout
app/layout.tsx
- Font optimization (Sora, Manrope, JetBrains Mono)
- Theme persistence
- Locale support
- Query client provider
- Analytics integration
API Client Generation
The frontend usesopenapi-fetch for type-safe API calls generated from the backend’s OpenAPI schema:
scripts/generate-api-client.mjs
- Full TypeScript type safety
- Auto-complete for endpoints and parameters
- Compile-time error detection
- Schema validation
Data Fetching with TanStack Query
TanStack Query (React Query) handles server state management:components/providers/query-provider.tsx
Component Architecture
UI Component Library
Built on Radix UI primitives with Tailwind CSS styling (Shadcn UI pattern):components/ui/button.tsx
- Button, Card, Dialog, Dropdown Menu
- Accordion, Tabs, Toast, Tooltip
- Form, Input, Select, Checkbox
- Progress, Slider, Switch
- And many more…
Domain Components
Business logic components for specific features:components/audit-chat-flow.tsx
Theming System
Custom theming withnext-themes and CSS variables:
components/theme-provider.tsx
app/globals.css
Form Handling
Type-safe forms with React Hook Form + Zod:Environment Configuration
Environment variables are resolved with fallbacks:lib/env.ts
Authentication Integration
Auth0 integration with automatic token management:lib/backend-auth.ts
Building & Deployment
Development
Production Build
Docker (Recommended)
Type Checking
Linting & Formatting
Performance Optimization
- Font optimization: Next.js font loading with
next/font - Image optimization:
next/imagefor automatic optimization - Code splitting: Automatic with App Router
- Tree shaking: Unused code elimination
- Bundle analysis: Monitor bundle size
Next Steps
Backend Architecture
Learn about the FastAPI backend
Real-time System
Deep dive into SSE implementation