Skip to content

Project Structure

Overview of the codebase organization.

rag/
├── convex/                 # Convex backend
│   ├── agent.ts           # AI agent configuration
│   ├── chat.ts            # Chat-related functions
│   ├── files.ts           # File management
│   ├── indexing.ts        # Document indexing
│   ├── parsers.ts         # File content parsers
│   ├── rag.ts             # RAG utilities
│   ├── schema.ts          # Database schema
│   ├── search.ts          # Search functions
│   └── shared.ts          # Shared utilities

├── src/                    # React frontend
│   ├── components/        # UI components
│   │   ├── ai-elements/   # AI-related components
│   │   ├── chat/          # Chat interface
│   │   ├── table-files/   # File list table
│   │   └── ui/            # shadcn/ui components
│   ├── hooks/             # Custom React hooks
│   ├── lib/               # Utilities
│   ├── routes/            # TanStack Router pages
│   └── styles.css         # Global styles

├── docs/                   # VitePress documentation
├── example-docs/           # Sample documents
├── public/                 # Static assets
└── .github/               # GitHub configuration
    ├── workflows/         # CI/CD workflows
    └── ISSUE_TEMPLATE/    # Issue templates

Key Directories

/convex

Backend code that runs on Convex:

  • schema.ts: Defines database tables and indexes
  • agent.ts: AI agent setup and configuration
  • chat.ts: Message handling and thread management
  • parsers.ts: Extract text from different file formats
  • indexing.ts: Chunk and embed documents

/src/components

React components organized by feature:

  • ai-elements/: Reusable AI UI components (messages, loaders, etc.)
  • chat/: Main chat interface components
  • table-files/: Document list and management
  • ui/: Base shadcn/ui components

/src/routes

TanStack Router file-based routes:

  • __root.tsx: Root layout with sidebar
  • index.tsx: Home/file upload page
  • chat.tsx: Chat layout
  • chat.$threadId.tsx: Individual chat thread

Configuration Files

FilePurpose
convex.config.tsConvex project config
vite.config.tsVite build config
tsconfig.jsonTypeScript config
eslint.config.jsESLint rules
components.jsonshadcn/ui config

Released under the MIT License.