# devyanshyadav/dev-imgkit architecture

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

- Interactive diagram: https://gitdiagram.com/devyanshyadav/dev-imgkit
- Repository: https://github.com/devyanshyadav/dev-imgkit

## Overview

##### Main System Components

a) Client-Side Layer:
- React/Vite Frontend Application
- Component Structure (Auth, Dashboard, Dev Components)
- Client-side State Management (Zustand)

b) Authentication Layer:
- AWS Cognito Integration
- Auth Flows (Login, Signup, Password Reset)

c) Storage & Processing Layer:
- AWS S3 Bucket
- CloudFront CDN
- Lambda Image Transformation Pipeline

d) AI Integration Layer:
- Google GEMINI API Connection
- AI Transformation Processing

##### Component Relationships

Frontend → Authentication:
- Auth flow between React components and Cognito
- Protected routes and session management

Frontend → Storage:
- Direct S3 upload paths
- CloudFront distribution for delivery
- File transformation requests

Frontend → AI:
- GEMINI API integration for AI transformations
- Prompt processing flow

##### Specific Implementation Details

- Blue: Frontend Components
- Green: AWS Services
- Purple: AI Services
- Yellow: Security/Auth Components

- Red lines: Protected/authenticated routes

**[React Frontend Components]**
- ↓
**[Authentication Layer]**
- ↓
**[Storage & Processing]**
- ↓
**[AI Services]**

##### Important Elements

Frontend Layer:
- Auth Components (/src/components/auth-cmp)
- Dashboard Components (/src/components/dashboard-cmp)
- Dev Components (/src/components/dev-components)
- Global Components (/src/components/global-cmp)

AWS Services Layer:
- Cognito User Pools
- S3 Bucket Configuration
- CloudFront Distribution
- Lambda Functions for Transformations

State & Data Flow:
- Zustand Store Integration
- File Upload/Download Paths
- Transformation Pipeline Flow

##### Technical Details to Highlight

Specific connections for:
- S3 Actions (from s3-actions.ts)
- File Type Handling (from file-type.ts)
- LLM Integration (from llm-prompt.ts)
- Protected Routes (from protected-route.tsx)

This system design should emphasize the scalable nature of the application and how it leverages AWS services for robust image/file management while incorporating modern AI capabilities through the GEMINI API.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Frontend[React/Vite Frontend]
        DashboardUI["Dashboard Interface"]:::frontend
        FileUpload["File Upload UI"]:::frontend
        GlobalCmp["Global Components"]:::frontend
        DevCmp["UI Components"]:::frontend
        AssetDisplay["Asset Display"]:::frontend
        TransformModal["Transformation Modal"]:::frontend
        DeleteModal["Delete Modal"]:::frontend
    end

    subgraph Auth
        Cognito[AWS Cognito]:::aws
        AuthCmp["Auth Components"]:::frontend
        AuthPages["Auth Pages"]:::frontend
        ProtectedRoute["Protected Routes"]:::frontend
    end

    subgraph Storage
        S3[AWS S3 Bucket]:::aws
        CloudFront[CloudFront CDN]:::aws
        Lambda["Lambda Image Processing"]:::aws
        S3Actions["S3 Integration"]:::util
        FileType["File Type Handler"]:::util
        FilePreview["File Preview"]:::util
    end

    subgraph AI
        GEMINI["Google GEMINI API"]:::ai
        LLMIntegration["LLM Integration"]:::util
        TextLLM["Text LLM Processing"]:::util
    end

    subgraph State
        Zustand["Zustand Store"]:::state
    end

    subgraph Config
        AWSConfig["AWS Exports"]:::config
        AmplifyConfig["Amplify Config"]:::config
    end

    Frontend --> AuthCmp
    AuthCmp --> Cognito
    Frontend --> DashboardUI
    DashboardUI --> FileUpload
    FileUpload --> S3Actions
    S3Actions --> S3
    S3 --> CloudFront
    S3 --> Lambda
    Frontend --> GlobalCmp
    GlobalCmp --> AssetDisplay
    GlobalCmp --> TransformModal
    GlobalCmp --> DeleteModal
    TransformModal --> GEMINI
    GEMINI --> LLMIntegration
    LLMIntegration --> TextLLM
    Frontend --> Zustand

    %% Click Events
    click AuthCmp "https://github.com/devyanshyadav/dev-imgkit/tree/master/src/components/auth-cmp"
    click AuthPages "https://github.com/devyanshyadav/dev-imgkit/tree/master/src/pages/auth"
    click ProtectedRoute "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/components/global-cmp/protected-route.tsx"
    click DashboardUI "https://github.com/devyanshyadav/dev-imgkit/tree/master/src/components/dashboard-cmp"
    click FileUpload "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/components/dashboard-cmp/file-upload-ui.tsx"
    click GlobalCmp "https://github.com/devyanshyadav/dev-imgkit/tree/master/src/components/global-cmp"
    click DevCmp "https://github.com/devyanshyadav/dev-imgkit/tree/master/src/components/dev-components"
    click S3Actions "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/s3-actions.ts"
    click FileType "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/file-type.ts"
    click FilePreview "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/file-preview.tsx"
    click LLMIntegration "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/llm-prompt.ts"
    click TextLLM "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/text-llm.ts"
    click Zustand "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/utils/zustsore.ts"
    click AssetDisplay "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/components/global-cmp/asset-cards.tsx"
    click TransformModal "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/components/global-cmp/transformation-modal.tsx"
    click DeleteModal "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/components/global-cmp/delete-modal.tsx"
    click AWSConfig "https://github.com/devyanshyadav/dev-imgkit/blob/master/src/aws-exports.ts"
    click AmplifyConfig "https://github.com/devyanshyadav/dev-imgkit/blob/master/amplify/backend/backend-config.json"
    click Cognito "https://github.com/devyanshyadav/dev-imgkit/tree/master/amplify/backend/auth/devimgkitc337f209"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef aws fill:#ff9900,stroke:#f58700,color:white
    classDef ai fill:#9b59b6,stroke:#8e44ad,color:white
    classDef util fill:#2ecc71,stroke:#27ae60,color:white
    classDef state fill:#e74c3c,stroke:#c0392b,color:white
    classDef config fill:#f1c40f,stroke:#f39c12,color:black
```
