# jamf/notifier architecture

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

- Interactive diagram: https://gitdiagram.com/jamf/notifier
- Repository: https://github.com/jamf/notifier

## Overview

##### Project Type and Purpose
- This is a native macOS utility (a desktop app) that is designed to post different types of notifications (alerts and banners) on macOS systems (10.15+).
- The README and file tree clearly indicate that the project is not a full-stack web application or compiler but a macOS Swift tool focused on user notifications.

##### Analyzing the File Structure
- Top-Level Components:
– .ci directory with a Jenkinsfile that indicates CI/CD integration.
– A LICENSE file and .gitignore for source control management.
– The “Notifier” directory, which includes:
─ Main app source (AppDelegate.swift, ArgParser.swift, Functions.swift, Structures.swift, etc.).
─ Two separate sub-app folders: “Notifier - Alerts” and “Notifier - Notifications” – each with its own AppDelegate, assets, and entitlements. These function as helper apps that are invoked by the main Notifier application.
- Other Directories/Files:
– The package and profile directories indicate deployment scripts and configuration (e.g. PPPC mobileconfig for notification permissions).
– Xcode project files (e.g., Notifier.xcodeproj) indicate that this is an Xcode/Swift project.

##### Key Architectural Components
a. Main Notifier Application
– Acts as the entry point. It parses command-line arguments (using Swift Argument Parser) and handles validation.
– Responsible for determining which helper app (Alerts or Notifications) to invoke based on the passed parameters.
b. Helper Applications (“Notifier - Alerts” and “Notifier - Notifications”)
– These are separate executables that handle the actual posting of notifications.
– Both are built using the UserNotifications Framework (which interacts with macOS’s Notification Center).
c. macOS Notification Center
– The system-level component that receives notifications posted by the helper apps.
d. Deployment and Rebranding Modules
– The project includes deployment instructions with PPPC profiles for permission management and scripts (in the package folder) to rebrand the app.
– This portion should be represented as an external system or deployment configuration element that interacts with the main application during installation/updates.

##### Relationships and Data Flow
- Client/User Interaction:
– Receives command-line arguments (or an invocation by a management tool) that trigger notification requests.
- Main App Processing:
– Parses and validates input arguments.
– Decides to forward the notification request to either “Notifier - Alerts” (for persistent alert notifications) or “Notifier - Notifications” (for banners).
- Helper App Invocation:
– The main application launches the appropriate helper app in the user context.
– Helper apps then use the UserNotifications API to post notifications to the macOS Notification Center.
- Notification Center:
– Displays the notifications (banners or alerts) to the end user. Response actions (e.g., clicking triggers a logout or opens a URL as specified in the command-line options) are defined in the app’s logic.
- Deployment Flow and Rebranding:

##### Design Principles and Patterns
- Modular design: The separation between the main application and its helper apps suggests a modular architecture.
- Command/Argument Processing: Emphasize that a command line interface (via Swift Argument Parser) drives the processing flow.
- Separation of Concerns: Clearly demarcate the roles where the main app handles parsing/logic and the helper apps focus solely on notification posting.
- CI/CD Integration: Include the notion that there is an automated build system (referencing the Jenkinsfile in the .ci folder).

## Diagram (Mermaid)

```mermaid
flowchart TD
    A("User/Command Input"):::input
    B("Main Notifier App"):::internal
    C("Notifier - Alerts Helper"):::internal
    D("Notifier - Notifications Helper"):::internal
    E("macOS Notification Center"):::external
    F("Rebranding Script"):::deployment
    G("PPPC Profile"):::deployment
    H("CI/CD Integration"):::cicd

    A --> B
    F --> B
    G --> B
    H --> B
    B -->|"alerts"| C
    B -->|"banners"| D
    C --> E
    D --> E

    click B "https://github.com/jamf/notifier/blob/main/Notifier/Notifier (including AppDelegate.swift, ArgParser.swift, Functions.swift, Structures.swift, UserNotifications.swift)"
    click C "https://github.com/jamf/notifier/blob/main/Notifier/Notifier - Alerts (including AppDelegate.swift, Functions.swift, Structures.swift, UserNotifications.swift, Assets.xcassets)"
    click D "https://github.com/jamf/notifier/blob/main/Notifier/Notifier - Notifications (including AppDelegate.swift, Functions.swift, Structures.swift, UserNotifications.swift, Assets.xcassets)"
    click F "https://github.com/jamf/notifier/blob/main/package/make-notifier-pkg.sh"
    click G "https://github.com/jamf/notifier/blob/main/profile/Allow Notifier Notifications.mobileconfig"
    click H "https://github.com/jamf/notifier/tree/main/.ci/Jenkinsfile"

    classDef input fill:#F5CBA7,stroke:#A04000,stroke-width:2px;
    classDef internal fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef deployment fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef cicd fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
