# alef-burzmali/netbox-data-flows architecture

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

- Interactive diagram: https://gitdiagram.com/alef-burzmali/netbox-data-flows
- Repository: https://github.com/alef-burzmali/netbox-data-flows

## Overview

##### File structure
- Top-level:
- Configuration & CI: .github/, mkdocs.yml, pre-commit, pyproject.toml
- Docs: docs/ + mkdocs site
- Plugin code: netbox_data_flows/
- Plugin package subfolders:
- api/ – DRF serializers, URL router, views
- models/ – Django models (Application, DataFlow, Group, ObjectAlias, ApplicationRole)
- migrations/ – schema changes
- forms/, filtersets/, tables/ – UI forms, filter backends, table definitions
- views/ – Django views to render plugin pages & tab views
- templates/ – HTML Jinja2 templates under netbox_data_flows/
- utils/, navigation.py, search.py – helpers, NetBox navigation/menu registration, custom search support
- Integration points: netbox_data_flows/navigation.py registers new menu items; netbox_data_flows/urls.py included by NetBox router; serializers used by NetBox’s REST API.

##### README for additional insights
- Purpose: document and group data flows to assist network design, firewall automation, security compliance.
- Links to data model docs (to get entity relationship details).
- Features: UI tabs on Devices, VMs, IPs; Data flow detail pages; Application grouping; hierarchical groups.

##### Elements
- Clear labels: “NetBox Core”, “Data Flows Plugin”, “PostgreSQL DB”, “Browser”, “API Client”.
- Plugin components in another (e.g., light green)
- External consumers (browser, automation) in a third (e.g., gray)

