# anime-vsub/app architecture

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

- Interactive diagram: https://gitdiagram.com/anime-vsub/app
- Repository: https://github.com/anime-vsub/app

## Overview

##### Project Type and Purpose
- This project is a hybrid mobile and web application built using web technologies (Vue, Quasar, TypeScript) and integrated with native capabilities via Capacitor. Its purpose is to deliver a fast, intuitive user experience for browsing and watching Anime content from the animevietsub ecosystem.
- The README clearly indicates that the goal is to “speed up the Anime viewer” by replacing the outdated web interface, and the project is distributed as an APK while also supporting a Progressive Web Application (PWA) version.

##### Analyzing the File Structure
- There are multiple layers:
- Native integration: The presence of several Capacitor directories (e.g., “@capacitor”, “src-capacitor”) for both Android and iOS shows that native code and project configurations are maintained for mobile deployment.
- Web front-end: The “src” directory contains Vue components, pages, layouts, composables, and router configuration, which reflect a modern single-page application built using Quasar/Vue.
- Progressive Web App: The “src-pwa” directory holds PWA-specific files such as service workers, manifest, and custom service-worker logic.
- API Parsing and Logic: The “src/apis” folder (and its submodules for parser, runs, and workers) encapsulates the core business logic dealing with API calls, HTML parsing, and asynchronous data operations.
- Backend/Database: The “supabase” directory includes configuration, SQL migrations, and seed files indicating that this project leverages Supabase (or a similar backend-as-a-service) for persistent storage.
- Testing and Utilities: Directories like “__test__” and various helper scripts show testing infrastructure and workflow automation, which are also reflected in the GitHub workflows.
- Other configuration files (e.g., quasar.config.ts, tsconfig.json, package.json, and GitHub workflows) emphasize the build, linting, and deployment aspects.

##### Components
a. Presentation/UI Layer:
- Vue-based user interface showing pages (e.g., home, anime details, search, account management) and components (cards, players, dialogs, etc.).
- Mention that the code is organized into pages, components, layouts, and composables.
b. Mobile/Capacitor Layer:
- Native mobile modules for both Android and iOS under Capacitor.
- How the “src-capacitor” source code mirrors the native integration and configuration, highlighting native plugins and the customized Capacitor kernel.
c. API and Data Processing Layer:
- “src/apis” modules which include parsers (for anime data, notification, ranking, etc.), “runs” modules for executing tasks (AJAX calls, data fetching), and “workers” that likely handle background processing.
- Separation between parsing logic, network requests, and worker threads.
d. Backend and Data Storage:
- “supabase” directory representing the database layer (SQL migrations, seed scripts) as well as connections to external services like Firebase for caching or real-time updates.
e. Additional Elements:
- Testing & CI/CD Infrastructure: Although not part of the runtime architecture, highlight that the project includes a robust set of GitHub workflows for building, testing, linting, and code quality analysis.
- Helper Extensions: Include the external dependency on the “AnimeVsub Helper” extension (mentioned in README) which assists in handling PWA or CORS issues for browsers on mobile platforms.

##### Architectural Relationships and Design Patterns
- The UI layer (Vue/Quasar components) interacts with the API layer via defined interfaces and state management (stores).
- The API layer manages data retrieval, parsing, and any caching using worker threads.
- The native layer (Capacitor) acts as a bridge connecting the web code with platform-specific capabilities such as native UI adjustments, file system access, or push notifications.
- The data storage / backend (Supabase & Firebase) supports persistent user data (e.g., history, favorites) and may also provide APIs for other services.
- Directional data flows: UI sends requests to API services, which in turn may interact with external sources, followed by responses routed back to the UI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation/UI Layer
    subgraph "Presentation/UI Layer"
        UI1["Vue Application Core UI"]:::ui
        UI2["PWA-specific UI"]:::ui
    end

    %% API & Data Processing Layer
    subgraph "API & Data Processing Layer"
        API1["API Parsing & Logic"]:::api
        API2["Cache & Worker Wrappers"]:::api
    end

    %% Mobile/Capacitor Integration Layer
    subgraph "Mobile/Capacitor Integration Layer"
        Mobile1["Capacitor Core & Plugins"]:::mobile
        Mobile2["Native Mobile Integration"]:::mobile
    end

    %% Backend & Data Storage
    subgraph "Backend & Data Storage"
        DB1["Supabase Database"]:::backend
        DB2["Firebase Services"]:::backend
    end

    %% External Services
    subgraph "External Services"
        Ext1["AnimeVsub Helper Extension"]:::external
    end

    %% Testing & CI/CD Infrastructure
    subgraph "Testing & CI/CD Infrastructure"
        Test1["Automated Tests"]:::test
        Test2["CI/CD Workflows"]:::test
    end

    %% Connections between layers
    UI1 -->|"fetchesData"| API1
    UI2 -->|"fetchesData"| API1

    API1 -->|"usesWorkers"| API2
    API1 -->|"storesData"| DB1
    API1 -->|"syncsWith"| DB2

    UI1 -->|"nativeRequest"| Mobile1
    Mobile1 -->|"executesNative"| Mobile2

    UI2 -->|"extensionHelp"| Ext1

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef api fill:#C1E1C1,stroke:#000,stroke-width:2px;
    classDef mobile fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef backend fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef test fill:#F0E68C,stroke:#000,stroke-width:2px;
    classDef external fill:#FFB6C1,stroke:#000,stroke-width:2px;

    %% Click Events
    click UI1 "https://github.com/anime-vsub/app/tree/main/src"
    click UI2 "https://github.com/anime-vsub/app/tree/main/src-pwa"
    click API1 "https://github.com/anime-vsub/app/tree/main/src/apis"
    click API2 "https://github.com/anime-vsub/app/tree/main/src/apis/workers"
    click Mobile1 "https://github.com/anime-vsub/app/tree/main/@capacitor"
    click Mobile2 "https://github.com/anime-vsub/app/tree/main/src-capacitor"
    click DB1 "https://github.com/anime-vsub/app/tree/main/supabase"
    click DB2 "https://github.com/anime-vsub/app/tree/main/firebase"
    click Test1 "https://github.com/anime-vsub/app/tree/main/src/__test__"
    click Test2 "https://github.com/anime-vsub/app/tree/main/.github/workflows"
```
