# eddy961206/photo_map architecture

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

- Interactive diagram: https://gitdiagram.com/eddy961206/photo_map
- Repository: https://github.com/eddy961206/photo_map

## Overview

##### Main Components

A. Frontend Layer:
- Web Client (Browser)
- UI Components:
- View (Leaflet)
- Image Gallery
- Marker Clusters

B. Backend Layer:
- Node.js Express Server
- File System Handler
- EXIF Parser Service

C. Storage Layer:
- Local File System (images folder)

##### Component Relationships and Data Flow

**[Client Browser] ←→ [Express Server] ←→ [File System]**

##### Detailed Component Breakdown

Frontend (Client-Side):
- UI Layer
- Leaflet Map Component
- Marker Cluster Plugin
- Image Gallery Component
- Client-Side JavaScript (index.js)

Backend (Server-Side):
- Express Server (server.js)
- API Routes
- /api/images
- /api/image_data
- EXIF Parser Service
- File System Handler

##### Client-Server Communication
- GET /api/images
- GET /api/image_data

##### Server-File System Interaction
- Image file reading
- EXIF data extraction

##### Data Processing Flow
- File reading → EXIF parsing → GPS conversion → JSON response

##### Additional Elements

Technical details in notes or callouts:
- Server port: 3000
- Supported file format: JPG
- Key libraries: Leaflet, exif-parser
- Data transformation: GPS coordinates to decimal format

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef storage fill:#fff2cc,stroke:#d6b656
    classDef external fill:#f5f5f5,stroke:#666666
    classDef api fill:#f8cecc,stroke:#b85450

    %% Frontend Layer
    subgraph Frontend
        Client["Web Client Interface"]
        ClientLogic["Client-Side Logic"]
        UIStyle["UI Styling"]
        
        subgraph UI_Components
            Map["Leaflet Map"]
            Gallery["Image Gallery"]
            Markers["Marker Clusters"]
        end
    end

    %% Backend Layer
    subgraph Backend
        Server["Express Server"]
        MetadataHandler["EXIF Parser Service"]
        FileHandler["File System Handler"]
        
        subgraph API_Endpoints
            Images["/api/images"]
            ImageData["/api/image_data"]
        end
    end

    %% Storage Layer
    FileSystem[(Local File System)]

    %% External Services
    Leaflet{{"Leaflet.js Library"}}
    ExifParser{{"EXIF Parser Library"}}

    %% Local Version Components
    LocalServer["Local Server"]
    LocalClient["Local Client"]
    UploadService["Image Upload Service"]

    %% Relationships
    Client --> ClientLogic
    Client --> UIStyle
    ClientLogic --> Map
    ClientLogic --> Gallery
    Map --> Markers
    Client --> Images
    Client --> ImageData
    Server --> Images
    Server --> ImageData
    Server --> MetadataHandler
    Server --> FileHandler
    FileHandler --> FileSystem
    MetadataHandler --> ExifParser
    Map --> Leaflet

    %% Click Events
    click Client "https://github.com/eddy961206/photo_map/blob/main/index.html"
    click ClientLogic "https://github.com/eddy961206/photo_map/blob/main/index.js"
    click UIStyle "https://github.com/eddy961206/photo_map/blob/main/styles.css"
    click Server "https://github.com/eddy961206/photo_map/blob/main/server.js"
    click MetadataHandler "https://github.com/eddy961206/photo_map/blob/main/setup-metadata.js"
    click LocalServer "https://github.com/eddy961206/photo_map/blob/main/local_version/local_server.js"
    click LocalClient "https://github.com/eddy961206/photo_map/blob/main/local_version/local_index.js"
    click UploadService "https://github.com/eddy961206/photo_map/blob/main/upload2cloudinary.js"

    %% Style Applications
    class Client,ClientLogic,UIStyle,Map,Gallery,Markers frontend
    class Server,MetadataHandler,FileHandler,Images,ImageData backend
    class FileSystem storage
    class Leaflet,ExifParser external
    class Images,ImageData api
    class LocalServer,LocalClient backend
    class UploadService backend
```
