Frontend Architecture
Purpose and Scope
Next.js Application Structure
Project Layout
frontend/
├── app/ # Next.js App Router pages
│ ├── layout.tsx # Root layout with providers
│ ├── (auth)/ # Auth route group
│ │ ├── sign-in/[[...sign-in]]/
│ │ └── sign-up/[[...sign-up]]/
│ ├── sso-callback/ # Clerk SSO handler
│ ├── chat/[id]/page.tsx # Dynamic chat routes
│ └── agents/, workflows/, marketplace/, etc.
├── components/ # React components
│ ├── agents/ # Agent management UI
│ ├── chatbot/ # Chat interface
│ ├── marketplace/ # Marketplace UI
│ ├── shared/ # Reusable components
│ └── ui/ # Radix UI primitives
├── lib/ # Utilities & helpers
│ ├── api-client.ts # HTTP client
│ └── shepherd/ # Onboarding tours
├── hooks/ # React hooks
│ ├── use-agent-api.ts
│ ├── use-tools-api.ts
│ └── use-marketplace-api.ts
├── middleware.ts # Clerk authentication
└── next.config.js # Next.js configurationNext.js Configuration
Provider Hierarchy
Provider Stack Diagram
Provider Responsibilities
Provider
Purpose
Key Props
State Management
State Management Architecture
React Query (Server State)
Zustand (Client State)
Store
State
Usage
API Client Layer
API Client Architecture
Key Methods
Workspace Resolution
Component Architecture
Component Organization Diagram
Feature Module Pattern
Page Components
Key Page Routes
Dynamic Route Example: Chat Detail
Modal Wizard Pattern
Example: Create Agent Modal (5 Steps)
Wizard State Management
Form Submission Flow
Data Grid Pattern
Agent Roster Grid
Filtering Logic
Card Actions
UI Component Library
Radix UI Integration
Component
Radix Primitive
Purpose
Custom Styling Classes
Framer Motion Animations
Authentication & Route Protection
Authentication Flow
Middleware Configuration
SSO Callback Handling
User Context Access
Navigation & Layout
Sidebar Navigation Structure
Tour Data Attributes
Main Layout Pattern
Onboarding System
Tour Architecture
Tour Steps
Tour-Modal Bridge
Storage & Completion
Key Feature Modules
Agent Management Module
Component Breakdown
Component
File
Lines
Purpose
Agent Creation Flow
Agent Configuration Editor
Marketplace Module
Marketplace Tab Structure
Plugin Enablement Flow
Marketplace Admin Actions
Chat Interface Module
Chat Components
Widget Architecture
Dependencies & Versions
Core Framework
Package
Version
Purpose
Authentication
Package
Version
Purpose
State Management
Package
Version
Purpose
UI Framework
Package
Version
Purpose
Specialized Features
Package
Version
Purpose
Build & Development
Development Server
Production Build
Environment Variables
Variable
Purpose
Example
Summary
Last updated

