# malikyakub/alignerai architecture

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

- Interactive diagram: https://gitdiagram.com/malikyakub/alignerai
- Repository: https://github.com/malikyakub/alignerai

## Overview

##### Project type and purpose
- This is a single-page web application (SPA) built with React (Vite) and Tailwind CSS.
- It uses Appwrite as a BaaS for authentication and database storage.
- It embeds simple AI logic (recommendations, alignment, time conversion) as JavaScript modules in the public/Models folder.
- It will be hosted as static files (e.g., Vercel) with client-side routing.

##### Main components
a. Browser / Client (React SPA)
b. In-Browser AI Engine (public/Models: Aligner.js, recommendator.js, time_converter.js)
c. Appwrite Backend (Auth, Database)
d. Static File Hosting (Vercel or any CDN)
e. External Services (if any—in this case, Appwrite is the main external)

##### Relationships & data flows
- User interacts with the React UI (src/components + src/pages)
- UI calls Appwrite SDK (src/appwrite/config.js, database.js) to CRUD tasks
- Data is stored in and retrieved from Appwrite Database
- After retrieval, UI feeds task list to the AI Engine modules (direct function calls)
- AI Engine returns the “next task” recommendation back to the UI
- UI presents results to the user

##### Architectural patterns & design principles
- SPA architecture with clear separation:
- Presentation layer (React components, pages)
- Service layer (Appwrite SDK wrappers in src/appwrite)
- Model layer (AI modules in public/Models)
- Component-based UI (Atoms/Molecules/Organisms in src/components)
- Client-side data flow: REST/RPC calls to Appwrite, then local processing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Entities
    User(["User"]):::external

    %% Static Hosting and Assets
    subgraph "Static Hosting" 
        direction TB
        Hosting(["Vercel / CDN"]):::external
        subgraph "Assets"
            Redirects(["_redirects"]):::external
            DataJson(["data.json"]):::external
            Images(["images/"]):::external
            SVGs(["SVG/"]):::external
        end
    end

    %% Client Application
    subgraph "Client Application"
        direction TB

        subgraph "Bootstrap"
            direction TB
            indexHTML(["index.html"]):::client
            MainJS(["src/main.jsx"]):::client
            AppJS(["src/App.jsx"]):::client
        end

        Browser(["Browser / React SPA"]):::client

        subgraph "UI Components"
            direction TB
            AlignBtn(["AlignerBtn.jsx"]):::client
            Tomove(["Tomovesection.jsx"]):::client
            TasksListComp(["TasksList.jsx"]):::client
            NewTask(["NewTaskList.jsx"]):::client
            RecComp(["Recommendation.jsx"]):::client
        end

        subgraph "Pages & Routing"
            direction TB
            AlignerPage(["AlignerPage.jsx"]):::client
            TasksPage(["TasksPage.jsx"]):::client
            AddTaskPage(["AddtaskPage.jsx"]):::client
            NoPage(["Nopage.jsx"]):::client
            TestPage(["TasksListTest.jsx"]):::client
        end

        subgraph "Service Layer"
            direction TB
            Config(["config.js"]):::service
            DBWrapper(["database.js"]):::service
        end

        subgraph "AI Engine"
            direction TB
            AlignerModel(["Aligner.js"]):::client
            RecommendModel(["recommendator.js"]):::client
            TimeConvModel(["time_converter.js"]):::client
        end
    end

    %% Backend Service
    subgraph "Appwrite Backend"
        direction TB
        Auth(["Auth API"]):::external
        DB(["Database"]):::datastore
    end

    %% Tooling & Configuration
    subgraph "Tooling & Config"
        direction TB
        Vite(["vite.config.js"]):::external
        Tailwind(["tailwind.config.js"]):::external
        PostCSS(["postcss.config.js"]):::external
        VercelJSON(["vercel.json"]):::external
    end

    %% Connections
    User -->|Interacts via UI| Browser
    Hosting -->|Serves SPA files| indexHTML
    indexHTML --> MainJS
    MainJS --> AppJS
    AppJS --> Browser

    Browser -->|"HTTPS / SDK"| Config
    Browser -->|"HTTPS / SDK"| DBWrapper
    Config -->|"SDK calls"| Auth
    DBWrapper -->|"SDK calls"| DB
    DB -->|"JSON payload"| Browser

    Browser -->|"JS function call"| AlignerModel
    Browser -->|"JS function call"| RecommendModel
    Browser -->|"JS function call"| TimeConvModel

    AlignerModel -->|"response"| Browser
    RecommendModel -->|"response"| Browser
    TimeConvModel -->|"response"| Browser

    Hosting --> Assets

    %% Click Events
    click indexHTML "https://github.com/malikyakub/alignerai/blob/main/index.html"
    click MainJS "https://github.com/malikyakub/alignerai/blob/main/src/main.jsx"
    click AppJS "https://github.com/malikyakub/alignerai/blob/main/src/App.jsx"
    click AlignBtn "https://github.com/malikyakub/alignerai/blob/main/src/components/AlignerBtn.jsx"
    click Tomove "https://github.com/malikyakub/alignerai/blob/main/src/components/Tomovesection.jsx"
    click TasksListComp "https://github.com/malikyakub/alignerai/blob/main/src/components/TasksList.jsx"
    click NewTask "https://github.com/malikyakub/alignerai/blob/main/src/components/NewTaskList.jsx"
    click RecComp "https://github.com/malikyakub/alignerai/blob/main/src/components/Recommendation.jsx"
    click AlignerPage "https://github.com/malikyakub/alignerai/blob/main/src/pages/AlignerPage.jsx"
    click TasksPage "https://github.com/malikyakub/alignerai/blob/main/src/pages/TasksPage.jsx"
    click AddTaskPage "https://github.com/malikyakub/alignerai/blob/main/src/pages/AddtaskPage.jsx"
    click NoPage "https://github.com/malikyakub/alignerai/blob/main/src/pages/Nopage.jsx"
    click TestPage "https://github.com/malikyakub/alignerai/blob/main/src/pages/TasksListTest.jsx"
    click Config "https://github.com/malikyakub/alignerai/blob/main/src/appwrite/config.js"
    click DBWrapper "https://github.com/malikyakub/alignerai/blob/main/src/appwrite/database.js"
    click AlignerModel "https://github.com/malikyakub/alignerai/blob/main/public/Models/Aligner.js"
    click RecommendModel "https://github.com/malikyakub/alignerai/blob/main/public/Models/recommendator.js"
    click TimeConvModel "https://github.com/malikyakub/alignerai/blob/main/public/Models/time_converter.js"
    click Redirects "https://github.com/malikyakub/alignerai/tree/main/public/_redirects"
    click DataJson "https://github.com/malikyakub/alignerai/blob/main/public/data.json"
    click Images "https://github.com/malikyakub/alignerai/tree/main/public/images/"
    click SVGs "https://github.com/malikyakub/alignerai/tree/main/public/SVG/"
    click VercelJSON "https://github.com/malikyakub/alignerai/blob/main/vercel.json"
    click Vite "https://github.com/malikyakub/alignerai/blob/main/vite.config.js"
    click Tailwind "https://github.com/malikyakub/alignerai/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/malikyakub/alignerai/blob/main/postcss.config.js"

    %% Styles
    classDef client fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef service fill:#d4edda,stroke:#333,stroke-width:1px
    classDef datastore fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
