# atlassian/pragmatic-drag-and-drop architecture

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

- Interactive diagram: https://gitdiagram.com/atlassian/pragmatic-drag-and-drop
- Repository: https://github.com/atlassian/pragmatic-drag-and-drop

## Overview

##### Main Components
- A central “Drag and Drop Engine” (the core) that abstracts native browser events and manages drag state.
- Optional functionality modules such as Auto-scroll, Hitbox detection, Live region announcements, and React Accessibility — components that layer on top of the core to provide enhanced experiences.
- Visual output packages like the ones prefixed with “react-beautiful-dnd-…”, and “react-drop-indicator” that may also manage styling and presentation.
- “Documentation” and “Unit Testing” as supporting components that help illustrate usage and ensure quality.
- The “Flourish” package that likely provides additional templates or effects on top of the core behaviors.

##### Out Their Relationships
- That the optional packages (for instance, those handling visual outputs or assistive controls) depend on having low-level functionalities and “speak” to the core API.

##### Important Architectural Patterns and Design Principles
- The monorepo structure organizes various packages by their specific responsibilities. This shows an adherence to modularity and separation of concerns.
- The system is “framework agnostic” — a brief note on this (e.g., “Works with React, Svelte, Vue, Angular, etc.”) could help underline the design’s flexibility.
- The use of unit and integration tests, along with configuration files (like tsconfig.json, jest.config.js, etc.), reflects the disciplined development process and high testability.

##### Technologies, Frameworks, and Libraries
- TypeScript and TSX use across the modules.
- Testing frameworks such as Jest and Playwright are also part of the system design, though they might be represented as “development support” tools rather than runtime components.
- Although the packages are built to work with any view layer, some components (especially under “react-beautiful-dnd…” and “react-drop-indicator”) show a tight coupling with React paradigms. This can be noted as a common integration style when using the optional visual outputs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Integration Layer
    publicAPI("Public API / Integration Layer"):::integration

    %% Core Engine
    core("Core Engine"):::core

    %% Optional Modules
    autos("Auto-scroll Module"):::module
    hitbox("Hitbox Module"):::module
    live("Live Region Announcements Module"):::module
    reactAcc("React Accessibility Module"):::module

    %% Visual Output Modules Subgraph
    subgraph "Visual Output Modules"
        dndAuto("React-beautiful-dnd-autoscroll"):::module
        dropInd("React-drop-indicator"):::module
        dndMigr("React-beautiful-dnd-migration"):::module
    end

    %% Additional Package
    flourish("Flourish Package"):::module

    %% Support Components
    docs("Documentation Suite"):::support
    testing("Unit Testing Support"):::support

    %% Data Flow from Integration Layer to Core
    publicAPI -->|"captures"| core

    %% Core Engine uses Optional Modules
    core -->|"enhances"| autos
    core -->|"enhances"| hitbox
    core -->|"enhances"| live
    core -->|"enhances"| reactAcc
    core -->|"integrates"| dndAuto
    core -->|"integrates"| dropInd
    core -->|"integrates"| dndMigr
    core -->|"supports"| flourish

    %% Modules provide enhanced behavior back to Integration Layer
    autos -->|"auto-scrollActions"| publicAPI
    hitbox -->|"collisionInfo"| publicAPI
    live -->|"accessibilityUpdates"| publicAPI
    reactAcc -->|"assistFeatures"| publicAPI
    dndAuto -->|"visualAutoScroll"| publicAPI
    dropInd -->|"dropIndication"| publicAPI
    dndMigr -->|"migrationSupport"| publicAPI
    flourish -->|"visualEffects"| publicAPI

    %% Support Components linking to Core Engine
    docs -.->|"guidesUsage"| core
    testing -.->|"ensuresQuality"| core

    %% Click Events for Components
    click core "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/core"
    click autos "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/auto-scroll"
    click hitbox "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/hitbox"
    click live "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/live-region"
    click reactAcc "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/react-accessibility"
    click dndAuto "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/react-beautiful-dnd-autoscroll"
    click dropInd "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/react-drop-indicator"
    click dndMigr "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/react-beautiful-dnd-migration"
    click flourish "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/flourish"
    click docs "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/documentation"
    click testing "https://github.com/atlassian/pragmatic-drag-and-drop/tree/main/packages/unit-testing"

    %% Styles for components
    classDef integration fill:#f9c,stroke:#333,stroke-width:2px;
    classDef core fill:#bbf,stroke:#333,stroke-width:2px;
    classDef module fill:#afa,stroke:#333,stroke-width:2px;
    classDef support fill:#ffb,stroke:#333,stroke-width:2px;
```
