# microsoftlearning/dp-420-cosmos-db-dev architecture

> Architecture diagram of the GitHub repository microsoftlearning/dp-420-cosmos-db-dev, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoftlearning/dp-420-cosmos-db-dev
- Repository: https://github.com/microsoftlearning/dp-420-cosmos-db-dev

## Overview

The project is not a production application per se but rather a curated, lab-based repository that supports a Microsoft course (DP-420) on “Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB.” Its purpose is to provide both lab instructions and code samples/demos that showcase various aspects of using Azure Cosmos DB—from connectivity and CRUD operations to performance measurement and indexing strategies. In short, the repository is divided into multiple lab modules (each in its own numbered directory) and a parallel set of instructions to guide both instructors and students through the labs.

##### Main Components
- Instruction Content: The “instructions” folder holds detailed markdown files guiding users through each lab. This should be represented as a separate component labeled “Lab Instructions” or “Teaching Guides.”
- Data and Configuration Files: The “data” folder (with its nested subdirectories) and configuration files (such as .gitignore, azuredeploy.json, deploy.bicep for container creation, etc.) suggest a shared environment for test data, deployment templates, and sample configuration. This can be shown as “Sample Data & Configuration.”

##### Relationships and Interactions
- Instructional Flow: Connect the “Lab Instructions” component to all lab modules to indicate that each lab module’s code is guided by corresponding documentation.
- External and Deployment Interactions: Illustrate how specialized labs (e.g., container deployment with ARM/bicep templates, key vault scenarios) engage with additional Azure services.

##### Architectural Patterns and Design Principles
- Separation of Concerns: The clear split between “lab instructions” and “lab code” demonstrates that business logic (or demo functionality) is decoupled from process documentation.
- Educational / Demo Focus: Emphasize that the repository’s design is tailored to hands-on learning and experimentation with Azure services, not a single production-grade system.

