# bertverbeek4ps/bc2adls architecture

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

- Interactive diagram: https://gitdiagram.com/bertverbeek4ps/bc2adls
- Repository: https://github.com/bertverbeek4ps/bc2adls

## Overview

##### Project type and purpose
- This is an open-source integration tool (“bc2adls”) that exports incremental data from Dynamics 365 Business Central to Azure Data Lake Storage Gen2 or Microsoft Fabric.
- It consists of:
- A Business Central extension (written in AL) that runs in BC and streams data
- Azure Synapse pipelines and dataflows for transformation
- Jupyter notebooks for orchestration and ad-hoc data handling
- A Power Automate package for on-premise or cloud triggers
- A GitHub Actions–driven CI/CD pipeline for build, test, deployment, documentation, and releases

##### File structure
- Top-level directories:
- businessCentral: the AL extension code and tests
- synapse: dataflow definitions, datasets, pipelines, notebooks
- fabric: Jupyter notebooks for Fabric integration
- powerAutomate: a packaged flow for export orchestration
- .AL-Go: PowerShell and settings for scaffolding local/cloud dev environments
- .github/workflows: GitHub Actions YAML files implementing CI/CD
- Patterns:
- MVC-like separation inside businessCentral: src (business logic), permissions, tests
- Infrastructure as code via JSON artifacts in synapse/…
- Automated DevOps via GitHub Actions

##### README for additional insights
- Purpose and features clearly documented
- Links to setup, execution, shared metadata, Fabric configuration

a. Main components
1. Dynamics 365 Business Central
– bc2adls extension (app + tests)
2. CI/CD layer (GitHub Actions)
– Build AL package
– Run tests in a sandbox
– Create development environment
– Generate deployment packages
– Publish reference docs
– Increment version, tag releases
3. Azure Data Lake Storage Gen2 / Microsoft Fabric
4. Azure Synapse workspace
– Pipelines, dataflows, datasets
– Serverless SQL (shared metadata)
5. Fabric Jupyter notebooks (fabric/)
6. Power Automate flow (on-prem or cloud trigger)
b. Relationships & interactions
– User configures bc2adls in BC → extension writes to ADLS
– ADLS container triggers Synapse pipelines for transform/load
– Synapse writes transformed data to Serverless SQL / Fabric Lakehouse
– GitHub Actions triggers on push:
- Builds and packages bc2adls AL app
- Deploys to sandbox for integration tests
- Publishes app to AppSource (optional)
- Pushes Synapse artifacts via CI steps (if IaC approach)
– Jupyter notebooks read from ADLS / SQL and support ad-hoc analysis
– Power Automate flow can orchestrate export runs
c. Architectural patterns & design principles
– Event-driven extraction (changes in BC trigger export)
– Incremental data load pattern with watermark tables
– Separation of concerns: extraction (BC extension), storage (ADLS), transformation (Synapse), orchestration (notebooks/Power Automate), DevOps (GitHub Actions)
– Infrastructure as code for repeatable deployments
d. Key technologies/frameworks
– AL code for BC extension
– Azure Data Lake Storage Gen2
– Azure Synapse pipelines & dataflows (JSON artifacts)
– Microsoft Fabric Jupyter notebooks
– Power Automate packaged flow
– GitHub Actions (YAML workflows under .github/workflows)
– .AL-Go PowerShell scripts for dev environments

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "CI/CD (GitHub Actions)" 
        CI["GitHub Actions\n(.github/workflows/*.yaml)"]:::ci
    end

    subgraph "Business Central"
        BC["bc2adls Extension"]:::ext
        TEST["Extension Tests"]:::ext
    end

    CI --> BC
    CI --> TEST

    BC -->|"OData REST JSON"| ADLS["Azure Data Lake Storage Gen2"]:::store

    ADLS -->|"Event Grid trigger"| SYN_PIPE["Synapse Pipelines"]:::trans
    ADLS -->|"Event Grid trigger"| SYN_DF["Synapse Dataflows"]:::trans
    click SYN_DF "https://github.com/bertverbeek4ps/bc2adls/blob/main/synapse/dataflow/Consolidation_flow.json"
    click SYN_PIPE "https://github.com/bertverbeek4ps/bc2adls/tree/main/synapse/pipeline"

    SYN_PIPE --> SQL["Serverless SQL / Lakehouse"]:::store
    SYN_DF --> SQL

    subgraph "Synapse Artifacts Repo"
        DATASETS["Datasets"]:::trans
    end
    click DATASETS "https://github.com/bertverbeek4ps/bc2adls/tree/main/synapse/dataset"
    DATASETS --> SYN_PIPE
    DATASETS --> SYN_DF

    SYN_PIPE --> NB["Synapse Notebook\nCreateParquetTable"]:::trans
    click NB "https://github.com/bertverbeek4ps/bc2adls/blob/main/synapse/notebook/CreateParquetTable.ipynb"

    subgraph "Fabric Analytics"
        FNB1["CopyBusinessCentral Notebook"]:::fabric
        FNB2["CreateDateTable Notebook"]:::fabric
    end
    click FNB1 "https://github.com/bertverbeek4ps/bc2adls/blob/main/fabric/CopyBusinessCentral.ipynb"
    click FNB2 "https://github.com/bertverbeek4ps/bc2adls/blob/main/fabric/CreateDateTable.ipynb"

    SQL --> FNB1
    SQL --> FNB2

    subgraph "Power Automate"
        PA["Export Orchestration Flow"]:::auto
    end
    click PA "https://github.com/bertverbeek4ps/bc2adls/blob/main/powerAutomate/bc2adls_1_0_0_0.zip"
    PA -->|"HTTP / Scheduled"| BC

    subgraph ".AL-Go Dev Environments"
        LOCAL["Local Dev Env Script"]:::dev
        CLOUD["Cloud Dev Env Script"]:::dev
    end
    click LOCAL "https://github.com/bertverbeek4ps/bc2adls/blob/main/.AL-Go/localDevEnv.ps1"
    click CLOUD "https://github.com/bertverbeek4ps/bc2adls/blob/main/.AL-Go/cloudDevEnv.ps1"
    CI --> LOCAL
    CI --> CLOUD

    classDef ext fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef store fill:#90EE90,stroke:#333,stroke-width:1px
    classDef trans fill:#FFA500,stroke:#333,stroke-width:1px
    classDef ci fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef fabric fill:#EE82EE,stroke:#333,stroke-width:1px
    classDef auto fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef dev fill:#F0E68C,stroke:#333,stroke-width:1px
```
