> For the complete documentation index, see [llms.txt](https://docs.dorg.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dorg.pro/dorg-architecture/readme.md).

# Pulumi Stack

The following information are provided as a reference for Azure Administrator or Cloud Application Administrators to better understand how the installation and the update process works.

## Pulumi Stacks Organization

The Dorg application is organized as multiple Pulumi projects (stacks).\
All stacks use the same stack name (`PULUMI_STACK_UNIQUE_IDENTIFIER`) and are deployed in a controlled sequence.

### Stack Map

| Stack           | Directory             | Role                                                           | Main Dependencies                                      |
| --------------- | --------------------- | -------------------------------------------------------------- | ------------------------------------------------------ |
| `entra`         | `apps/entra`          | Entra app registrations and secrets                            | Azure subscription/tenant context                      |
| `core`          | `core`                | Shared foundation (network, front door, key vault, base infra) | none (base layer)                                      |
| `auth`          | `apps/auth`           | Keycloak + auth data/services                                  | `core`, `entra` outputs                                |
| `mcp365`        | `apps/mcp-365`        | Microsoft 365 MCP service                                      | `core`                                                 |
| `mcpdb`         | `apps/mcp-db`         | Database MCP service                                           | `core`                                                 |
| `mcpplaywright` | `apps/mcp-playwright` | Browser automation MCP service                                 | `core`                                                 |
| `orchestrator`  | `apps/orchestrator`   | Central API/orchestration service                              | `core`, `auth`, MCP stacks, `entra`, `core` AI outputs |
| `metrics`       | `apps/metrics`        | Grafana/Prometheus observability                               | `core`, `orchestrator`                                 |

### Deployment Order

`deploy.ts` orchestrates stacks in this order:

1. `entra`
2. `core`
3. `auth`
4. `mcp365`
5. `mcpdb`
6. `mcpplaywright`
7. `orchestrator`
8. `metrics`

This ordering ensures each stack can consume required outputs from previously deployed stacks.

### Cross-Stack Conventions

* **Stack references** are passed as config values (for example `coreStackName`, `authStackName`, `orchestratorStackName`).
* **Outputs** are read with `pulumi stack output --json` and reused by dependent stacks.
* **Secrets/config persistence** is centralized in Azure Key Vault (`config-<project>-<stack>`), allowing re-runs to restore prior stack config.
* **Shared stack name** keeps environment alignment across all Pulumi projects (e.g., `dev`, `stage`, `prod` equivalent via one identifier).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.dorg.pro/dorg-architecture/readme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
