How shafwansafi06/cortex-one-ai works
Project type and purpose
• This is a single-page frontend application (React + TypeScript) built with Vite.
• It simulates an enterprise AI dashboard (“CortexOne”) that unifies HR, Finance, and Support insights via reusable UI components and local mock JSON endpoints (with a future option to swap in real Supabase or other API backends).
File structure
Top-level:
• public/
– mock-data/ (static JSON endpoints: hr.json, finance.json)
– robots.txt, logo.svg
• src/
– components/ (layout, UI primitives, and domain mockup composites)
– pages/ (Auth, Dashboard, HR, Finance, Support, Demo, Settings, NotFound)
– integrations/supabase (client, types)
– lib/ (shared helpers: auth, motion, utils)
– hooks/ (custom React hooks)
– data/demoData.ts (demo flows)
– App.tsx, main.tsx, index.css
Configuration and build:
• vite.config.ts, tsconfig*.json, tailwind.config.ts, postcss.config.js, eslint.config.js
• supabase/config.toml (local Supabase emulator or deployment)
Key insights from README
• Frontend only; no dedicated backend in this repo
• Local JSON files under public/mock-data are fetched like API endpoints
• Supabase integration scaffold is in place (client.ts, config.toml) for auth or live data
• Clear, reusable UI components and rapid model-swap capability
Main components & relationships
A. Presentation Layer (Client Browser / SPA)
• App Shell (App.tsx → AuthGuard, Layout, NavBar, Sidebar)
• Pages (Dashboard, HR, Finance, Support, Demo, Settings)
• UI Primitives (components/ui/*) & Mockup composites (components/mockups/*)
B. Data Access Layer (in-browser fetches)
• Static Mock API (public/mock-data/*.json)
• Supabase Client (integrations/supabase/client.ts)
– Auth workflows (sign-in/signup)
– Real-time data or user data
C. Build & Deployment
• Vite Dev Server (for local demo) → serves index.html + public files + HMR
• Production Build → Static hosting (Netlify, Vercel, S3, etc.)
D. External Services
• Supabase (Auth, Database)
• Future AI/model endpoints (swap into mock-data)
Architectural patterns & principles
• Component-based UI (separation of layout, primitives, and domain mockups)
• Logical layering: Presentation (components/pages) → Data (fetch layer) → External
• Single source of truth for styling: Tailwind + CSS modules (index.css, App.css)
• Extensibility: mock-data endpoints mirror real API contract for easy swap-out
• Client-only, serverless mindset: minimal backend dependencies
Detailed breakdown to capture essential elements
• NavBar, Sidebar (layout comps)
• AuthGuard (route guard logic)
• Branch out page components (Dashboard, HRMockup, FinanceMockup, SupportMockup)
• Optional path from pages to Supabase integration client
• That components/ui/* are shared primitives used across pages
Summary
By dividing the system into: