# chris-paganon/vue-ai-tools architecture

> Architecture diagram of the GitHub repository chris-paganon/vue-ai-tools, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chris-paganon/vue-ai-tools
- Repository: https://github.com/chris-paganon/vue-ai-tools

## Overview

##### Project type and purpose
- This is a full-stack Nuxt 3 web application (“VueAI.tools”) that provides a Vue-focused AI assistant.
- Key features:
- Frontend SPA/SSR via Nuxt 3 (Vue components, layouts, pages).
- Backend API routes (server/api) for authentication, chat management, subscriptions, and AI completions.
- Local or remote AI model hosting via Ollama plus a vector index (Qdrant) built by a separate Python service.
- Persistence in SQLite (via Drizzle ORM) for users, chats, subscriptions.

##### File structure
- Top-level directories:
- assets, components, layouts, pages, plugins, composables (client-side).
- server (server/api, server/utils, server/plugins, middleware) for Nuxt API endpoints.
- db (migrations, schema) + drizzle.config.ts for database.
- index-builder (Python service + Dockerfile) for building the Qdrant index from Vue docs.
- nuxter-config + docker-compose.yml orchestrate multi-container deployment (Nuxt app, Qdrant, Python index builder, healthcheck).
- Config files: nuxt.config.ts, tsconfig.json, eslint.config.mjs, package.json.

##### README for additional insights
- Describes local vs. production setup, Docker Compose services, AI model configurations via Ollama, embedding models, and how to rebuild the vector index.
- Emphasizes the separation of concerns: frontend, backend, index builder, vector DB, AI model service, email/api integrations.

