# milleradulu/photobooth architecture

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

- Interactive diagram: https://gitdiagram.com/milleradulu/photobooth
- Repository: https://github.com/milleradulu/photobooth

## Overview

##### Main Components
- Frontend Client: Represent the Flutter-based UI, which is organized within the “lib” directory. This includes:
- The landing module (lib/landing) for the initial entry screen.
- The photobooth module (lib/photobooth) where photos are taken and processed; note the usage of BLoC for state management.
- The share module (lib/share) for sharing and social integrations.
- The stickers module (lib/stickers) that deals with image overlays and adjustments.
- Internationalization and assets management (lib/l10n and assets folders).
- Supporting Libraries (Packages): Show the supporting packages in the “packages” directory (e.g., analytics, authentication_repository, camera, image_compositor, photobooth_ui, photos_repository, platform_helper). These represent reusable components or modules that provide:
- Camera functionality with cross-platform interface (camera, camera_platform_interface, camera_web).
- Image compositing and processing.
- Analytics and authentication services.
- UI helper components that support the main Flutter application.
- Backend Services: Highlight the Firebase Functions component (in the “functions” folder). This layer handles server-side logic (implemented in TypeScript) that may include API endpoints, sharing templates, or other backend processes.
- External Services: Denote Firebase (for authentication, storage, and functions) and, if applicable, Google I/O specific integrations (as mentioned in the README).

##### Establish Relationships and Interactions
- The Flutter Frontend and the Firebase backend (for operations like photo uploads, sharing actions, etc.).
- The Frontend and the supporting packages; for instance, the photobooth UI directly integrates with the camera packages to enable live photo capture, while analytics packages track user events.
- The sharing and stickers modules can interact with additional features from photobooth_ui and photos_repository.
- How the state management (via BLoC pattern in several modules) ties the UI with the business logic.

##### Architectural Patterns & Design Principles to Note
- The separation of concerns provided by modularization: The “lib” folder cleanly separates different screens and functionalities.
- Use of the BLoC pattern for state management across major features (photobooth, share, stickers).
- Reusability through packages – these are split into separate libraries that can be maintained and tested independently.
- Internationalization (i18n) support clearly delineated by the l10n folder and ARB files, which is a core part of the design for language support.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Flutter Frontend Subgraph
    subgraph "Flutter Frontend"
        A["Landing Module"]:::frontend
        B["Photobooth Module (BLoC)"]:::frontend
        C["Share Module"]:::frontend
        D["Stickers Module"]:::frontend
        E["Internationalization & Assets"]:::frontend
    end

    %% Supporting Packages Subgraph
    subgraph "Supporting Packages"
        F["Analytics"]:::package
        G["Authentication"]:::package
        H["Camera (Core)"]:::package
        I["Camera Platform"]:::package
        J["Camera Web"]:::package
        K["Image Compositing"]:::package
        L["Photobooth UI Components"]:::package
        M["Photos Repository"]:::package
        N["Platform Helper"]:::package
    end

    %% Backend Services
    O["Firebase Cloud Functions"]:::backend

    %% External Services
    P["Firebase Integration"]:::external

    %% Interactions between Flutter Frontend Modules and Backend
    B -->|"calls_backend"| O
    C -->|"calls_backend"| O

    %% Interactions between Frontend Modules and Supporting Packages
    A -->|"tracks"| F
    D -->|"tracks"| F
    B -->|"auth"| G
    B -->|"uses"| H
    B -->|"uses"| I
    B -->|"uses"| J
    B -->|"UI_support"| L
    C -->|"uses"| M

    %% Backend Integration with External Services
    O -->|"integrates"| P

    %% Style Declarations
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px,rx:5,ry:5;
    classDef package fill:#A9DFBF,stroke:#1D8348,stroke-width:2px,rx:5,ry:5;
    classDef backend fill:#F5B7B1,stroke:#C0392B,stroke-width:2px,rx:5,ry:5;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px,rx:5,ry:5;

    %% Click Events for Flutter Frontend
    click A "https://github.com/milleradulu/photobooth/tree/main/lib/landing"
    click B "https://github.com/milleradulu/photobooth/tree/main/lib/photobooth"
    click C "https://github.com/milleradulu/photobooth/tree/main/lib/share"
    click D "https://github.com/milleradulu/photobooth/tree/main/lib/stickers"
    click E "https://github.com/milleradulu/photobooth/tree/main/lib/l10n"

    %% Click Events for Supporting Packages
    click F "https://github.com/milleradulu/photobooth/tree/main/packages/analytics"
    click G "https://github.com/milleradulu/photobooth/tree/main/packages/authentication_repository"
    click H "https://github.com/milleradulu/photobooth/tree/main/packages/camera"
    click I "https://github.com/milleradulu/photobooth/tree/main/packages/camera_platform_interface"
    click J "https://github.com/milleradulu/photobooth/tree/main/packages/camera_web"
    click K "https://github.com/milleradulu/photobooth/tree/main/packages/image_compositor"
    click L "https://github.com/milleradulu/photobooth/tree/main/packages/photobooth_ui"
    click M "https://github.com/milleradulu/photobooth/tree/main/packages/photos_repository"
    click N "https://github.com/milleradulu/photobooth/tree/main/packages/platform_helper"

    %% Click Events for Backend and External Services
    click O "https://github.com/milleradulu/photobooth/tree/main/functions"
    click P "https://github.com/milleradulu/photobooth/blob/main/.firebaserc"
```
