PhotoMapAI Architecture
PhotoMapAI is a modular web application designed for efficient photo management, AI-powered search, and interactive visualization. Its architecture is organized into distinct layers and components to ensure scalability, maintainability, and ease of development.
Overview
PhotoMapAI consists of three main layers:
-
Frontend
- Built with HTML, CSS, and JavaScript (ES6 modules).
- Provides a responsive user interface for browsing, searching, and visualizing photos.
- Uses libraries such as Swiper for slideshows and Plotly for UMAP visualizations.
-
Backend
- Powered by FastAPI (Python).
- Handles API requests, image processing, metadata extraction, and search operations.
- Integrates with AI models for similarity and text-based search.
-
Storage & Configuration
- Stores images, thumbnails, and metadata on disk.
- Uses YAML configuration files to manage albums and application settings.
Component Diagram
+-------------------+ REST API +-------------------+ Disk/YAML +--------------+
| Frontend UI | <----------------> | Backend | <----------------> | Images/Config|
+-------------------+ +-------------------+ +--------------+
Key Components
Frontend
- Slideshow & Gallery: Interactive image browsing with keyboard and touch support.
- Search Panel: AI-enabled search (similarity, text, metadata).
- UMAP Visualization: Clustered view of image embeddings.
- Settings & Album Manager: Album creation, editing, and configuration.
Backend
- API Routers:
/search
: Search endpoints (similarity, text, metadata)./albums
: Album management./images
: Image and thumbnail serving.- Metadata Extraction: Parses and formats image metadata (EXIF, AI-generated).
- Indexing & Embeddings: Generates and stores image embeddings for fast search.
- Config Manager: Loads and updates YAML configuration files.
Storage
- Images: Original and processed images stored in album directories.
- Thumbnails: Cached thumbnails for fast display.
- Metadata: JSON and YAML files for image and album metadata.
Data Flow
-
User Interaction:
User browses or searches for images via the frontend UI. -
API Request:
Frontend sends requests to backend endpoints for images, search, or metadata. -
Processing:
Backend processes requests, performs AI search, extracts metadata, and returns results. -
Rendering:
Frontend updates UI with images, overlays, and search results.
Extensibility
- Modular Routers: Easily add new API endpoints.
- Pluggable Metadata Modules: Support for custom metadata extraction.
- Frontend Components: Add new panels or visualizations with minimal changes.
Technologies Used
- Frontend: HTML5, CSS3, JavaScript (ES6), Swiper, Plotly
- Backend: Python 3, FastAPI, Pydantic, PIL/Pillow, UMAP, YAML
- Storage: Local filesystem, YAML/JSON
Development Notes
- All major components are documented in the
docs/developer/
section. - See
docs/developer/api.md
for endpoint details. - See
docs/developer/frontend.md
for UI component structure.