How gsenrdx/persona-insight works
Project Type and Purpose
• Persona Insight is a full-stack AI-powered customer persona analysis platform built with Next.js (App Router), React, TypeScript, Supabase (PostgreSQL), and MISO AI APIs.
• Users upload interview data, the system processes it via AI pipelines, stores results in Supabase, then renders interactive dashboards and chat interfaces on the frontend.
High-Level File Structure Analysis
• app/
• app/api/… → Backend API routes (chat, personas, interviews, projects, insights, files, workflow)
• app/auth/, app/login/, app/projects/, app/insights/, app/chat/… → Page routes
• components/ → Reusable React UI components organized by domain (auth, chat, persona, project, shared, ui)
• hooks/ → Custom React hooks for data fetching and business logic separation
• lib/ → Core utilities: API clients, constants, error handlers, Supabase clients, MISO integration
• types/ → TypeScript type definitions
• public/ & styles/ → Static assets and global styles
Key System Components
a. Frontend Layer
• Next.js App (app/layout.tsx, pages under app/)
• UI Components (components/ui, components/shared)
• Domain Components (components/auth, chat, persona, project)
• State & Data Fetching (TanStack Query via lib/query-client & hooks/use-*)
b. Backend Layer (Next.js API Routes)
• Chat Endpoints → /api/chat, /api/chat/summary
• Persona Management → /api/personas (search, sync, synthesis, criteria, update-dataset)
• Interview Processing → /api/interviews/[id]
• Project Management → /api/projects/[id]/members, /api/projects/members
• Insights & Workflow → /api/insights, /api/insights/years, /api/workflow
• File Handling → /api/files/download
• Supabase Helpers → /api/supabase/personas
c. Data & External Services
• Supabase (PostgreSQL) for persistence
• MISO API (AI processing, persona generation, chat agent)
• Authentication (OAuth callbacks under app/auth/callback)
Relationships and Data Flows
1. User → Frontend UI (pages, components)
2. Frontend → Next.js API Routes (via fetch or TanStack Query hooks)
3. API Routes →
• Supabase (CRUD interview data, personas, projects)
• MISO API (invoke AI pipelines: STT, persona synthesis, chat, summary, mind-map)
4. External services → API Routes → Frontend real-time updates
5. Frontend state updates and re-renders via React and Query Provider
Architectural Patterns & Principles
• Domain-Driven Design: feature folders under app/api and components
• Separation of Concerns: UI vs. business logic (custom hooks, lib/api)
• Reusable Design System: shadcn/ui + Radix UI components
• Type Safety: TypeScript end-to-end (types directory)
• API-First: all functionality exposed via Next.js API routes