# takaotaku/digimon-card-app architecture

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

- Interactive diagram: https://gitdiagram.com/takaotaku/digimon-card-app
- Repository: https://github.com/takaotaku/digimon-card-app

## Overview

##### Main Components
- Frontend Client:
- Built with Angular, using features like NGRX for state management, TailwindCSS for styling, and PrimeNG for UI components.
- Organized into multiple “features” modules (e.g., Collection, Community, Deckbuilder, Decks, Home, Products, Profile) that encapsulate specific functionality.
- Contains shared components (e.g., dialogs, navigation, common services, pipes, and functions).
- Backend & Cloud Services:
- Firebase is used for hosting the application, managing the database (as indicated by database.rules.json and firebase.json), and possibly enabling authentication.
- Deployment workflows in the .github/workflows directory indicate CI/CD integration with Firebase deployments.
- Data Processing & Integration Scripts:
- Python scripts (in the “scripts/python” directory) that perform data extraction, transformation, and updates from external sources (for example, getting data and images from the Digimon Card Wiki).
- These scripts handle tasks like updating card details, processing images, and ensuring that the data files (JSON files under /src/assets/cardlists and /scripts/python/Wiki/jsons) stay up-to-date.
- Data Storage:
- Static JSON files (card lists, rulings, etc.) are stored under /src/assets/cardlists and in the Python scripts’ json directories.
- There may also be data stored in Firebase (given the presence of “database.rules.json”) to support dynamic user interactions (collections, decks, profiles).

##### Relationships and Interactions
- The Angular Frontend interacts with:
- Firebase’s hosting and database services via the Angular services (e.g., auth.service, database.service, digimon-backend.service).
- The NGRX Store which manages application-wide state updates and data flows across components.
- The deployment pipeline (GitHub Actions) automates builds and deploys to Firebase.
- The Python scripts come into play as auxiliary services:
- They process data from an external Wiki (and possibly other external data sources) and update the static JSON files that the Angular app reads.
- There is a clear separation here – the frontend renders data from the JSON files while the background processes keep them current.

##### Important Architectural Patterns & Technologies
- Modular Component-Based Architecture: Angular’s structure is laid out in clear “features” with dedicated components, directives, and services.
- Reactive State Management: Use of NGRX (in the /src/store directory) shows adherence to a Redux-based pattern for managing and synchronizing state across the app.
- CI/CD and Automated Deployments: Workflow files in the .github directory emphasize automated deployment processes to different environments (dev, hosting).
- Separation of Concerns: The system is divided into a user-focused frontend and separate data processing scripts (Python) that run outside the main application—an approach that simplifies maintenance and updates.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend - Angular Application
    subgraph "Frontend - Angular Application"
      direction TB
      Angular["Angular App"]:::frontend
      Features["Features Modules"]:::frontend
      Shared["Shared Components & Services"]:::frontend
      Store["NGRX Store (State Management)"]:::state
      Angular -->|"Uses"| Features
      Angular -->|"Uses"| Shared
      Angular -->|"ManagesStateVia"| Store
    end

    %% Backend & Cloud Services (Firebase)
    subgraph "Backend & Cloud Services (Firebase)"
      direction TB
      FirebaseHosting["Firebase Hosting"]:::backend
      FirebaseDB["Firebase Database & Authentication"]:::backend
      FirebaseHosting -->|"Serves"| Angular
      FirebaseDB -->|"ProvidesData"| Angular
      Store -->|"SyncsWith"| FirebaseDB
      Shared -->|"Calls"| FirebaseDB
    end

    %% Data Storage
    subgraph "Data Storage"
      direction TB
      JSONAssets["Static JSON Files (Cardlists, Rulings)"]:::datastore
    end

    %% Data Processing Scripts (Python)
    subgraph "Data Processing Scripts (Python)"
      direction TB
      PythonScripts["Python Scripts"]:::python
      UpdateDecks["UpdateUserDecks"]:::python
      VariousTools["Various Data Tools"]:::python
      WikiProcessing["Wiki Data Processing"]:::python
      PythonScripts --> UpdateDecks
      PythonScripts --> VariousTools
      PythonScripts --> WikiProcessing
      WikiProcessing -->|"Updates"| JSONAssets
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
      direction TB
      GitHubActions["GitHub Actions Workflows"]:::ci
      GitHubActions -->|"DeploysTo"| FirebaseHosting
    end

    %% Interactions between Frontend and Data Storage
    Features -->|"FetchesDataFrom"| JSONAssets

    %% Click Events
    click Angular "https://github.com/takaotaku/digimon-card-app/tree/main/src/app"
    click Features "https://github.com/takaotaku/digimon-card-app/tree/main/src/app/features"
    click Shared "https://github.com/takaotaku/digimon-card-app/tree/main/src/app/features/shared"
    click Store "https://github.com/takaotaku/digimon-card-app/tree/main/src/app/store"
    click FirebaseHosting "https://github.com/takaotaku/digimon-card-app/blob/main/firebase.json"
    click FirebaseDB "https://github.com/takaotaku/digimon-card-app/blob/main/database.rules.json"
    click GitHubActions "https://github.com/takaotaku/digimon-card-app/tree/main/.github/workflows"
    click PythonScripts "https://github.com/takaotaku/digimon-card-app/tree/main/scripts/python"
    click UpdateDecks "https://github.com/takaotaku/digimon-card-app/tree/main/scripts/python/UpdateUserDecks"
    click VariousTools "https://github.com/takaotaku/digimon-card-app/tree/main/scripts/python/Various"
    click WikiProcessing "https://github.com/takaotaku/digimon-card-app/tree/main/scripts/python/Wiki"
    click JSONAssets "https://github.com/takaotaku/digimon-card-app/tree/main/src/assets/cardlists"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px,color:#000;
    classDef state fill:#90EE90,stroke:#000,stroke-width:2px,color:#000;
    classDef backend fill:#FFD700,stroke:#000,stroke-width:2px,color:#000;
    classDef python fill:#FFB6C1,stroke:#000,stroke-width:2px,color:#000;
    classDef ci fill:#D3D3D3,stroke:#000,stroke-width:2px,color:#000;
    classDef datastore fill:#FFA07A,stroke:#000,stroke-width:2px,color:#000;
```
