Documentation Index
Fetch the complete documentation index at: https://mintlify.com/egeuysall/ryva-archive/llms.txt
Use this file to discover all available pages before exploring further.
Frontend Architecture
The Ryva frontend is built with Next.js 16 using the App Router, React 19, and TypeScript in strict mode. It follows modern React best practices with server-first rendering and client-side interactivity where needed.Technology Stack
Core Framework
- Next.js 16 - App Router with Server Components
- React 19 - Latest features and performance improvements
- TypeScript 5.9 - Strict mode, no any types
Styling & UI
- Tailwind CSS v4 - Utility-first styling
- Radix UI - Accessible component primitives
- Lucide React - Icon library
- Motion - Animation library
State Management
- TanStack Query - Server state, caching, mutations
- Zustand - Client state, UI state
- React Hook Form - Form state management
Data & APIs
- Supabase - Authentication (SSR-compatible)
- Custom API Client - Backend communication
- Stripe - Payment processing
- Sanity - Content management (blog)
Project Structure
App Router Architecture
Route Groups
Ryva uses Next.js route groups to organize pages by feature without affecting the URL structure:(auth) - Authentication Routes
(auth) - Authentication Routes
/login- Login page/signup- Registration page/forgot-password- Password reset request/reset-password- Password reset form/onboarding- New user onboarding/auth/callback- OAuth callback handler
(dashbord) - Application Dashboard
(dashbord) - Application Dashboard
/app- Main dashboard/app/projects- Projects view/app/settings/*- User settings/app/settings/organizations- Org settings/app/settings/billing- Billing management/app/invitations- Organization invitations/app/checkout- Subscription checkout
(marketing) - Public Pages
(marketing) - Public Pages
/- Landing page/docs/*- Documentation (MDX)/blog/*- Blog posts (Sanity CMS)/pricing- Pricing page
(admin) - Admin Panel
(admin) - Admin Panel
/admin- Sanity Studio
Server vs Client Components
Ryva follows the Server Components by default principle. Client Components are only used when necessary.
- Used for: Data fetching, layouts, static content
- Benefits: Faster initial load, smaller bundle, SEO-friendly
- Example: Page layouts, marketing pages, documentation
'use client'):
- Used for: Interactivity, browser APIs, state, effects
- Required for: Event handlers, useState, useEffect, browser-only APIs
- Example: Forms, modals, interactive widgets
State Management Strategy
TanStack Query - Server State
Used for all data fetching, caching, and synchronization with the backend API.
- Automatic caching and deduplication
- Background refetching
- Optimistic updates
- Retry logic
- Loading and error states
Zustand - Client State
Used for client-side UI state, user preferences, and ephemeral data that doesn’t need to sync with the server.
When to Use Each
| Use TanStack Query | Use Zustand |
|---|---|
| User profile data | UI state (modals, dropdowns) |
| Organizations list | Theme preference |
| Subscription status | Current sidebar state |
| API-sourced data | Form drafts (before submit) |
| Cached server state | Client-only preferences |
Module Architecture
Each feature module follows a consistent structure:Example: Auth Module
Components (apps/web/src/modules/auth/components/login-form.tsx):- Handles UI rendering and user interactions
- Uses React Hook Form for form state
- Calls Supabase auth methods
- Displays errors via toast notifications
- Wraps API calls in TanStack Query hooks
- Provides query keys for cache management
- Handles loading and error states
- Implements optimistic updates
- Defines TypeScript interfaces for the module
- Ensures type safety across components and hooks
API Client Architecture
The API client (apps/web/src/lib/api/client.ts:1-164) handles all communication with the Go backend:Features
Authentication
Automatically attaches JWT token from Supabase session to all requests
Type Safety
Generic types ensure responses are properly typed
Error Handling
Standardized error responses with automatic retry logic
Timeout Handling
30-second timeout with AbortController
Implementation
Usage
Authentication Flow
Supabase SSR Integration
Ryva uses Supabase Auth with SSR support for seamless authentication:-
Client-side (apps/web/src/lib/supabase/client.ts):
- Used in Client Components
- Handles auth state changes
- Provides session management
-
Server-side (apps/web/src/lib/supabase/server.ts):
- Used in Server Components and API routes
- Cookie-based session management
- SSR-compatible authentication
Auth Flow Diagram
Form Handling
React Hook Form + Zod
All forms use React Hook Form with Zod schema validation:UI Component Library
Radix UI Components
Thecomponents/ui/ directory contains reusable components built on Radix UI primitives:
- Button - Styled button with variants
- Dialog - Accessible modal dialogs
- Dropdown Menu - Context menus and dropdowns
- Select - Custom select inputs
- Checkbox - Accessible checkboxes
- Switch - Toggle switches
- Tooltip - Hover tooltips
Component Pattern
Styling Strategy
Tailwind CSS v4
Ryva uses Tailwind CSS v4 with the new PostCSS plugin for improved performance.
- Utility-first CSS
- Dark mode support (
dark:prefix) - Custom design tokens
- Responsive design (
sm:,md:,lg:,xl:)
Class Variance Authority (CVA)
Used for creating component variants:Performance Optimizations
Server Components
Default to Server Components to reduce JavaScript bundle size and improve initial load time
Code Splitting
Next.js App Router automatically code-splits by route
Image Optimization
Use
next/image for automatic optimization and lazy loadingQuery Caching
TanStack Query caches API responses and deduplicates requests
Font Optimization
Next.js automatically optimizes and inlines fonts
Bundle Analysis
Use
@next/bundle-analyzer to identify large dependenciesTesting Strategy
Unit Tests (Vitest)
E2E Tests (Playwright)
Development Workflow
Local Development
Build & Type Check
Best Practices
Component Organization
Component Organization
- Keep components small and focused
- Use Server Components by default
- Extract reusable logic into hooks
- Co-locate related files in modules
Type Safety
Type Safety
- No
anytypes (enforced by ESLint) - Define interfaces for all props
- Use Zod for runtime validation
- Type all API responses
Performance
Performance
- Lazy load heavy components
- Use React.memo() sparingly (profile first)
- Optimize images with next/image
- Keep bundle size under control
Accessibility
Accessibility
- Use semantic HTML
- Radix UI components are accessible by default
- Test with keyboard navigation
- Provide ARIA labels where needed
Next Steps
Backend Architecture
Learn about the Go API structure and clean architecture
State Management
Deep dive into TanStack Query and Zustand usage