# manomanotech/firefighter-incident architecture

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

- Interactive diagram: https://gitdiagram.com/manomanotech/firefighter-incident
- Repository: https://github.com/manomanotech/firefighter-incident

## Overview

Based on our analysis of the file structure and README, FireFighter is a full-stack, incident management web application built in Python (with a Django-based structure) that integrates with several external services (such as Slack, Jira, PagerDuty, Confluence, and Raid). It is designed to help manage incident lifecycles—including the automatic creation of communication channels on Slack—and to serve as ManoMano’s in-house Incident Management Tool.

##### Main Components
- Web/API Server: Represent the core backend application (located in src/manage.py and the firefighter module [src/firefighter/firefighter/]) that includes Django or similar web framework settings (ASGI/WGSI, middleware, settings modules, etc.). This is responsible for routing requests, rendering templates (admin, web pages), and providing APIs.
- Domain Logic – Incident Management: Capture the business logic for incidents within the “incidents” module (src/firefighter/incidents/), which includes models, forms, views, templates, and tasks related to incident creation and management.
- API Endpoints: The “api” component (src/firefighter/api/) exposes endpoints (with serializers, models, and views) for administrative functions and integrations.
- Integration Modules:
- Slack Integration: Under src/firefighter/slack, this module manages communication with Slack’s API including events, modals, messages, and commands. It automates actions like creating Slack channels and sending notifications.
- Confluence Integration: Found in src/firefighter/confluence, which helps synchronise incident or postmortem information with Confluence pages.
- Jira Integration: The module in src/firefighter/jira_app handles interactions with Jira to perhaps create or manage issues related to incidents.
- PagerDuty Integration: The module in src/firefighter/pagerduty configures the integration for on-call alerts and incident escalations.
- Raid Integration: Located under src/firefighter/raid, supporting additional incident management features or integrations.
- Background/Asynchronous Processing: Indicate that some modules (e.g., tasks within incidents, confluence, pagerduty, slack, and jira_app) are executed asynchronously, likely using a task queue (as hinted by files like celery_client.py and command scripts).

##### Relationships and Data Flow
- The core web/API server (the Django-based monolith) acts as the central hub.
- Incident creation and management flows from the web server to the “incidents” module, which then triggers downstream processes.
- When an incident is raised or updated:
- The Slack module is engaged to automatically create a Slack channel or send notifications.
- The Confluence module synchronizes data to corresponding Confluence pages.
- The Jira module may create or update Jira issues.
- The PagerDuty module interacts with PagerDuty’s API to manage on-call alerts.
- The Raid module processes additional incident-specific logic.
- Background tasks are triggered (via Celery or an equivalent task/job scheduling mechanism) for operations that are asynchronous, so mark connections between components where tasks invoke external API calls.

##### Architectural Patterns and Design Principles
- Modular Monolithic Design: Although it’s a single integrated codebase, the architecture is organized into distinct packages for each integration and domain feature.
- Separation of Concerns: Each folder (incidents, slack, confluence, etc.) represents a clear separation in functionality.
- API-Driven Interactions: All interactions (internal or external) use well-defined APIs and endpoints.
- Containerization and CI/CD: Dockerfile and GitHub workflows indicate an emphasis on containerized deployment and automated testing/CI pipelines.

##### Technologies/Frameworks
- Python (with Django or a similar framework)
- Celery (or similar for background task processing) as indicated by celery_client.py and task directories
- External integration libraries for Slack, Jira, PagerDuty, and Confluence
- Docker for containerization
- GitHub Actions for CI/CD (referenced in .github/workflows)
- Testing frameworks (presence of tests directory)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Deployment & Containerization"
        Deployment["Deployment & Containerization"]:::deployment
    end

    subgraph "Application Core"
        direction TB
        WebAPI["Web/API Server"]:::internal
        IncidentModule["Incident Management"]:::internal
        APIEndpoints["API Endpoints"]:::internal
        BackgroundTasks["Background/Async Processing"]:::async
    end

    subgraph "Integration Modules"
        direction TB
        SlackModule["Slack Integration"]:::integration
        ConfluenceModule["Confluence Integration"]:::integration
        JiraModule["Jira Integration"]:::integration
        PagerDutyModule["PagerDuty Integration"]:::integration
        RaidModule["Raid Integration"]:::integration
    end

    subgraph "External Services"
        direction TB
        extSlack["Slack API"]:::external
        extConfluence["Confluence API"]:::external
        extJira["Jira API"]:::external
        extPagerDuty["PagerDuty API"]:::external
        extRaid["Raid Service"]:::external
    end

    %% Connections
    Deployment -->|"deploys"| WebAPI
    WebAPI -->|"routes"| IncidentModule
    WebAPI -->|"exposes"| APIEndpoints
    IncidentModule -->|"triggers"| SlackModule
    IncidentModule -->|"triggers"| ConfluenceModule
    IncidentModule -->|"triggers"| JiraModule
    IncidentModule -->|"triggers"| PagerDutyModule
    IncidentModule -->|"triggers"| RaidModule
    IncidentModule -->|"schedules"| BackgroundTasks

    SlackModule -->|"communicates"| extSlack
    ConfluenceModule -->|"syncs"| extConfluence
    JiraModule -->|"updates"| extJira
    PagerDutyModule -->|"alerts"| extPagerDuty
    RaidModule -->|"processes"| extRaid

    %% Click Events
    click WebAPI "https://github.com/manomanotech/firefighter-incident/blob/main/src/manage.py"
    click WebAPI "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/firefighter/"
    click IncidentModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/incidents/"
    click APIEndpoints "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/api/"
    click SlackModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/slack/"
    click ConfluenceModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/confluence/"
    click JiraModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/jira_app/"
    click PagerDutyModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/pagerduty/"
    click RaidModule "https://github.com/manomanotech/firefighter-incident/tree/main/src/firefighter/raid/"
    click BackgroundTasks "https://github.com/manomanotech/firefighter-incident/blob/main/src/firefighter/firefighter/celery_client.py"
    click Deployment "https://github.com/manomanotech/firefighter-incident/tree/main/Dockerfile"
    click Deployment "https://github.com/manomanotech/firefighter-incident/blob/main/docker-compose.yaml"
    click Deployment "https://github.com/manomanotech/firefighter-incident/tree/main/.github/workflows/"

    %% Styles
    classDef internal fill:#f0f8ff,stroke:#4682b4,stroke-width:2px;
    classDef integration fill:#fffacd,stroke:#daa520,stroke-width:2px;
    classDef async fill:#e6e6fa,stroke:#800080,stroke-width:2px,stroke-dasharray:5,5;
    classDef external fill:#ffe4e1,stroke:#ff4500,stroke-width:2px;
    classDef deployment fill:#d3ffce,stroke:#32cd32,stroke-width:2px;
```
