# isixe/metathief architecture

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

- Interactive diagram: https://gitdiagram.com/isixe/metathief
- Repository: https://github.com/isixe/metathief

## Overview

##### Project type and purpose
- MetaThief is a full-stack, server-rendered web application built with Next.js 13 (app directory).
- Its purpose is to let users enter a URL, fetch that page’s metadata (meta tags, favicons, etc.), and display results via a simple API and UI.

##### File structure
- app/ → Next.js 13 routes and pages (app/page.tsx, app/api/meta/route.ts)
- hooks/ → custom React hooks (use-mobile, use-toast)
- lib/ → utility functions for parsing/fetching (utils.ts)
- public/ → static assets (images, favicon)
- styles/ + tailwind.config.ts → global styling setup
- config files: next.config.mjs, tsconfig.json, ESLint/Prettier

##### README for additional insights
- Features: extract meta tags, fetch favicons, simple API.
- Dev commands: pnpm run dev → starts Next.js on port 3000.

##### Detail
- Shared modules: lib/utils.ts, hooks/use-toast
- Configuration boundary: next.config.mjs, tailwind.config.ts

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Systems
    ExternalSite["External Websites"]:::external

    %% Frontend UI Layer
    subgraph "Frontend UI" 
        direction TB
        Browser["Browser (Client)"]:::browser
        Page["app/page.tsx\n(Main Page)"]:::frontend
        Layout["app/layout.tsx\n(Root Layout)"]:::frontend
        Header["components/layout/header.tsx"]:::frontend
        Footer["components/layout/footer.tsx"]:::frontend
        Theme["components/theme-provider.tsx"]:::frontend
        Search["components/meta/meta-search.tsx"]:::frontend
        Results["components/meta/meta-results.tsx"]:::frontend
        UIPrimitives["components/ui/"]:::frontend
        HooksMobile["hooks/use-mobile.tsx"]:::frontend
        HooksToast["hooks/use-toast.ts"]:::frontend
    end

    %% API Layer
    subgraph "API Layer" 
        direction TB
        MetaRoute["app/api/meta/route.ts"]:::api
        Types["types/meta.d.ts"]:::api
    end

    %% Utils / Parser
    Utils["lib/utils.ts"]:::api

    %% Static & Config
    StaticAssets["public/"]:::static
    Styles["styles/global.css"]:::static
    Tailwind["tailwind.config.ts"]:::static
    NextConfig["next.config.mjs"]:::static

    %% Data Flows
    Browser --> Page
    Page --> Layout
    Layout --> Header
    Layout --> Footer
    Layout --> Theme
    Page --> Search
    Search -->|"fetch /api/meta"| MetaRoute
    MetaRoute -->|invoke parser| Utils
    Utils -->|HTTP GET| ExternalSite
    ExternalSite -->|HTML Response| Utils
    Utils -->|parsed JSON| MetaRoute
    MetaRoute -->|JSON Response| Results
    Results --> Page
    Browser --> StaticAssets

    %% Click Events
    click Page "https://github.com/isixe/metathief/blob/main/app/page.tsx"
    click Layout "https://github.com/isixe/metathief/blob/main/app/layout.tsx"
    click Header "https://github.com/isixe/metathief/blob/main/components/layout/header.tsx"
    click Footer "https://github.com/isixe/metathief/blob/main/components/layout/footer.tsx"
    click Theme "https://github.com/isixe/metathief/blob/main/components/theme-provider.tsx"
    click Search "https://github.com/isixe/metathief/blob/main/components/meta/meta-search.tsx"
    click Results "https://github.com/isixe/metathief/blob/main/components/meta/meta-results.tsx"
    click UIPrimitives "https://github.com/isixe/metathief/tree/main/components/ui/"
    click HooksMobile "https://github.com/isixe/metathief/blob/main/hooks/use-mobile.tsx"
    click HooksToast "https://github.com/isixe/metathief/blob/main/hooks/use-toast.ts"
    click MetaRoute "https://github.com/isixe/metathief/blob/main/app/api/meta/route.ts"
    click Utils "https://github.com/isixe/metathief/blob/main/lib/utils.ts"
    click Types "https://github.com/isixe/metathief/blob/main/types/meta.d.ts"
    click StaticAssets "https://github.com/isixe/metathief/tree/main/public/"
    click Styles "https://github.com/isixe/metathief/blob/main/styles/global.css"
    click Tailwind "https://github.com/isixe/metathief/blob/main/tailwind.config.ts"
    click NextConfig "https://github.com/isixe/metathief/blob/main/next.config.mjs"

    %% Styles
    classDef frontend fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef api fill:#98FB98,stroke:#333,stroke-width:1px
    classDef external fill:#FFD700,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef browser fill:#ADD8E6,stroke:#333,stroke-width:1px
```
