# kireitolemon/inkyame architecture

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

- Interactive diagram: https://gitdiagram.com/kireitolemon/inkyame
- Repository: https://github.com/kireitolemon/inkyame

## Overview

##### Main Components
- Frontend / Client Application:
- Built with Vue3 (see files like src/App.vue, src/main.js, and associated Vue components).
- Serves as the user interface once installed as a PWA, with the index.html as the entry point.
- Includes assets (e.g., images, CSS) and interactive components (such as HelloWorld.vue).
- Face Detection and Recognition Module:
- Utilizes face-api.js and p5.js libraries for real-time face tracking.
- Loads multiple neural network models (weights stored in both public/weights and src/models) to perform detection (face detection, face landmarks, expressions, etc.).
- Service Worker / PWA Engine:
- Supports full-screen, native-app like behavior for the PWA.
- Build/Deployment Environment:
- Docker and docker-compose enable containerized builds and local development.
- The Makefile handles initialization (make init) and starting the local server (make start).
- Hosting & Deployment:
- Cloudflare Pages is mentioned as the hosting service.

##### Relationships and Interactions
- User interacts with the Vue3-powered frontend (PWA) by installing it or loading it in a browser.
- Once started, the application boots up (via index.html and main.js), and triggers background processes that request camera access.
- Camera input is processed by the integrated face-api.js (and possibly p5.js) modules, which load the necessary model weights (retrieved from the public or src/models directories) for face detection and analysis.
- Docker is used during development and potentially for deployment, encapsulating the environment.
- Makefile commands streamline common development tasks.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- UI components are separated from model and asset directories.
- The code structure clearly isolates front-end logic from machine learning model assets.
- Component-Based Design:
- Vue components (in src/components) allow reusability and modular updates.
- PWA Best Practices:
- Leveraging a manifest (public/manifest.webmanifest) and service workers creates a native-like experience.
- Containerization:
- Dockerfile and docker-compose.yml indicate containerized builds for consistency across environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    U["User"]:::user

    %% User Interface (Vue3 PWA)
    subgraph "User Interface (Vue3 PWA)"
        UI1["index.html"]:::ui
        UI2["src/App.vue"]:::ui
        UI3["src/main.js"]:::ui
        UI4["src/components/HelloWorld.vue"]:::ui
    end

    %% Face Detection and Recognition Module
    subgraph "Face Detection and Recognition Module"
        F1["Face Processing Logic (face-api.js & p5.js)"]:::face
        F2["Model Assets (public/weights)"]:::face
        F3["Model Assets (src/models)"]:::face
    end

    %% PWA Engine (Service Worker & Manifest)
    subgraph "PWA Engine"
        P1["Service Worker & Manifest (public/manifest.webmanifest)"]:::pwa
    end

    %% Build & Deployment Environment
    subgraph "Build & Deployment Environment"
        B1["Dockerfile"]:::build
        B2["docker-compose.yml"]:::build
        B3["Makefile"]:::build
    end

    %% Assets and Styling
    subgraph "Assets and Styling"
        A1["Assets (src/assets)"]:::assets
        A2["Style (src/style.css)"]:::assets
    end

    %% Relationships
    U -->|"starts"| UI1
    UI2 -->|"triggers"| F1
    F1 -->|"loads"| F2
    F1 -->|"loads"| F3
    UI2 -->|"registers"| P1
    UI1 -->|"includes"| A1
    UI1 -->|"includes"| A2
    B1 -->|"builds/deploys"| UI1

    %% Click Events
    click UI1 "https://github.com/kireitolemon/inkyame/blob/main/index.html"
    click UI2 "https://github.com/kireitolemon/inkyame/blob/main/src/App.vue"
    click UI3 "https://github.com/kireitolemon/inkyame/blob/main/src/main.js"
    click UI4 "https://github.com/kireitolemon/inkyame/blob/main/src/components/HelloWorld.vue"
    click F2 "https://github.com/kireitolemon/inkyame/tree/main/public/weights"
    click F3 "https://github.com/kireitolemon/inkyame/tree/main/src/models"
    click P1 "https://github.com/kireitolemon/inkyame/blob/main/public/manifest.webmanifest"
    click B1 "https://github.com/kireitolemon/inkyame/tree/main/Dockerfile"
    click B2 "https://github.com/kireitolemon/inkyame/blob/main/docker-compose.yml"
    click B3 "https://github.com/kireitolemon/inkyame/tree/main/Makefile"
    click A1 "https://github.com/kireitolemon/inkyame/tree/main/src/assets"
    click A2 "https://github.com/kireitolemon/inkyame/blob/main/src/style.css"

    %% Styles
    classDef user fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef ui fill:#cce5ff,stroke:#66b3ff,stroke-width:2px;
    classDef face fill:#ccffcc,stroke:#33cc33,stroke-width:2px;
    classDef pwa fill:#e6e6e6,stroke:#b3b3b3,stroke-width:2px;
    classDef build fill:#fff2cc,stroke:#ffd966,stroke-width:2px;
    classDef assets fill:#ffe6cc,stroke:#ff9966,stroke-width:2px;
```
