# hike-12/auraflix architecture

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

- Interactive diagram: https://gitdiagram.com/hike-12/auraflix
- Repository: https://github.com/hike-12/auraflix

## Overview

##### Main Components
- AI/ML Layer – Represented by the "ai" directory. This contains Python scripts and data files (e.g., fetch.py, enrich_categories.py, main.py, analytics.csv, insta.csv, enhanced_categories.json, and render.yaml). These scripts handle data ingestion, simulation of historical data, linear regression for trend predictions, TF-IDF text analysis, and report generation.
- Backend/API Server – Found in the "backend" directory. The server.js, route files (such as auth.route.js), and model definitions (user.model.js) indicate the use of a Node.js/Express backend that provides RESTful APIs for the frontend, handles authentication, and connects to a MongoDB database.
- Frontend/UI Layer – Found in the "frontend" directory. This includes React components and pages (such as Dashboard.jsx, Search.jsx, SignIn.jsx, and others) together with configuration files (like vite.config.js and package.json). It allows users to explore influencer data, generate reports, view analytics, and interact with the system.

##### Relationships and Interactions
- UI (frontend) interacting with the Backend through RESTful API calls. This is the primary channel for user actions – such as searching and filtering influencers – to be processed.
- That the Backend communicates with the AI/ML layer when handling data processing tasks like generating historical data, executing trend predictions, or analyzing influencer content via TF-IDF.
- A connection from the Backend to the Database (MongoDB) for storing user data, influencer scores, and any simulation output.
- If applicable, highlight the flow of CSV and JSON data (e.g., analytics.csv, output_file.json) within the AI layer that feeds predictive analytics and scoring components.

##### Architectural Patterns and Design Principles
- Separation of Concerns – Clearly separate the UI (React-based frontend), server/API layer (Node.js with Express), data processing/AI (Python scripts), and persistence (MongoDB).
- API-Driven Design – The backend encapsulates business logic and serves as the intermediary between frontend interactions and the AI layer.
- Data Pipeline – The AI module can be shown as a data processing pipeline where raw data (from CSV files and external sources) is transformed (using historical simulation, linear regression, TF-IDF, and other metrics calculations) before being fed back into the application for report generation and influencer analysis.

##### Relevant Technologies and Frameworks
- Frontend: React and Tailwind CSS.
- Backend: Node.js with Express, using JavaScript and related package management (package.json, package-lock.json).
- Database: MongoDB (even if not visible directly, it is mentioned in the README).
- Machine Learning/Analytics: Python for trend predictions (using linear regression) and TF-IDF for content analysis.
- External Data Integration: Usage of CSV datasets and possibly integration/abstraction layers that mimic interactions like those of the Instagram Graph API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Entities
    U("User"):::user

    %% Frontend/UI Layer
    subgraph "Frontend (React + Tailwind CSS)"
        direction TB
        FE1("App.jsx"):::frontend
        subgraph "Components & Pages"
            FE2("Dashboard.jsx"):::frontend
            FE3("Search.jsx"):::frontend
            FE4("SignIn.jsx"):::frontend
            FE5("Auth.jsx"):::frontend
            FE6("Influencers.jsx"):::frontend
            FE7("Landing.jsx"):::frontend
        end
        subgraph "Configuration"
            FE8("index.html"):::frontend
            FE9("vite.config.js"):::frontend
            FE10("package.json"):::frontend
        end
    end

    %% Backend/API Server
    subgraph "Backend (Node.js/Express)"
        direction TB
        BE1("server.js"):::backend
        subgraph "Routes & Models"
            BE2("auth.route.js"):::backend
            BE3("user.model.js"):::backend
        end
        subgraph "Packages & Config"
            BE4("package.json"):::backend
            BE5("package-lock.json"):::backend
            BE6(".gitignore"):::backend
        end
    end

    %% AI/ML Layer
    subgraph "AI/ML Layer (Python Analysis & Data Simulation)"
        direction TB
        subgraph "Python Scripts"
            AI1("main.py"):::ai
            AI2("fetch.py"):::ai
            AI3("enrich_categories.py"):::ai
        end
        subgraph "Data Files"
            AI4("analytics.csv"):::ai
            AI5("insta.csv"):::ai
            AI6("enhanced_categories.json"):::ai
            AI7("output_file.json"):::ai
            AI8("render.yaml"):::ai
            AI9("requirements.txt"):::ai
        end
    end

    %% Database
    DB(["Database (MongoDB)"]):::database

    %% Interactions
    U -->|"interacts"| FE1
    FE1 -->|"APICall"| BE1
    BE1 -->|"processes"| AI1
    BE1 -->|"stores/retrieves"| DB

    %% Styles
    classDef user fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef frontend fill:#CCE5FF,stroke:#333,stroke-width:2px;
    classDef backend fill:#FFCCCC,stroke:#333,stroke-width:2px;
    classDef ai fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef database fill:#FFE6CC,stroke:#333,stroke-width:2px;

    %% Click Events for AI/ML Layer
    click AI1 "https://github.com/hike-12/auraflix/blob/main/ai/main.py"
    click AI2 "https://github.com/hike-12/auraflix/blob/main/ai/fetch.py"
    click AI3 "https://github.com/hike-12/auraflix/blob/main/ai/enrich_categories.py"
    click AI4 "https://github.com/hike-12/auraflix/blob/main/ai/analytics.csv"
    click AI5 "https://github.com/hike-12/auraflix/blob/main/ai/insta.csv"
    click AI6 "https://github.com/hike-12/auraflix/blob/main/ai/enhanced_categories.json"
    click AI7 "https://github.com/hike-12/auraflix/blob/main/ai/output_file.json"
    click AI8 "https://github.com/hike-12/auraflix/blob/main/ai/render.yaml"
    click AI9 "https://github.com/hike-12/auraflix/blob/main/ai/requirements.txt"

    %% Click Events for Backend/API Server
    click BE1 "https://github.com/hike-12/auraflix/blob/main/backend/server.js"
    click BE2 "https://github.com/hike-12/auraflix/blob/main/backend/routes/auth.route.js"
    click BE3 "https://github.com/hike-12/auraflix/blob/main/backend/models/user.model.js"
    click BE4 "https://github.com/hike-12/auraflix/blob/main/backend/package.json"
    click BE5 "https://github.com/hike-12/auraflix/blob/main/backend/package-lock.json"
    click BE6 "https://github.com/hike-12/auraflix/blob/main/backend/.gitignore"

    %% Click Events for Frontend/UI Layer
    click FE1 "https://github.com/hike-12/auraflix/blob/main/frontend/src/App.jsx"
    click FE2 "https://github.com/hike-12/auraflix/blob/main/frontend/src/components/Dashboard.jsx"
    click FE3 "https://github.com/hike-12/auraflix/blob/main/frontend/src/components/Search.jsx"
    click FE4 "https://github.com/hike-12/auraflix/blob/main/frontend/src/components/SignIn.jsx"
    click FE5 "https://github.com/hike-12/auraflix/blob/main/frontend/src/pages/Auth.jsx"
    click FE6 "https://github.com/hike-12/auraflix/blob/main/frontend/src/pages/Influencers.jsx"
    click FE7 "https://github.com/hike-12/auraflix/blob/main/frontend/src/pages/Landing.jsx"
    click FE8 "https://github.com/hike-12/auraflix/blob/main/frontend/index.html"
    click FE9 "https://github.com/hike-12/auraflix/blob/main/frontend/vite.config.js"
    click FE10 "https://github.com/hike-12/auraflix/blob/main/frontend/package.json"
```
