# ferib/mcdonald_loyaltycodegenerator architecture

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

- Interactive diagram: https://gitdiagram.com/ferib/mcdonald_loyaltycodegenerator
- Repository: https://github.com/ferib/mcdonald_loyaltycodegenerator

## Overview

##### Project type and purpose
- From the file tree and README, this is an open-source .NET console application (ReverseCoffee) whose goal is to reverse-engineer and interact with the McDonald’s mobile application’s API to obtain free food.
- It also includes a small local web interface (index.html) served by Nancy, and a Discord webhook notifier.

##### File structure
- Top-level files:
- ReverseCoffee.csproj – the .NET project file
- Program.cs – the app’s entrypoint
- DiscordWebhookHandler.cs – sends notifications to a Discord webhook
- McDonald.cs and McStruct.cs – data models & client logic for the McDonald’s API
- Nancy.cs – configuration of the Nancy web server used to serve the UI
- index.html – the front-end UI served locally
- action.yml – GitHub Actions CI workflow
- .github/FUNDING.yml, .gitignore, LICENSE, README.md – repository metadata
- No separate “frontend” or “backend” directories; modules are all at root.

##### README
- Confirms the intent: a hacking tool to reverse the McDonald’s mobile app for cost reduction.

a. Main components
1. Program (Console App entrypoint)
2. Nancy Web Server Module
3. UI (index.html)
4. McDonald API Client (McDonald.cs + McStruct.cs)
5. DiscordWebhookHandler
6. External Services
– McDonald’s Mobile API Endpoints
– Discord Webhook Endpoint
7. CI/CD (GitHub Actions – action.yml)

b. Relationships & data flows
- Program.cs initializes:
- Nancy server (serves index.html, exposes endpoints for user actions)
- DiscordWebhookHandler (ready to send events)
- McDonald API Client (ready to craft and send HTTP requests)
- Browser/UI → Nancy routes → Program logic
- Nancy handlers call McDonald client → send/receive HTTP → McDonald’s API
- Nancy handlers also invoke DiscordWebhookHandler → send notifications
- Nancy serves updated results back to UI
- GitHub Actions triggers on push/pull to build/test/deploy

c. Architectural patterns & design principles
- Single-process modular design: console app hosts both HTTP server and client logic
- Separation of concerns:
- Web server layer (Nancy.cs)
- API client/data models (McDonald.cs, McStruct.cs)
- Notification subsystem (DiscordWebhookHandler.cs)
- Static UI (index.html)
- Extensibility: additional modules (e.g., new endpoints or webhook handlers) can be plugged into Nancy

d. Key technologies & frameworks
- .NET (C#) console application
- NancyFX (lightweight embedded web server)
- HTTP/REST client logic
- Discord Webhook API
- GitHub Actions for CI

##### Detailed capture of essential elements
- Don’t simply list files; group them by module
- Initialization flow in Program.cs
- GitHub Actions workflow as a side component
- Static UI (index.html) is shown as “served asset” by Nancy

- A “ReverseCoffee App” container, subdivided into:
– Program (entrypoint)
– Nancy Web Server
– McDonald API Client (with data models)
– Discord Webhook Handler
– Static UI Asset
– McDonald’s Mobile API
– Discord Webhook Endpoint
– GitHub Actions
– Program → Nancy startup
– Nancy ↔ UI (HTTP)
– Nancy → McDonald API Client → McDonald’s API
– Nancy → DiscordWebhookHandler → Discord
– GitHub Actions → ReverseCoffee build/test/deploy

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% ReverseCoffee Application Container
    subgraph "ReverseCoffee App"
        direction TB
        RCProj["ReverseCoffee.csproj"] 
        Program["Program (entrypoint)"] 
        subgraph "Web Server Layer"
            direction TB
            Nancy["Nancy Web Server Module"]
            UI["Static UI Asset (index.html)"]
        end
        subgraph "Core Modules"
            direction TB
            subgraph "McDonald API Client"
                direction TB
                McDonald["McDonald client logic (McDonald.cs)"]
                McStruct["Data models (McStruct.cs)"]
            end
            Discord["Discord Webhook Handler (DiscordWebhookHandler.cs)"]
        end
    end

    %% External Services
    McDonaldsAPI["McDonald's Mobile API"] 
    DiscordEndpoint["Discord Webhook Endpoint"]
    
    %% CI/CD
    GitHubActions["GitHub Actions (action.yml)"]

    %% Repository Metadata
    subgraph "Repository Metadata"
        direction TB
        README["README.md"]
        License["LICENSE"]
        Gitignore[".gitignore"]
        Funding[".github/FUNDING.yml"]
    end

    %% Data Flows and Dependencies
    Program -->|"initializes"| Nancy
    Nancy -->|serves HTTP| UI
    UI -->|user actions| Nancy
    Nancy -->|calls| McDonald
    McDonald -->|uses| McStruct
    McDonald -->|HTTP requests| McDonaldsAPI
    Nancy -->|invokes| Discord
    Discord -->|posts to| DiscordEndpoint
    GitHubActions -->|builds/tests/deploys| RCProj

    %% Click Events
    click Program "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/Program.cs"
    click Nancy "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/Nancy.cs"
    click UI "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/index.html"
    click McDonald "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/McDonald.cs"
    click McStruct "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/McStruct.cs"
    click Discord "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/DiscordWebhookHandler.cs"
    click RCProj "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/ReverseCoffee.csproj"
    click GitHubActions "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/action.yml"
    click README "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/readme.md"
    click License "https://github.com/ferib/mcdonald_loyaltycodegenerator/tree/master/LICENSE"
    click Gitignore "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/.gitignore"
    click Funding "https://github.com/ferib/mcdonald_loyaltycodegenerator/blob/master/.github/FUNDING.yml"

    %% Styles
    classDef internal fill:#D0E8FF,stroke:#0366D6,stroke-width:1px
    classDef external fill:#D4F4DD,stroke:#22863A,stroke-width:1px
    classDef ci fill:none,stroke:#DBAB09,stroke-dasharray: 5 5
    classDef metadata fill:#FFF5B1,stroke:#B39200,stroke-width:1px

    class RCProj,Program,Nancy,UI,McDonald,McStruct,Discord internal
    class McDonaldsAPI,DiscordEndpoint external
    class GitHubActions ci
    class README,License,Gitignore,Funding metadata
```