##### Relevant Technologies, Frameworks, or Libraries
- .NET (C#): The presence of .csproj, .cs scripts, and C# files indicates that each lab module is built using .NET.
- Azure-specific Templates: ARM and Bicep files are used in deployment scenarios.
- Azure Cosmos DB: Central to all the labs.
- MVC (in the case of the “28-key-vault” folder), and possibly Razor pages (Index.cshtml) suggest ASP.NET or related web technologies where needed.
- GitHub for collaboration, with standard templates for pull requests and issues.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Cosmos DB Feature Demos"
        connect("04-sdk-connect"):::labModule
        offline("05-sdk-offline"):::labModule
        crud("06-sdk-crud"):::labModule
        batch("07-sdk-batch"):::labModule
        bulk("08-sdk-bulk"):::labModule
        query("09-execute-query-sdk"):::labModule
        pagination("10-paginate-results-sdk"):::labModule
        customIndex("12-custom-index-policy"):::labModule
        changeFeed("13-change-feed"):::labModule
        performance("16-measure-performance"):::labModule
        denormalize("17-denormalize"):::labModule
        regions("20-sdk-regions"):::labModule
        consistency("21-sdk-consistency-model"):::labModule
        multiRegion("22-sdk-multi-region"):::labModule
        indexOpt("23-index-optimization"):::labModule
        monitor("25-monitor"):::labModule
        troubleshoot("26-sdk-troubleshoot"):::labModule
        keyVault("28-key-vault"):::labModule
        armTemplate("31-create-container-arm-template"):::labModule
        udf("33-create-use-udf-sdk"):::labModule
    end

    instructions("Lab Instructions"):::instructions
    sampleData("Sample Data & Config"):::data
    versionControl("Version Control & Collaboration"):::vc
    cosmos("Azure Cosmos DB"):::db
    azureKeyVault("Azure Key Vault"):::external

    dp_perf("azuredeploy.json (Perf Lab)"):::data
    dp_dnorm("azuredeploy.json (Denormalize Lab)"):::data
    dp_armBicep("deploy.bicep (Container Lab)"):::data
    dp_armJson("deploy.json (Container Lab)"):::data

    kvFiles("KeyVaultFiles"):::aux

    instructions -->|"guides"| connect
    instructions -->|"guides"| offline
    instructions -->|"guides"| crud
    instructions -->|"guides"| batch
    instructions -->|"guides"| bulk
    instructions -->|"guides"| query
    instructions -->|"guides"| pagination
    instructions -->|"guides"| customIndex
    instructions -->|"guides"| changeFeed
    instructions -->|"guides"| performance
    instructions -->|"guides"| denormalize
    instructions -->|"guides"| regions
    instructions -->|"guides"| consistency
    instructions -->|"guides"| multiRegion
    instructions -->|"guides"| indexOpt
    instructions -->|"guides"| monitor
    instructions -->|"guides"| troubleshoot
    instructions -->|"guides"| keyVault
    instructions -->|"guides"| armTemplate
    instructions -->|"guides"| udf

    sampleData --> dp_perf
    sampleData --> dp_dnorm
    sampleData --> dp_armBicep
    sampleData --> dp_armJson

    dp_perf -->|"template"| cosmos
    dp_dnorm -->|"template"| cosmos
    dp_armBicep -->|"template"| cosmos
    dp_armJson -->|"template"| cosmos

    versionControl -->|"supports"| instructions

    connect -->|"connectsTo"| cosmos
    offline -->|"connectsTo"| cosmos
    crud -->|"connectsTo"| cosmos
    batch -->|"connectsTo"| cosmos
    bulk -->|"connectsTo"| cosmos
    query -->|"connectsTo"| cosmos
    pagination -->|"connectsTo"| cosmos
    customIndex -->|"connectsTo"| cosmos
    changeFeed -->|"connectsTo"| cosmos
    performance -->|"connectsTo"| cosmos
    denormalize -->|"connectsTo"| cosmos
    regions -->|"connectsTo"| cosmos
    consistency -->|"connectsTo"| cosmos
    multiRegion -->|"connectsTo"| cosmos
    indexOpt -->|"connectsTo"| cosmos
    monitor -->|"monitors"| cosmos
    troubleshoot -->|"troubleshoots"| cosmos
    armTemplate -->|"deploysContainer"| cosmos
    udf -->|"usesUDF"| cosmos

    keyVault -->|"integratesWith"| azureKeyVault
    keyVault --> kvFiles

    click connect "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/04-sdk-connect/"
    click offline "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/05-sdk-offline/"
    click crud "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/06-sdk-crud/"
    click batch "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/07-sdk-batch/"
    click bulk "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/08-sdk-bulk/"
    click query "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/09-execute-query-sdk/"
    click pagination "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/10-paginate-results-sdk/"
    click customIndex "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/12-custom-index-policy/"
    click changeFeed "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/13-change-feed/"
    click performance "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/16-measure-performance/"
    click denormalize "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/17-denormalize/"
    click regions "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/20-sdk-regions/"
    click consistency "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/21-sdk-consistency-model/"
    click multiRegion "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/22-sdk-multi-region/"
    click indexOpt "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/23-index-optimization/"
    click monitor "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/25-monitor/"
    click troubleshoot "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/26-sdk-troubleshoot/"
    click keyVault "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/28-key-vault/"
    click armTemplate "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/31-create-container-arm-template/"
    click udf "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/33-create-use-udf-sdk/"

    click instructions "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/instructions/"
    click sampleData "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/data/"

    click dp_perf "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/blob/main/16-measure-performance/azuredeploy.json"
    click dp_dnorm "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/blob/main/17-denormalize/azuredeploy.json"
    click dp_armBicep "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/blob/main/31-create-container-arm-template/deploy.bicep"
    click dp_armJson "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/blob/main/31-create-container-arm-template/deploy.json"

    click versionControl "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/.github/"
    click kvFiles "https://github.com/microsoftlearning/dp-420-cosmos-db-dev/tree/main/28-key-vault/KeyVaultFiles/"

    classDef labModule fill:#f9f,stroke:#333,stroke-width:2px;
    classDef instructions fill:#bbf,stroke:#333,stroke-width:2px;
    classDef data fill:#bfb,stroke:#333,stroke-width:2px;
    classDef vc fill:#ffb,stroke:#333,stroke-width:2px;
    classDef db fill:#fbf,stroke:#333,stroke-width:2px;
    classDef external fill:#cff,stroke:#333,stroke-width:2px;
    classDef aux fill:#fc9,stroke:#333,stroke-width:2px;
```
