# iamsheye/scrapper-fe architecture

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

- Interactive diagram: https://gitdiagram.com/iamsheye/scrapper-fe
- Repository: https://github.com/iamsheye/scrapper-fe

## Overview

##### Main Application Components

a) Frontend Architecture (Primary Layer)
- Client-Side Routing (using TanStack Router based on the routeTree.gen.ts)
- Component Layer
- Network Layer
- Authentication System
- Form Management

##### Component Organization

- Authentication Components
- Job Management Components
- User Profile Components
- Common UI Components

##### Data Flow Architecture

Interactions:
- API Communication Layer (src/network folder)
- Auth Service
- Jobs Service
- User Service
- Form Handling (useHookForm custom hook)
- Schema Validation (src/schemas)

- Rectangles: Core components
- Rounded rectangles: Services/APIs
- Hexagons: Authentication components

- Blue: Core application components
- Green: Authentication-related components
- Orange: Job-related features
- Gray: Utility services

- Double lines: Authentication flow

##### Layer Organization (Top to Bottom)

**┌─────────────────────────────────────────┐**
- UI Components                │
- (Components from src/components)        │
- ┤
- Route Handlers               │
- (From src/routes directory)            │
- ┤
- Network Layer                │
- (API services from src/network)         │
- ┤
- Schema Validation            │
- (From src/schemas)                      │
- ┘

##### Key Features to Highlight

- Authentication Flow:
- Login/Signup
- Password Reset
- Email Verification
- Profile Management

- Job Alert System:
- Alert Creation
- Alert Management
- Job Viewing

##### Technical Stack Elements

- Vite (Build Tool)
- React + TypeScript
- TanStack Router
- Axios for API calls
- Tailwind CSS
- Playwright (Testing)

##### The protected routes structure (_auth_routes)

Remember to show how the components communicate with the backend services through the network layer, and how the authentication state affects the routing and component rendering.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "UI Layer"
        UI_COMP["UI Components"]
        FORMS["Form Components"]:::form
        COMMON["Common UI Components"]:::ui
        JOB_COMP["Job Components"]:::job
        AUTH_COMP["Auth Components"]:::auth
    end

    subgraph "Routing Layer"
        ROUTER["Client-Side Router"]:::router
        PROTECTED["Protected Routes"]:::auth
        PUBLIC["Public Routes"]:::public
    end

    subgraph "Network Layer"
        AXIOS["Axios Instance"]:::network
        AUTH_API["Auth Service"]:::auth
        JOBS_API["Jobs Service"]:::job
        USER_API["User Service"]:::user
    end

    subgraph "Data Layer"
        SCHEMAS["Schema Validation"]:::validation
        FORM_HOOKS["Form Hooks"]:::form
    end

    %% Component Relationships
    UI_COMP --> ROUTER
    ROUTER --> PROTECTED
    ROUTER --> PUBLIC
    PROTECTED --> AUTH_API
    PROTECTED --> JOBS_API
    PROTECTED --> USER_API
    PUBLIC --> AUTH_API
    FORMS --> FORM_HOOKS
    FORM_HOOKS --> SCHEMAS
    SCHEMAS --> AUTH_API
    SCHEMAS --> JOBS_API
    SCHEMAS --> USER_API
    AUTH_API --> AXIOS
    JOBS_API --> AXIOS
    USER_API --> AXIOS

    %% Click Events
    click ROUTER "https://github.com/Iamsheye/scrapper-fe/blob/main/src/routeTree.gen.ts"
    click PROTECTED "https://github.com/Iamsheye/scrapper-fe/tree/main/src/routes/_auth_routes"
    click AUTH_API "https://github.com/Iamsheye/scrapper-fe/blob/main/src/network/auth.ts"
    click JOBS_API "https://github.com/Iamsheye/scrapper-fe/blob/main/src/network/jobs.ts"
    click USER_API "https://github.com/Iamsheye/scrapper-fe/blob/main/src/network/user.ts"
    click AXIOS "https://github.com/Iamsheye/scrapper-fe/blob/main/src/network/axiosInstance.ts"
    click SCHEMAS "https://github.com/Iamsheye/scrapper-fe/tree/main/src/schemas"
    click FORM_HOOKS "https://github.com/Iamsheye/scrapper-fe/blob/main/src/hooks/useHookForm.tsx"
    click FORMS "https://github.com/Iamsheye/scrapper-fe/blob/main/src/components/input.tsx"
    click COMMON "https://github.com/Iamsheye/scrapper-fe/tree/main/src/components"
    click JOB_COMP "https://github.com/Iamsheye/scrapper-fe/blob/main/src/components/job-alert.tsx"
    click AUTH_COMP "https://github.com/Iamsheye/scrapper-fe/blob/main/src/routes/login.tsx"

    %% Styling
    classDef default fill:#ddd,stroke:#333,stroke-width:1px
    classDef auth fill:#90EE90,stroke:#333,stroke-width:1px
    classDef job fill:#FFB347,stroke:#333,stroke-width:1px
    classDef user fill:#87CEEB,stroke:#333,stroke-width:1px
    classDef network fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef form fill:#F0E68C,stroke:#333,stroke-width:1px
    classDef validation fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef router fill:#B8860B,stroke:#333,stroke-width:1px
    classDef public fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
```
