How abhijith-web-dev/folient-io works
1. Repository shape
- Folient Builder is a single-page React 19 + TypeScript application built with Vite.
- The repo is primarily a frontend orchestration layer: it owns the editor UI, local state, cloud API integrations, and client-side routing.
- Static hosting support is baked in via netlify.toml and public/_redirects, so the app is meant to run as a client-rendered SPA.
2. Top-level app composition
- src/main.tsx boots the app; src/App.tsx is the shell that wires routing and global UI.
- The main route set lives under src/pages/: Home, Editor, Dashboard, Community, Templates, Docs, Auth, Terms, and NotFound.
- This suggests a product split between a marketing/site surface and the authenticated builder workspace.
3. Core editor workspace
- The editor experience is concentrated in src/components/ and src/components/editor/.
- Key building blocks include the VisualCanvas, CodePanel, PropertyPanel, TopNavigationBar, LeftTelemetryPanel, and AI/chat surfaces.
- The editor subcomponents are organized by design domains: layout sections, typography, flexbox, box model, background, animation, layers, assets, and telemetry.
- Architecturally, this is a multi-panel workspace where visual editing, code inspection, and property tuning are separate but synchronized views.
4. State management boundary
- Global state is managed with Zustand stores in src/store/: useAuthStore, useEditorStore, and useProjectStore.
- These stores are the main in-memory contract between the UI panels, the editor canvas, project persistence, and auth-aware features.
- The likely flow is: user action in canvas/panel → store update → other panels re-render from the same store state.
5. Local persistence and offline project storage
- src/db/dexie.ts shows the app uses Dexie.js over IndexedDB for local persistence.
- This is the offline/cache boundary for project files and editor state, separate from cloud services.
- The repo therefore has a clear split between ephemeral UI state in Zustand and durable browser-local project storage in IndexedDB.
6. AI subsystem
- AI orchestration is centralized in src/modules/ai/AIOrchestrator.ts.
- Provider-specific adapters live alongside it: GeminiAdapter, GroqAdapter, and OpenRouterAdapter.
- src/lib/aiInferenceRouter.ts indicates a routing layer that chooses or forwards inference requests to the right model backend.
- The UI surfaces for this are the AI chatbox and telemetry/status panels, so the AI system is treated as an external intelligence service layer, not embedded logic.
7. Hosting and deployment subsystem
- src/modules/hosting/ contains PublishPanel, CloudCallback, useCloudAuth, and another useDeploymentEngine.
- src/services/DeployService.ts plus the hosting module imply a deployment pipeline that can publish generated work to external providers such as Vercel and Netlify.
- src/hooks/useDeploymentEngine.ts mirrors that concern at the app level, suggesting a shared deployment state machine used by the publish UI and status display.
- CloudCallback indicates the app expects an OAuth or redirect-based callback flow from cloud providers.
8. Community/auth/data backend
- Firebase is present via src/firebase/config.ts and firestore.rules, and the README explicitly ties it to community subscriptions, social feed, comments, and profile tracking.
- The Community, Dashboard, and Auth pages are the user-facing boundary for this backend.
- This is separate from the editor: the app appears to use Firebase for social and identity-related features, while the builder itself remains mostly client-side.
9. Supabase and secure asset storage
- Supabase integration is represented by src/services/SupabaseClient.ts, credentialSync.ts, and portfolioSync.ts.
- Based on the README, Supabase is the asset vault / media library layer for uploads and shared assets.
- CryptoService.ts and src/utils/crypto.ts suggest sensitive data is encrypted or transformed before sync, making this a distinct secure-data boundary rather than plain object storage.
10. Template and content model
- src/templates/templates.ts provides the template catalog used by the templates page and likely the editor startup flow.
- This is the product’s reusable content layer: it seeds the builder with prebuilt layouts, presets, and starter configurations.
- Templates sit between the visual editor and the project store, acting as initial state or importable project definitions.
11. Cross-cutting UX and app services
- src/hooks/useSEO.ts suggests the app also manages per-page metadata for public-facing pages.
- src/components/CookieConsentBanner.tsx and src/components/ErrorBoundary.tsx are app-wide concerns rather than feature logic.
- These sit in the shell layer and support the public marketing/community experience, not the editing core.
12. Important architectural boundaries
- The app is mostly a browser client with direct integrations to external services; there is no custom server in this repo.
- The primary boundaries are:
- UI/editor shell
- local state and IndexedDB persistence
- AI model routing
- cloud deploy/auth callbacks
- Firebase community data
- Supabase asset storage
- For an architecture diagram, the central node should be the React editor shell, with arrows out to the AI providers, Firebase, Supabase, IndexedDB, and deployment providers.
Main entry points: App.tsx App shell · Editor.tsx Editor page · useEditorStore.ts Editor store · pages Pages
Components 26
App shell
Routing, page surfaces, and shared UI concerns.
- Entry · Vite entrypoint that mounts the React app.
src/main.tsx - App shell · Top-level application shell and route wiring.
src/App.tsx - Pages · Public and authenticated page surfaces.
src/pages - SEO · Per-page metadata handling for public surfaces.
src/hooks/useSEO.ts - Consent · App-wide cookie and error boundary concerns.
src/components/CookieConsentBanner.tsx - Error boundary · Top-level runtime error containment.
src/components/ErrorBoundary.tsx
Editor workspace
Multi-panel builder UI and its synchronized editor views.
- Editor page · Route entry for the builder workspace.
src/pages/Editor.tsx - Canvas · Primary visual editing surface.
src/components/VisualCanvas.tsx - Code panel · Code-oriented inspection and editing panel.
src/components/CodePanel.tsx - Property panel · Property and styling controls for selected elements.
src/components/PropertyPanel.tsx - Top nav · Workspace navigation and editor controls.
src/components/TopNavigationBar.tsx - Telemetry · Left-side telemetry and status surface.
src/components/LeftTelemetryPanel.tsx - AI chat · User-facing AI assistance surface.
src/components/AiChatbox.tsx
State & persistence
Client state, local storage, and project data boundaries.
- Editor store · Shared in-memory editor state contract.
src/store/useEditorStore.ts - Project store · Project-level state and coordination.
src/store/useProjectStore.ts - Auth store · Authentication-aware client state.
src/store/useAuthStore.ts - IndexedDB · Browser-local durable project persistence.
src/db/dexie.ts - Templates · Starter layouts and reusable builder presets.
src/templates/templates.ts
External services
AI, hosting, auth, and backend integrations.
- AI orchestrator · Central AI request orchestration and provider routing.
src/modules/ai/AIOrchestrator.ts - Inference router · Routes inference requests across model backends.
src/lib/aiInferenceRouter.ts - Publish flow · Hosting and deployment control surface.
src/modules/hosting/PublishPanel.tsx - Deploy service · Deployment pipeline and provider integration.
src/services/DeployService.ts - Cloud callback · Redirect/callback handling for provider auth.
src/modules/hosting/CloudCallback.tsx - Firebase · Community, identity, and social data backend.
src/firebase/config.ts - Supabase · Asset storage and sync boundary.
src/services/SupabaseClient.ts - Crypto · Encryption and secure transformation layer.
src/services/CryptoService.ts
Connections 29
- Entry → App shell: mounts · Bootstraps the React application.
- App shell → Pages: routes · Dispatches to public and workspace pages.
- App shell → SEO: metadata · Updates page metadata for routed views.
- App shell → Consent: renders · Shows global consent and app chrome.
- App shell → Error boundary: guards · Wraps the app in runtime error handling.
- Pages → Editor page: workspace · Editor route enters the builder shell.
- Editor page → Top nav: contains · Workspace chrome includes top navigation.
- Editor page → Canvas: contains · Primary visual editing surface.
- Editor page → Code panel: contains · Code inspection/editing view.
- Editor page → Property panel: contains · Property inspector for selections.
- Editor page → Telemetry: contains · Telemetry/status side panel.
- Editor page → AI chat: contains · AI assistant surface in the workspace.
- Canvas → Editor store: reads/writes · Canvas updates shared editor state.
- Property panel → Editor store: reads/writes · Property changes flow through editor state.
- Code panel → Editor store: reads/writes · Code view stays synchronized with editor state.
- Telemetry → Editor store: reads · Telemetry reflects the shared editor state.
- Editor store → Project store: coordinates · Editor state feeds project-level coordination.
- Project store → IndexedDB: persists · Projects are stored durably in IndexedDB.
- Project store → Templates: seeds · Templates initialize or import project state.
- AI chat → AI orchestrator: uses · Chat UI delegates to the AI orchestrator.
- AI orchestrator → Inference router: routes · Selects or forwards model requests.
- AI orchestrator → Telemetry: reports · AI status is surfaced in telemetry panels.
- Publish flow → Deploy service: drives · Publish UI triggers deployment workflow.
- Publish flow → Cloud callback: auth callback · Handles provider redirect/callback flow.
- Deploy service → Cloud callback: auth handshake · Deployment depends on cloud auth completion.
- App shell → Firebase: community · Community and auth pages consume Firebase data.
- App shell → Supabase: assets · Asset and media features use Supabase.
- Supabase → Crypto: secures · Sensitive sync data is transformed before storage.
- Pages → Auth store: auth state · Auth pages and gated views rely on auth state.