##### Additional detail on plugin models to capture
- DataFlow: source object(s) → destination object(s), ports, protocol
- Application: groups multiple DataFlows + optional NetBox object assignments
- Hierarchical grouping of DataFlows or Applications
- ObjectAlias: named references for complex NetBox objects sets
- ApplicationRole: custom roles linking Applications to devices or users

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Consumers
    Browser("User Browser"):::external
    APIClient("API Client"):::external

    %% NetBox Core Boundary
    subgraph "NetBox Core" 
        direction TB
        Django["Django Framework"]:::core
        ORM["Django ORM"]:::core
        RESTAPI["Core REST API"]:::core
        UIEngine["Core UI Engine"]:::core
    end

    %% Plugin Extension Layer
    subgraph "Data Flows Plugin" 
        direction TB

        subgraph "Models" 
            direction TB
            DF["DataFlow Model"]:::plugin
            AP["Application Model"]:::plugin
            GR["Group Model"]:::plugin
            OA["ObjectAlias Model"]:::plugin
            AR["ApplicationRole Model"]:::plugin
        end

        subgraph "API Layer"
            direction TB
            DFS["DataFlow Serializer"]:::plugin
            APS["Application Serializer"]:::plugin
            GRS["Group Serializer"]:::plugin
            OAS["ObjectAlias Serializer"]:::plugin
            API_R["API URL Routing"]:::plugin
            API_V["API ViewSets"]:::plugin
        end

        subgraph "UI Layer"
            direction TB
            subgraph "Forms"
                direction TB
                DF_F["DataFlow Form"]:::plugin
                AP_F["Application Form"]:::plugin
                GR_F["Group Form"]:::plugin
                OA_F["ObjectAlias Form"]:::plugin
                AR_F["ApplicationRole Form"]:::plugin
            end
            subgraph "Filters"
                direction TB
                DF_FL["DataFlow Filter"]:::plugin
                AP_FL["Application Filter"]:::plugin
                GR_FL["Group Filter"]:::plugin
                OA_FL["ObjectAlias Filter"]:::plugin
            end
            subgraph "Tables"
                direction TB
                DF_T["DataFlow Table"]:::plugin
                AP_T["Application Table"]:::plugin
                GR_T["Group Table"]:::plugin
                OA_T["ObjectAlias Table"]:::plugin
            end
        end

        subgraph "Views & Templates"
            direction TB
            V_DF["DataFlow Views"]:::plugin
            V_AP["Application Views"]:::plugin
            V_GR["Group Views"]:::plugin
            V_OA["ObjectAlias Views"]:::plugin
            V_AR["ApplicationRole Views"]:::plugin
            TABS["Tab Mixins"]:::plugin
            Templates["HTML Templates"]:::plugin
        end

        Nav["Navigation Registration"]:::plugin
        Search["Custom Search Integration"]:::plugin
    end

    %% Database
    DB[(PostgreSQL Database)]:::core

    %% Relationships
    Browser -->|UI Request| UIEngine
    UIEngine -->|Plugin Views| V_DF
    UIEngine -->|Plugin Views| V_AP
    UIEngine -->|Plugin Views| V_GR
    UIEngine -->|Plugin Views| V_OA
    UIEngine -->|Plugin Views| V_AR
    Nav -->|Adds Menu| UIEngine
    V_DF -->|uses Models| DF
    V_AP -->|uses Models| AP
    V_GR -->|uses Models| GR
    V_OA -->|uses Models| OA
    V_AR -->|uses Models| AR
    V_DF -->|uses Forms| DF_F
    V_AP -->|uses Forms| AP_F
    V_GR -->|uses Forms| GR_F
    V_OA -->|uses Forms| OA_F
    V_AR -->|uses Forms| AR_F
    V_DF -->|uses Filters| DF_FL
    V_AP -->|uses Filters| AP_FL
    V_GR -->|uses Filters| GR_FL
    V_OA -->|uses Filters| OA_FL
    V_DF -->|uses Tables| DF_T
    V_AP -->|uses Tables| AP_T
    V_GR -->|uses Tables| GR_T
    V_OA -->|uses Tables| OA_T

    APIClient -->|API Request| RESTAPI
    RESTAPI -->|Plugin API| API_R
    API_R -->|routes to| API_V
    API_V -->|serializes| DFS
    API_V -->|serializes| APS
    API_V -->|serializes| GRS
    API_V -->|serializes| OAS
    API_V -->|uses Models| DF
    API_V -->|uses Models| AP
    API_V -->|uses Models| GR
    API_V -->|uses Models| OA

    DF -->|ORM CRUD| ORM
    AP -->|ORM CRUD| ORM
    GR -->|ORM CRUD| ORM
    OA -->|ORM CRUD| ORM
    AR -->|ORM CRUD| ORM
    ORM -->|queries| DB

    Search -->|Integrates| ORM

    %% Click Events - Models
    click DF "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/models/dataflows.py"
    click AP "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/models/applications.py"
    click GR "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/models/groups.py"
    click OA "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/models/objectaliases.py"
    click AR "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/models/applications.py"

    %% Click Events - API Layer
    click DFS "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/serializers/dataflows.py"
    click APS "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/serializers/applications.py"
    click GRS "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/serializers/groups.py"
    click OAS "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/serializers/objectaliases.py"
    click API_R "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/urls.py"
    click API_V "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/api/views.py"

    %% Click Events - UI Layer Forms
    click DF_F "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/forms/dataflows.py"
    click AP_F "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/forms/applications.py"
    click GR_F "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/forms/groups.py"
    click OA_F "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/forms/objectaliases.py"
    click AR_F "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/forms/applicationroles.py"

    %% Click Events - UI Layer Filters
    click DF_FL "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/filtersets/dataflows.py"
    click AP_FL "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/filtersets/applications.py"
    click GR_FL "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/filtersets/groups.py"
    click OA_FL "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/filtersets/objectaliases.py"

    %% Click Events - UI Layer Tables
    click DF_T "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/tables/dataflows.py"
    click AP_T "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/tables/applications.py"
    click GR_T "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/tables/groups.py"
    click OA_T "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/tables/objectaliases.py"

    %% Click Events - Views & Templates
    click V_DF "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/dataflows.py"
    click V_AP "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/applications.py"
    click V_GR "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/groups.py"
    click V_OA "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/objectaliases.py"
    click V_AR "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/applicationroles.py"
    click TABS "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/views/model_tabs.py"
    click Templates "https://github.com/alef-burzmali/netbox-data-flows/tree/main/netbox_data_flows/templates/netbox_data_flows/"

    %% Click Events - Navigation & Search
    click Nav "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/navigation.py"
    click Search "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/search.py"

    %% Click Events - Plugin URLs
    click API_R "https://github.com/alef-burzmali/netbox-data-flows/blob/main/netbox_data_flows/urls.py"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085;
    classDef plugin fill:#d4edda,stroke:#155724,color:#155724;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
