# techinpark/appstore-status-bot architecture

> Architecture diagram of the GitHub repository techinpark/appstore-status-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/techinpark/appstore-status-bot
- Repository: https://github.com/techinpark/appstore-status-bot

## Overview

##### External Services Layer
- App Store Connect API (Primary data source)
- Slack Webhook API (Notification endpoint)
- Discord Webhook API (Optional notification endpoint)
- GitHub Gist API (State storage)

##### Core Application Components
- Status Checker Module (check_status.js)
- Data Fetcher Module (fetch_app_status.rb)
- Notification Dispatchers:
- Slack Module (slack.js)
- Discord Module (discord.js)

##### Configuration & Support Components
- Localization System (locales directory)
- GitHub Actions Workflow (fetch.yml)
- Authentication & Secrets Management

##### Component Representation
- Use rectangles for main services (App Store Connect, Slack, Discord)
- Use hexagons for processing modules (Status Checker, Data Fetcher)
- Use rounded rectangles for support systems (Localization)

##### Connection Flows

- [GitHub Actions Environment]
- Scheduler (15-min intervals)
- Authentication Manager
- Core Processing Pipeline

##### Data flow
- App Store Connect API → fetch_app_status.rb → check_status.js
- → [Notification Dispatchers] → Slack/Discord

##### Localization system
- Localization Store (en/ja/ko)
- ↓
- Message Formatter
- ↓
- Notification Dispatchers

Key Elements to Label:
- API endpoints
- Authentication points (KEY_ID, ISSUER_ID, WEBHOOK URLs)
- Data transformation steps
- State management (GitHub Gist)
- Scheduled triggers

Remember to:
- Version/date information
- Critical dependencies or failure points
- Document the periodic nature of the system

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Services Layer
    subgraph ExternalServices
        ASC[App Store Connect API]:::external
        Slack[Slack Webhook API]:::external
        Discord[Discord Webhook API]:::external
        Gist[GitHub Gist API]:::external
    end

    %% GitHub Actions Environment
    subgraph GitHubActions
        Scheduler[Scheduler\n15-min intervals]:::scheduler
        Auth[Authentication Manager]:::auth
        
        subgraph CoreProcessing
            DataFetcher[Data Fetcher]:::core
            StatusChecker[Status Checker]:::core
            
            subgraph NotificationSystem
                SlackModule[Slack Module]:::notification
                DiscordModule[Discord Module]:::notification
            end
            
            subgraph LocalizationSystem
                L18n[Localization Store]:::support
                MsgFormatter[Message Formatter]:::support
            end
        end
    end

    %% Data Flow
    Scheduler --> Auth
    Auth --> DataFetcher
    DataFetcher --> ASC
    DataFetcher --> StatusChecker
    StatusChecker --> Gist
    StatusChecker --> MsgFormatter
    L18n --> MsgFormatter
    MsgFormatter --> SlackModule
    MsgFormatter --> DiscordModule
    SlackModule --> Slack
    DiscordModule --> Discord

    %% Styling
    classDef external fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef notification fill:#e74c3c,stroke:#c0392b,color:white
    classDef support fill:#f1c40f,stroke:#f39c12,color:black
    classDef scheduler fill:#9b59b6,stroke:#8e44ad,color:white
    classDef auth fill:#e67e22,stroke:#d35400,color:white

    %% Click Events
    click DataFetcher "https://github.com/techinpark/appstore-status-bot/blob/master/Sources/fetch_app_status.rb"
    click StatusChecker "https://github.com/techinpark/appstore-status-bot/blob/master/Sources/check_status.js"
    click SlackModule "https://github.com/techinpark/appstore-status-bot/blob/master/Sources/slack.js"
    click DiscordModule "https://github.com/techinpark/appstore-status-bot/blob/master/Sources/discord.js"
    click L18n "https://github.com/techinpark/appstore-status-bot/tree/master/locales/"
    click GitHubActions "https://github.com/techinpark/appstore-status-bot/blob/master/.github/workflows/fetch.yml"

    %% Legend
    subgraph Legend
        E[External Services]:::external
        C[Core Processing]:::core
        N[Notification Services]:::notification
        S[Support Systems]:::support
        SC[Scheduler]:::scheduler
        AU[Authentication]:::auth
    end
```
