# aixhunter/filewizardai architecture

> Architecture diagram of the GitHub repository aixhunter/filewizardai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aixhunter/filewizardai
- Repository: https://github.com/aixhunter/filewizardai

## Overview

##### Main Components

a) Frontend Layer:
- Angular Single Page Application (SPA)
- Key components: FolderTree and SearchFiles
- Data Service for API communication

b) Backend Layer:
- FastAPI server
- File processing system
- Caching mechanism
- Database integration (SQLite)

c) External Services:
- LLM (Language Learning Model) integration
- File system interaction

**[Client Tier]**

- ▼
**[Application Tier]**

- ▼
**[Data Tier]**

##### Detailed Component Breakdown

Client Tier (Angular Frontend):
- Sub-components:
- FolderTree Component
- SearchFiles Component
- Data Service

Application Tier (FastAPI Backend):
- Key services:
- File Processing Service
- API Endpoints
- Caching Manager

Data Tier:
- SQLite Database
- File System Storage
- LLM Integration

##### Flow Directions

- User interactions → Frontend
- Frontend → Backend API calls
- Backend → Database queries
- Backend → LLM interactions
- Backend → File system operations
- Cache checks and updates

##### Specific Implementation Details

For this project, emphasize:
- File processing workflow
- Caching mechanism
- API endpoints for file organization and search
- Database schema for storing processed files
- LLM integration points

##### Additional Elements

Specific components:
- Environment configuration (.env)
- Static file serving
- API endpoints:
- File organization endpoint
- Search endpoint
- Cache management endpoint

##### Technical Details

Frontend:
- Angular v14+ (based on package.json)
- TypeScript
- Components structure

Backend:
- FastAPI
- Python
- SQLite
- File system interactions
- LLM integration

- File organization workflow
- Content-based search functionality
- Caching mechanism
- LLM integration for file analysis

- Rectangles for services
- Clouds for external services

This will create a comprehensive yet clear representation of the FileWizardAI system architecture that aligns with the actual implementation shown in the file tree.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef database fill:#fff2cc,stroke:#d6b656
    classDef external fill:#f8cecc,stroke:#b85450
    classDef config fill:#e1d5e7,stroke:#9673a6

    %% Frontend Layer
    subgraph Frontend
        SPA["Angular SPA"]
        FolderTree["FolderTree Component"]
        SearchFiles["SearchFiles Component"]
        DataService["Data Service"]
        
        SPA --> FolderTree
        SPA --> SearchFiles
        FolderTree & SearchFiles --> DataService
    end

    %% Backend Layer
    subgraph Backend
        FastAPI["FastAPI Server"]
        FileProcessor["File Processing Service"]
        CacheManager["Cache Manager"]
        APIEndpoints["API Endpoints"]
        
        FastAPI --> FileProcessor
        FastAPI --> CacheManager
        FastAPI --> APIEndpoints
    end

    %% Data Layer
    subgraph Data
        DB[(SQLite Database)]
        FileSystem[("File System")]
        LLM["LLM Service"]
    end

    %% Config
    EnvConfig["Environment Config"]

    %% Connections
    DataService --> APIEndpoints
    APIEndpoints --> DB
    APIEndpoints --> FileSystem
    FileProcessor --> LLM
    FileProcessor --> FileSystem
    CacheManager --> DB

    %% Click Events
    click SPA "https://github.com/AIxHunter/FileWizardAi/tree/main/frontend/src/app"
    click FolderTree "https://github.com/AIxHunter/FileWizardAi/blob/main/frontend/src/app/components/folder-tree.component.ts"
    click SearchFiles "https://github.com/AIxHunter/FileWizardAi/blob/main/frontend/src/app/components/search-files.component.ts"
    click DataService "https://github.com/AIxHunter/FileWizardAi/blob/main/frontend/src/app/data.service.ts"
    click FastAPI "https://github.com/AIxHunter/FileWizardAi/blob/main/backend/app/server.py"
    click DB "https://github.com/AIxHunter/FileWizardAi/blob/main/backend/app/database.py"
    click EnvConfig "https://github.com/AIxHunter/FileWizardAi/blob/main/backend/.env"
    click APIEndpoints "https://github.com/AIxHunter/FileWizardAi/blob/main/backend/app/run.py"
    click FileSystem "https://github.com/AIxHunter/FileWizardAi/tree/main/backend/app/static"

    %% Style Applications
    class SPA,FolderTree,SearchFiles,DataService frontend
    class FastAPI,FileProcessor,CacheManager,APIEndpoints backend
    class DB,FileSystem database
    class LLM external
    class EnvConfig config

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Service"]:::backend
        Database_L[(Database)]:::database
        External_L["External Service"]:::external
        Config_L["Configuration"]:::config
    end
```
