# 31133498/dermascanai architecture

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

- Interactive diagram: https://gitdiagram.com/31133498/dermascanai
- Repository: https://github.com/31133498/dermascanai

## Overview

##### Project type and purpose
- From the file tree and README, DermaScanAI is a single-page React application (frontend) that enables users to upload skin images and receive automated disease-detection results from an external AI service (EfficientNetB3-based).

##### File structure
- Top‐level files:
- .env, .gitignore, README.md – configuration and documentation
- package.json – lists React and build dependencies
- public/ – static assets (index.html, manifest.json) served by the web host
- src/ – application source code
- index.js, App.js – entry points for the React SPA
- components/ – React components organized by feature (MainPage, AIDoctorPage, DermaScan ScannerPage, AboutPage, Header)
- services/geminiService.js – abstraction layer for calling the remote AI inference API

##### README for additional insights
- DermaScan AI uses deep learning (transfer learning on EfficientNetB3) to analyze user-uploaded skin lesion images
- It’s intended for both end users and medical professionals

a. Main components:
1) Client (User’s Browser)
2) React SPA (served via a static host/CDN)
3) Service Layer (geminiService.js)
4) AI Inference Service (EfficientNetB3 model server or managed cloud AI endpoint)
5) (Optional) Persistence Layer (database or logging service for storing user sessions or results)
6) (Optional) CI/CD & Hosting Platform (e.g., Netlify, Vercel, GitHub Actions)

b. Relationships & data flow:
- Browser requests index.html + JS/CSS from the static host
- User interacts with React UI → selects or captures an image
- UI invokes geminiService.uploadImage(image)
- geminiService makes an HTTP POST to the AI Inference Service endpoint
- Inference Service loads the image, runs EfficientNetB3 classifier, returns prediction + confidence
- geminiService returns the result to the UI → React component updates state and renders the diagnosis
- (Optional) UI or service layer logs the transaction to the Persistence Layer

c. Architectural patterns & design principles:
- Single Page Application (SPA) for a seamless client experience
- Component‐based UI structure for maintainability
- Service abstraction layer separates UI from network logic
- Externalized AI inference as a microservice, enabling model updates without touching the client

d. Key technologies/frameworks:
- React (create-react-app) for building the SPA
- CSS modules for scoped styling per component
- geminiService.js as the API client (fetch or Axios under the hood)
- EfficientNetB3 model hosted on a Python/Flask or cloud function endpoint
- Optional: Node.js or serverless functions for handling uploads and pre/post‐processing

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client/UI Layer
    subgraph "Client (User’s Browser)" 
        direction TB
        Browser["Browser"]:::client
    end

    subgraph "Static Host/CDN" 
        direction TB
        IndexHtml["index.html"]:::client
        Manifest["manifest.json"]:::client
    end

    Browser -->|"HTTP GET index.html, JS, CSS"| IndexHtml
    IndexHtml -->|"loads SPA"| Browser

    %% React SPA
    subgraph "React SPA (src)" 
        direction TB
        Index["index.js"]:::client
        App["App.js"]:::client
        subgraph "UI Components"
            direction TB
            MainPage["MainPage"]:::client
            AIDoctorPage["AIDoctorPage"]:::client
            ScannerPage["ScannerPage"]:::client
            AboutPage["AboutPage"]:::client
            Header["Header"]:::client
        end
    end

    Browser -->|"initialize SPA"| Index
    Index --> App
    App --> Header
    App --> MainPage
    App --> AIDoctorPage
    App --> ScannerPage
    App --> AboutPage

    %% Service Layer
    subgraph "Service Layer" 
        direction TB
        GeminiService["geminiService.js"]:::api
    end

    ScannerPage -->|"uploadImage(image)"| GeminiService

    %% AI Inference Backend
    subgraph "AI Inference Service" 
        direction TB
        MLService["EfficientNetB3 Model Endpoint"]:::ml
    end

    GeminiService -->|"HTTP POST /classify"| MLService
    MLService -->|"prediction + confidence"| GeminiService
    GeminiService -->|"returns result"| ScannerPage

    %% Optional Persistence
    subgraph "Persistence Layer" 
        direction TB
        Database["Database / Logging Service"]:::storage
    end

    GeminiService -->|"log transaction"| Database

    %% Optional CI/CD Pipeline
    subgraph "CI/CD & Hosting" 
        direction TB
        Pipeline["GitHub Actions / Netlify"]:::storage
    end

    Pipeline --> IndexHtml
    Pipeline --> MLService

    %% Click Events
    click Index "https://github.com/31133498/dermascanai/blob/main/src/index.js"
    click App "https://github.com/31133498/dermascanai/blob/main/src/App.js"
    click MainPage "https://github.com/31133498/dermascanai/blob/main/src/components/MainPage/MainPage.js"
    click AIDoctorPage "https://github.com/31133498/dermascanai/blob/main/src/components/AIDoctorPage/AIDoctorPage.js"
    click ScannerPage "https://github.com/31133498/dermascanai/blob/main/src/components/DermaScan/ScannerPage.js"
    click AboutPage "https://github.com/31133498/dermascanai/blob/main/src/components/AboutPage/AboutPage.js"
    click Header "https://github.com/31133498/dermascanai/blob/main/src/components/Header/Header.js"
    click GeminiService "https://github.com/31133498/dermascanai/blob/main/src/services/geminiService.js"
    click IndexHtml "https://github.com/31133498/dermascanai/blob/main/public/index.html"
    click Manifest "https://github.com/31133498/dermascanai/blob/main/public/manifest.json"

    %% Styles
    classDef client fill:#a8e6cf,stroke:#2d6a4f,stroke-width:1px,color:#054a29;
    classDef api fill:#b3cde0,stroke:#0b3d91,stroke-width:1px,color:#001f54;
    classDef ml fill:#ffd3b6,stroke:#d35400,stroke-width:1px,color:#873600;
    classDef storage fill:#cccccc,stroke:#555555,stroke-width:1px,color:#333333;
```
