# fanyuuu2006/tools-for-meta-infomation architecture

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

- Interactive diagram: https://gitdiagram.com/fanyuuu2006/tools-for-meta-infomation
- Repository: https://github.com/fanyuuu2006/tools-for-meta-infomation

## Overview

##### Project Identification & Purpose
- The README clearly states that the tool allows users to take downloaded data from Meta platforms (specifically Instagram and Threads) and process it to perform several analyses (e.g., tracking follow/unfollow activities, mutual follow details, etc.).
- The project is a front-end-only application built with Next.js since all the directories fall under "frontend" with pages, components, and libraries. There is no separate backend server, meaning file processing and data handling occur on the client side.

##### Analyzing the File Structure
- Top-level "frontend" directory: Contains configuration files (tsconfig.json, next.config.ts, package.json) that point to a Next.js project.
- Pages/Application Layer (frontend/src/app):
- Contains separate routes (Instagram, Threads, Index) and a global layout.
- This represents the entry point and routing for the user-facing interface.
- Components (frontend/src/components):
- Organized by feature (e.g., Instagram, Threads, Index) plus common reusable UI pieces like FileUploadSection, Footer, and TableDataDisplay.
- Libraries (frontend/src/lib):
- These files (HandleFunction.ts, data type definitions for Instagram and Threads) provide business logic and type definitions for handling uploaded data.
- Styling (frontend/src/styles):
- CSS files are grouped by component and global styles to maintain appearance.

a. Main Components:
- User Interface (UI) Layer:
- Pages/Routes: Index, Instagram, Threads.
- Layout component (for common UI patterns).
- UI Components:
- Domain-specific components for Instagram (IntroSection, FeatureMethods) and Threads.
- Common components such as FileUploadSection (where users upload their downloaded files), Footer, etc.
- Business Logic Layer:
- Libraries in the "lib" folder that process data (e.g., HandleFunction.ts, data types).
- Data Source:
- User-provided files (unzipped Meta data) that are uploaded via the UI.
- Configuration/Dependency Management:
- Next.js and other dependencies (from package.json) that govern application behavior and build.

b. Relationships and Interactions:
- The user interacts with the UI (browsers rendering the pages served by Next.js).
- From the home/index page, users navigate to either Instagram or Threads pages.
- Each page is composed of multiple components: a header, an introduction section, file upload section, and sections to display processed data (tables, charts).
- The FileUpload component collects user data (the uploaded ZIP’s contents) and passes this information to the library functions for processing.
- Processed data is then passed to display components (e.g., TableDataDisplay) for meaningful presentation.
- There’s clear separation between presentation (React UI) and the underlying processing logic provided by the library files.

c. Architectural Patterns & Design Principles:
- Clear Separation of Concerns: UI components remain distinct from the business logic (data processing functions and type definitions).
- Modular Design: Components and libraries are organized by feature (Instagram vs. Threads) making the tool extensible.
- Client-Side Processing: With no dedicated backend, processing is done on the client, ensuring quick feedback.
- Reusability and Composition: Common components (Footer, FileUploadSection) are designed to be highly reusable across different pages.

