๐ฅ๏ธ Frontend Guide
This document describes the primary pages, services, and components of the React Frontend within the orchable module.
1. src/ Directory Structureโ
src/
โโโ App.tsx # Main Router (React Router v6)
โโโ pages/ # Application Pages
โ โโโ Home.tsx # Landing page
โ โโโ Designer.tsx # Orchestrator Designer (wrapper)
โ โโโ Launcher.tsx # Batch Launching
โ โโโ Monitor.tsx # Progress Monitoring
โ โโโ BatchProgress.tsx# Detailed Batch View
โ โโโ AssetLibrary.tsx # Prompt Template + Custom Component Management
โ โโโ Calculator.tsx # Token Cost Estimation
โ โโโ Settings.tsx # System Settings
โ โโโ Login.tsx # Email/Google Login
โ โโโ NotFound.tsx # 404 Page
โโโ components/
โ โโโ designer/ # Orchestrator Designer (ReactFlow)
โ โ โโโ StageConfigPanel.tsx # Stage Configuration Panel
โ โ โโโ ContractSection.tsx # IO Schema editor
โ โ โโโ PromptEditorDialog.tsx # Rich prompt editor (reused in AssetLibrary)
โ โ โโโ OutputSchemaEditor.tsx # JSON Schema visual editor
โ โ โโโ IconPicker.tsx # Lucide Icon Picker for stages
โ โ โโโ PrePostProcessSection.tsx # Hooks configuration
โ โโโ batch/ # Monitor/Batch Components
โ โ โโโ TaskHierarchyTree.tsx # Task tree with result viewing + component editing
โ โ โโโ ComponentEditor.tsx # TSX Component editor (sandbox)
โ โ โโโ CustomComponentRenderer.tsx # Renders TSX within the sandbox
โ โ โโโ SchemaRenderer.tsx # Renders JSON schema (hide/show columns)
โ โ โโโ MergeResultsPanel.tsx # Merges results from multiple tasks
โ โโโ common/
โ โโโ AppSidebar.tsx # Navigation sidebar
โ โโโ IconPicker.tsx # (shared)
โโโ services/
โ โโโ stageService.ts # CRUD for prompt_templates + custom_components
โ โโโ pricingService.ts # Fetches Gemini pricing table
โ โโโ taskActionService.ts # Retry, Delete task/batch
โ โโโ executionTrackingService.ts # Real-time execution tracking
โ โโโ executionService.ts # Execution initialization
โ โโโ configService.ts # Orchestrator configuration reader
โ โโโ compilerService.ts # Compiles TSX using Sucrase
โ โโโ n8nService.ts # n8n API integration
โโโ stores/
โ โโโ designerStore.ts # Zustand store for Designer state
โโโ lib/
โ โโโ types.ts # Global TypeScript types
โ โโโ supabase.ts # Supabase client
โ โโโ utils.ts # cn() and utilities
โ โโโ icons.ts # ICONS Registry (Lucide)
โ โโโ schemaUtils.ts # JSON Schema processing utilities
โ โโโ componentSandbox.ts # Sandbox validation + execution
โ โโโ constants/ # Constants (default configs, etc.)
โโโ contexts/
โโโ AuthContext.tsx # Auth state (currentUser, signIn, signOut)
2. Primary Pagesโ
๐จ Designer (/designer)โ
The node-graph-based Orchestrator design interface (ReactFlow).
Features:
- Drag-and-drop addition of new Stages.
- Connect Stages by dragging edges.
StageConfigPanel(right sidebar): Detailed configuration for each stage across 6 tabs (Basic, Prompt, IO, AI, Hooks, Visual).- Load configurations from the library (Recent Configs).
- Export/Import stage configurations (JSON).
- Save Config: Synchronizes all stages to Supabase
prompt_templatesviasyncStagesToPromptTemplates().
๐ Launcher (/launcher)โ
Select pre-configured Orchestrators and upload data to run batches.
Features:
- List of Orchestrator configs with graph previews.
- Excel/CSV Upload โ Data preview.
- Batch configuration (name, launch parameters).
- Create batch and redirect to Monitor.
๐ Monitor (/batch/:id and /monitor)โ
Tracks execution progress in real-time.
Features:
- Real-time task status updates (Supabase Realtime).
- Filtering by stage and status.
TaskHierarchyTree: In-depth task details in a tree structure.- Formatted results viewing (Custom Component) or Raw JSON.
- View Component editing (TSX sandbox).
- CSV Export.
- Results Merging.
- Retry individual failed tasks / Retry All Failed.
- Delete batches.
๐ Asset Library (/assets)โ
Centralized management for Prompt Templates and Custom Components (TSX).
Tabs:
- View Components: List of
custom_componentswith card previews. Opens theComponentEditorfor code sandbox editing. - Prompt Templates: List of
prompt_templates. Edit prompts usingPromptEditorDialog(syntax highlighting, variable scanning, delimiter configuration).
๐งฎ Calculator (/calculator)โ
Estimates Gemini API token costs before running large batches.
Features:
- Select Orchestrator configuration.
- Upload sample data.
- Precise input token calculation (from actual prompt + data).
- Output token estimation (from output schema).
- Cost breakdown by stage and cardinality.
- Live pricing table fetched from the Gemini pricing page.
3. Key Servicesโ
stageService.tsโ
syncStagesToPromptTemplates(): Syncs Orchestrator stages โ Supabaseprompt_templates.getCustomComponents(): Fetches custom components.createCustomComponent()/updateCustomComponent(): Component CRUD.linkTemplateToComponent(): Links a template to a component.updateTemplateCustomComponent(): Saves local TSX overrides toview_config.
taskActionService.tsโ
retryTask(id): Resets a task status toplan.retryAllFailedInBatch(batchId): Retries all failed tasks within a batch.deleteBatch(batchId): Deletes a batch with cascading task deletion.
pricingService.tsโ
- Fetches Gemini pricing from the Google AI pricing page.
- Caches results to minimize requests.
executionTrackingService.tsโ
- Subscribes to Supabase Realtime for task status updates.
- Calculates batch progress (total / completed / failed).
compilerService.tsโ
- Compiles TSX source code using Sucrase within the browser.
- Injects global scope (React, shadcn/ui components, Lucide icons, cn utility).
- Performs security validation prior to execution.
4. Custom Component Sandboxโ
Users can write TSX Components to render task output in specialized ways:
// Basic structure
const Component = ({ data, schema }) => {
return <div>{data.some_field}</div>;
};
Available Globals in Sandbox:
React,useState,useEffect,useMemo,useCallback.cn(classNames utility).- All shadcn/ui components:
Badge,Card,Table,Button, etc. - All Lucide icons.
- Forbidden:
window,fetch,eval,document.createElement.
Execution Flow:
- Validation (checking for dangerous patterns).
- Sucrase compilation (TSX โ JS).
- Execution within a function scope with injected globals.
Componentextraction and rendering withdata=task.output_data.
5. Authentication Flowโ
graph LR
User -->|"Visit App"| AuthGuard
AuthGuard -->|"No session"| Login
Login -->|"Email OTP"| Supabase
Login -->|"Google OAuth"| Supabase
Supabase -->|"Session"| AuthContext
AuthContext -->|"currentUser"| App
AuthContext(contexts/AuthContext.tsx): ProvidescurrentUser,signIn(),signOut(), andloadingstate.- Route protection: All routes require
currentUser !== null. - Supabase RLS:
auth.uid()is used to filter data by user.
Last Updated: 2026-02-24