# cloud-code-ai/akiradocs architecture

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

- Interactive diagram: https://gitdiagram.com/cloud-code-ai/akiradocs
- Repository: https://github.com/cloud-code-ai/akiradocs

## Overview

##### High-Level Architecture Components

a) Frontend Layer
- Next.js Application (Main documentation interface)
- Editor Interface (Notion-like block editor)
- Client-side AI Components
- Internationalization System

b) Core Processing Layer
- Content Management System
- AI Processing Pipeline
- WebRAG System
- Build System

c) Storage Layer
- File System (Markdown/MDX)
- Browser-based SQLite
- Compilation Cache

##### Key Relationships and Data Flow

**Content Creation Flow:**
**Editor Interface -> Content Management -> File System**
- > AI Processing -> Content Enhancement

**Documentation Serving Flow:**
**File System -> Build System -> Compiled Assets -> Frontend**

**Search & AI Flow:**
**Client Browser -> WebRAG System -> Local LLM/Embeddings -> UI Response**

##### Detailed Component Breakdown

Editor Package:
**[Editor UI] -> [Block Management] -> [AI Enhancement]**
- > [File System Integration]
- > [Real-time Preview]

Documentation Package:
**[Content Sources] -> [Compilation] -> [Static Assets]**
- > [Translation] -> [Multi-language Output]

WebRAG System:
**[Documentation Corpus] -> [GTE-small Embeddings]**
- > [SQLite Storage]
- > [LLaMA 3.2 Model]

##### Integration Points

Highlight:
- API endpoints (/api/*)
- Build hooks
- Translation pipeline
- AI processing nodes
- Content compilation flow

##### Performance Flow

Show:
- Static generation paths
- Client-side processing
- Caching mechanisms
- Search optimization

##### The internationalization pipeline

Use standardized symbols for:
- Services (rectangles)
- Processing units (gears)
- Storage (folders)

This architecture should reflect AkiraDocs' unique combination of traditional documentation features with modern AI capabilities, all while maintaining a focus on the client-side processing approach that makes it unique in the documentation platform space.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        UI[Next.js Application]
        Editor["Editor Interface"]:::editor
        AI_Client["Client-side AI Components"]:::ai
        I18N["Internationalization System"]:::i18n
        Blocks["Block Editor Components"]:::blocks
        FrontendUI["Frontend UI Components"]:::ui
        Analytics["Analytics System"]:::analytics
        SEO["SEO Components"]:::seo
    end

    subgraph Core
        CMS["Content Management System"]:::cms
        AIPipeline["AI Processing Pipeline"]:::ai
        WebRAG["WebRAG System"]:::ai
        Build["Build System"]:::build
    end

    subgraph Storage
        FS["File System (MD/MDX)"]:::storage
        DB[(Browser SQLite)]:::db
        Cache["Compilation Cache"]:::cache
    end

    subgraph WebRAG_Components
        Corpus["Documentation Corpus"]
        Embeddings["GTE-small Embeddings"]
        LLM["LLaMA 3.2 Model"]
    end

    %% Frontend Relationships
    Editor --> CMS
    AI_Client --> WebRAG
    UI --> FrontendUI
    Editor --> Blocks

    %% Core Processing
    CMS --> FS
    CMS --> AIPipeline
    WebRAG --> WebRAG_Components
    Build --> Cache
    
    %% Storage Relationships
    WebRAG --> DB
    FS --> Build
    Build --> UI

    %% WebRAG Flow
    Corpus --> Embeddings
    Embeddings --> LLM
    LLM --> AI_Client

    %% Click Events
    click Editor "https://github.com/cloud-code-ai/akiradocs/tree/main/packages/editor/src/components/editor"
    click AI_Client "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/components/aiSearch"
    click I18N "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/i18n"
    click CMS "https://github.com/cloud-code-ai/akiradocs/blob/main/docs/src/lib/content.ts"
    click AIPipeline "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/lib/aisearch"
    click WebRAG "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/lib/aisearch"
    click Build "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/scripts"
    click FS "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/_contents"
    click Cache "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/compiled"
    click Blocks "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/components/blocks"
    click FrontendUI "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/components/ui"
    click Analytics "https://github.com/cloud-code-ai/akiradocs/tree/main/docs/src/components/analytics"
    click SEO "https://github.com/cloud-code-ai/akiradocs/blob/main/docs/src/components/layout/SEO.tsx"

    %% Styling
    classDef editor fill:#9333ea
    classDef ai fill:#22c55e
    classDef i18n fill:#0ea5e9
    classDef cms fill:#3b82f6
    classDef build fill:#f97316
    classDef storage fill:#6b7280
    classDef db fill:#6b7280
    classDef cache fill:#6b7280
    classDef blocks fill:#9333ea
    classDef ui fill:#9333ea
    classDef analytics fill:#3b82f6
    classDef seo fill:#3b82f6

    %% Legend
    subgraph Legend
        L1[UI Components]:::editor
        L2[AI/ML Components]:::ai
        L3[Core Services]:::cms
        L4[Build Systems]:::build
        L5[Storage]:::storage
    end
```