##### Main components & their relationships
a. Frontend (Nuxt 3)
- Renders pages/routes (pages/, layouts/)
- Calls backend API (server/api/*) via HTTP
- Manages state in Pinia stores (composables/stores)
b. Backend (Nuxt server/API)
- Authentication & user management (server/api/auth)
- Chat CRUD & message endpoints (server/api/chats)
- AI completion endpoints (server/api/completion, docCompletion)
- Subscription & payment via Lemon API (server/api/lemon)
- Database access through Drizzle ORM, migrations in db/
- Middleware for auth checks (server/middleware/authMware.ts)
c. Vector index builder (Python service)
- Extracts Vue docs (assets/vue-docs)
- Generates embeddings & pushes to Qdrant
- Runs in a separate container (index-builder service)
d. Qdrant Vector Database
- Hosts the ‘vue-docs’ index for semantic document search
- Exposes HTTP API on port 6333
e. AI Model Service (Ollama)
- Hosts LLM & embedding models locally or remotely
- Invoked by backend utilities (useCohereEmbed, useCohereLLM, useDeepseekLLM)
f. External Services
- Email (SendGrid or other SMTP) for signup confirmation
- Lemon API for payment subscriptions

##### Architectural patterns & design principles
- Separation of concerns: clear frontend vs. backend vs. index builder
- API-driven communication: frontend ↔ backend via RESTful endpoints
- Micro-services–style split: index‐builder service separate from main app
- Modular code organization: components, composables (client), plugins, utils (server)
- Infrastructure as code: Docker Compose orchestrates the multi-container setup

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Client Layer
  subgraph "Client (Browser)" 
    direction TB
    U["User"]:::actor
    NUXT["nuxt.config.ts"]:::frontend
    PAGES["pages/"]:::frontend
    LAYOUTS["layouts/"]:::frontend
    CMPTS["components/"]:::frontend
    COMPOS["composables/"]:::frontend
    PLUG["plugins/"]:::frontend
    ASSETS["assets/"]:::frontend
    U --> NUXT
  end

  %% Backend Layer
  BE["Backend API (Nuxt Server)"]:::backend
  subgraph "Nuxt Server API Endpoints" 
    direction TB
    %% Auth & User Management
    SU["server/api/auth/signup.post.ts"]:::backend
    SI["server/api/auth/signin.post.ts"]:::backend
    LO["server/api/auth/logout.post.ts"]:::backend
    UG["server/api/auth/user.get.ts"]:::backend
    VE["server/api/auth/verify-email.post.ts"]:::backend
    SE["server/api/auth/send-email-code.get.ts"]:::backend
    RP["server/api/auth/request-password-reset.post.ts"]:::backend
    RE["server/api/auth/reset-password.post.ts"]:::backend
    ME["server/api/auth/modify-email.post.ts"]:::backend
    %% Chat CRUD & Messaging
    CC["server/api/chats/create.post.ts"]:::backend
    CM["server/api/chats/create-message.post.ts"]:::backend
    MG["server/api/chats/messages.get.ts"]:::backend
    CU["server/api/chats/update.post.ts"]:::backend
    %% AI Completion
    AI["server/api/completion.post.ts"]:::backend
    DOC["server/api/docCompletion.post.ts"]:::backend
    %% Subscriptions & Payment
    PM["server/api/lemon/payment-method-url.get.ts"]:::backend
    CA["server/api/lemon/cancel.get.ts"]:::backend
    WH["server/api/lemon/webhook.post.ts"]:::backend
    %% Middleware & Migrations
    MU["server/middleware/authMware.ts"]:::backend
    MIG["server/plugins/00-migrate.ts"]:::backend
  end

  %% Database Layer
  subgraph "Database" 
    direction TB
    DRZ["drizzle.config.ts"]:::database
    US["db/schema/usersSchema.ts"]:::database
    CHS["db/schema/chatSchema.ts"]:::database
    SUS["db/schema/subscriptionsSchema.ts"]:::database
    MIGF["db/migrations/"]:::database
    SQL["SQLite DB"]:::database
  end

  %% Vector Index Builder
  subgraph "Index Builder (Python Service)" 
    direction TB
    IB_DOCK["index-builder/Dockerfile"]:::builder
    POM["index-builder/pyproject.toml"]:::builder
    MAIN["index-builder/src/__main__.py"]:::builder
    PINB["index-builder/src/pinia/"]:::builder
    ROUTER["index-builder/src/router/"]:::builder
    VUEJS["index-builder/src/vuejs/"]:::builder
  end

  %% External Services
  QDRANT["Qdrant Vector DB"]:::database
  OLLAMA["AI Model Service (Ollama)"]:::external
  LEMONEXT["Lemon API"]:::external
  EMAILEXT["Email Service"]:::external

  %% Connections
  NUXT -->|calls REST APIs| BE
  BE -->|uses ORM| DRZ
  DRZ -->|persists data| SQL
  BE -->|requests embeddings/LLM| OLLAMA
  BE -->|payment integration| LEMONEXT
  BE -->|email notifications| EMAILEXT
  IB_DOCK -->|builds index| QDRANT
  BE -->|doc search queries| QDRANT

  %% Click Events - Frontend
  click NUXT "https://github.com/chris-paganon/vue-ai-tools/blob/master/nuxt.config.ts"
  click PAGES "https://github.com/chris-paganon/vue-ai-tools/tree/master/pages/"
  click LAYOUTS "https://github.com/chris-paganon/vue-ai-tools/tree/master/layouts/"
  click CMPTS "https://github.com/chris-paganon/vue-ai-tools/tree/master/components/"
  click COMPOS "https://github.com/chris-paganon/vue-ai-tools/tree/master/composables/"
  click PLUG "https://github.com/chris-paganon/vue-ai-tools/tree/master/plugins/"
  click ASSETS "https://github.com/chris-paganon/vue-ai-tools/tree/master/assets/"

  %% Click Events - Backend API
  click SU "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/signup.post.ts"
  click SI "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/signin.post.ts"
  click LO "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/logout.post.ts"
  click UG "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/user.get.ts"
  click VE "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/verify-email.post.ts"
  click SE "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/send-email-code.get.ts"
  click RP "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/request-password-reset.post.ts"
  click RE "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/reset-password.post.ts"
  click ME "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/auth/modify-email.post.ts"
  click CC "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/chats/create.post.ts"
  click CM "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/chats/create-message.post.ts"
  click MG "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/chats/messages.get.ts"
  click CU "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/chats/update.post.ts"
  click AI "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/completion.post.ts"
  click DOC "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/docCompletion.post.ts"
  click PM "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/lemon/payment-method-url.get.ts"
  click CA "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/lemon/cancel.get.ts"
  click WH "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/api/lemon/webhook.post.ts"
  click MU "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/middleware/authMware.ts"
  click MIG "https://github.com/chris-paganon/vue-ai-tools/blob/master/server/plugins/00-migrate.ts"

  %% Click Events - Database
  click DRZ "https://github.com/chris-paganon/vue-ai-tools/blob/master/drizzle.config.ts"
  click US "https://github.com/chris-paganon/vue-ai-tools/blob/master/db/schema/usersSchema.ts"
  click CHS "https://github.com/chris-paganon/vue-ai-tools/blob/master/db/schema/chatSchema.ts"
  click SUS "https://github.com/chris-paganon/vue-ai-tools/blob/master/db/schema/subscriptionsSchema.ts"
  click MIGF "https://github.com/chris-paganon/vue-ai-tools/tree/master/db/migrations/"

  %% Click Events - Index Builder
  click IB_DOCK "https://github.com/chris-paganon/vue-ai-tools/tree/master/index-builder/Dockerfile"
  click POM "https://github.com/chris-paganon/vue-ai-tools/blob/master/index-builder/pyproject.toml"
  click MAIN "https://github.com/chris-paganon/vue-ai-tools/blob/master/index-builder/src/__main__.py"
  click PINB "https://github.com/chris-paganon/vue-ai-tools/tree/master/index-builder/src/pinia/"
  click ROUTER "https://github.com/chris-paganon/vue-ai-tools/tree/master/index-builder/src/router/"
  click VUEJS "https://github.com/chris-paganon/vue-ai-tools/tree/master/index-builder/src/vuejs/"

  %% Styles
  classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
  classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
  classDef database fill:#F5DEB3,stroke:#333,stroke-width:1px
  classDef builder fill:#FFD700,stroke:#333,stroke-width:1px
  classDef external fill:#FFB6C1,stroke:#333,stroke-width:1px
  classDef actor fill:#D3D3D3,stroke:#333,stroke-width:1px
```