d. Relevant Technologies & Frameworks:
- Next.js / React as the UI framework.
- TypeScript for type safety (as seen in tsconfig.json and .ts/.tsx files).
- CSS for styling components.
- Possibly ESLint for code quality management (eslint.config.mjs).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::user

    %% UI Layer
    subgraph "UI Layer"
        %% Global Layout and Pages subgraph
        subgraph "Pages & Routing"
            IndexPage["Index Page"]:::ui
            InstagramPage["Instagram Page"]:::ui
            ThreadsPage["Threads Page"]:::ui
            GlobalLayout["Global Layout"]:::ui
        end

        %% UI Components subgraph
        subgraph "UI Components"
            %% Domain-Specific Components (Instagram)
            InstagramIntro["Instagram Intro Section"]:::ui
            InstagramFeatures["Instagram Feature Methods"]:::ui

            %% Domain-Specific Components (Threads)
            ThreadsIntro["Threads Intro Section"]:::ui
            ThreadsFeatures["Threads Feature Methods"]:::ui

            %% Common Components
            FileUpload["File Upload Section"]:::ui
            TableDisplay["Table Data Display"]:::ui
            Footer["Footer"]:::ui
            OutsideLink["OutsideLink"]:::ui
            Swal["Swal"]:::ui
        end
    end

    %% Business Logic & Data Processing Layer
    subgraph "Business Logic"
        HandleFunction["Handle Function"]:::biz
        CommonData["Common Data Types"]:::biz
        InstagramData["Instagram Data Types"]:::biz
        ThreadsData["Threads Data Types"]:::biz
    end

    %% Configuration & Dependency Management
    subgraph "Configuration"
        ConfigTS["tsconfig.json"]:::config
        NextConfig["next.config.ts"]:::config
        PackageJSON["package.json"]:::config
        ESLint["eslint.config.mjs"]:::config
    end

    %% Data Source
    DataSource["User File Upload"]:::user

    %% Flow Connections
    User -->|"uploads"| FileUpload
    FileUpload -->|"processes"| HandleFunction
    HandleFunction -->|"returns data"| TableDisplay

    %% Navigation and Layout Flow
    IndexPage -->|"navigates_to"| InstagramPage
    IndexPage -->|"navigates_to"| ThreadsPage
    GlobalLayout --- IndexPage
    GlobalLayout --- InstagramPage
    GlobalLayout --- ThreadsPage

    %% UI Components association with Pages
    InstagramPage -->|"includes"| InstagramIntro
    InstagramPage -->|"includes"| InstagramFeatures
    ThreadsPage -->|"includes"| ThreadsIntro
    ThreadsPage -->|"includes"| ThreadsFeatures
    IndexPage -->|"includes"| FileUpload
    IndexPage -->|"includes"| TableDisplay
    IndexPage -->|"includes"| Footer

    %% Link Data Source to UI
    DataSource -->|"provides file"| FileUpload

    %% Class Definitions
    classDef ui fill:#B3E5FC,stroke:#000,stroke-width:1px;
    classDef biz fill:#C8E6C9,stroke:#000,stroke-width:1px;
    classDef config fill:#FFECB3,stroke:#000,stroke-width:1px;
    classDef user fill:#F8BBD0,stroke:#000,stroke-width:1px;

    %% Click Events for UI – Pages & Routing
    click IndexPage "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/app/page.tsx"
    click InstagramPage "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/app/Instagram/page.tsx"
    click ThreadsPage "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/app/Threads/page.tsx"
    click GlobalLayout "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/app/layout.tsx"

    %% Click Events for UI – Domain-Specific Components (Instagram)
    click InstagramIntro "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/Instagram/IntroSection.tsx"
    click InstagramFeatures "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/Instagram/FeatureMethods.tsx"

    %% Click Events for UI – Domain-Specific Components (Threads)
    click ThreadsIntro "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/Threads/IntroSection.tsx"
    click ThreadsFeatures "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/Threads/FeatureMethods.tsx"

    %% Click Events for UI – Common Components
    click FileUpload "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/common/FileUploadSection.tsx"
    click Footer "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/common/Footer.tsx"
    click TableDisplay "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/common/TableDataDisplay.tsx"
    click OutsideLink "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/common/OutsideLink.tsx"
    click Swal "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/components/common/Swal.tsx"

    %% Click Events for Business Logic & Data Processing
    click HandleFunction "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/lib/HandleFunction.ts"
    click CommonData "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/lib/CommonType.ts"
    click InstagramData "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/lib/Instagram/InstagramDataTypes.ts"
    click ThreadsData "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/src/lib/Threads/ThreadsDataTypes.ts"

    %% Click Events for Configuration & Dependency Management
    click ConfigTS "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/tsconfig.json"
    click NextConfig "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/next.config.ts"
    click PackageJSON "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/package.json"
    click ESLint "https://github.com/fanyuuu2006/tools-for-meta-infomation/blob/main/frontend/eslint.config.mjs"
```
