# usnistgov/policy-machine-admin architecture

> Architecture diagram of the GitHub repository usnistgov/policy-machine-admin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/usnistgov/policy-machine-admin
- Repository: https://github.com/usnistgov/policy-machine-admin

## Overview

Policy Machine Admin is a browser UI for administering NGAC policies through a gRPC-Web proxy. Users sign in, enter the protected dashboard, browse the policy-node hierarchy, and inspect or change policy data; the API layer issues query and adjudication requests to the backend. Other documented capabilities include PML editing and execution, operations, prohibitions, obligations, access-right selection, and graph/DAG views. Edges reflect sampled calls, imports listed in the SOURCE INDEX, or README statements; unsampled implementations are represented only where the tree supports the subsystem.

Main entry points: [`src/shared/api/pdp_query.api.ts`](https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_query.api.ts) (PDP queries), [`src/shared/api/pdp_adjudication.api.ts`](https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_adjudication.api.ts) (PDP adjudication), [`src/pages/dashboard/DashboardPage.tsx`](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dashboard/DashboardPage.tsx) (Dashboard), [`src/Router.tsx`](https://github.com/usnistgov/policy-machine-admin/blob/main/src/Router.tsx) (Route dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_router["Route dispatcher<br/>[Router.tsx]"]
  node_guard["Protected route<br/>[ProtectedRoute.tsx]"]
  node_login["Login<br/>[Login.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_auth["Local auth<br/>[auth.tsx]"]
end

subgraph group_policy["Policy browsing"]
  node_tree["Policy tree<br/>[PMTree.tsx]"]
  node_treeops["Tree operations"]
  node_treefetch["Tree data fetch"]
  node_treeutils["Tree model<br/>[tree-utils.tsx]"]
  node_info["Node details<br/>[InfoPanel.tsx]"]
  node_dag["Association graph<br/>[dag.tsx]"]
  node_assocmodal["Association editor"]
  node_graph["Graph rendering<br/>[GraphBuilder.tsx]"]
end

subgraph group_admin["Policy administration"]
  node_pml["PML editor<br/>[PMLEditor.tsx]"]
  node_operations["Operations<br/>[Operations.tsx]"]
  node_prohibitions["Prohibitions"]
  node_obligations["Obligations"]
  node_access["Access rights"]
  node_classes["Policy classes"]
end

subgraph group_api["Backend access"]
  node_types["Policy data types<br/>[pdp.types.ts]"]
  node_query["PDP queries<br/>[pdp_query.api.ts]"]
  node_adjudication["PDP adjudication"]
  node_transport["gRPC-Web transport<br/>[grpc-client.ts]"]
end

node_user(("Administrator"))
node_proxy["Envoy proxy"]
node_pdp[("Policy Machine backend")]

node_user -->|"opens"| node_router
node_router -->|"routes"| node_login
node_router -->|"protects"| node_guard
node_guard -->|"checks session"| node_auth
node_router -->|"routes"| node_dashboard
node_login -->|"authenticates"| node_auth
node_dashboard -->|"displays"| node_info
node_dashboard -->|"displays"| node_classes
node_dashboard -.->|"opens graph"| node_dag
node_dashboard -.->|"opens editor"| node_pml
node_tree -.->|"loads children"| node_treeops
node_treeops -->|"fetches filtered children"| node_treefetch
node_treeops -->|"updates children"| node_treeutils
node_treefetch -->|"queries nodes"| node_query
node_info -->|"renders picker"| node_tree
node_info -->|"fetches associations"| node_treefetch
node_dag -->|"opens editor"| node_assocmodal
node_assocmodal -->|"reads policy"| node_query
node_assocmodal -->|"changes associations"| node_adjudication
node_pml -->|"executes PML"| node_adjudication
node_operations -->|"reads operations"| node_query
node_operations -->|"adjudicates"| node_adjudication
node_prohibitions -.->|"reads policy"| node_query
node_prohibitions -.->|"changes policy"| node_adjudication
node_obligations -.->|"reads policy"| node_query
node_obligations -.->|"changes policy"| node_adjudication
node_classes -->|"queries policy"| node_query
node_classes -->|"changes policy"| node_adjudication
node_access -.->|"uses policy types"| node_types
node_query -->|"uses models"| node_types
node_adjudication -->|"sends RPCs"| node_transport
node_query -->|"sends RPCs"| node_transport
node_transport -->|"gRPC-Web"| node_proxy
node_proxy -->|"forwards requests"| node_pdp
node_graph -.->|"renders graph"| node_dag

click node_router "https://github.com/usnistgov/policy-machine-admin/blob/main/src/Router.tsx"
click node_guard "https://github.com/usnistgov/policy-machine-admin/blob/main/src/ProtectedRoute.tsx"
click node_login "https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/login/Login.tsx"
click node_dashboard "https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dashboard/DashboardPage.tsx"
click node_auth "https://github.com/usnistgov/policy-machine-admin/blob/main/src/lib/auth.tsx"
click node_tree "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/PMTree.tsx"
click node_treeops "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/hooks/usePMTreeOperations.ts"
click node_treefetch "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/tree-data-fetcher.ts"
click node_treeutils "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/tree-utils.tsx"
click node_info "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/info/InfoPanel.tsx"
click node_dag "https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dag/dag.tsx"
click node_assocmodal "https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dag/AssociationModal.tsx"
click node_graph "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/graph/GraphBuilder.tsx"
click node_pml "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pml/PMLEditor.tsx"
click node_operations "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/operations/Operations.tsx"
click node_prohibitions "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/prohibitions/ProhibitionsPanel.tsx"
click node_obligations "https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/obligations/ObligationsPanel.tsx"
click node_access "https://github.com/usnistgov/policy-machine-admin/blob/main/src/components/access-rights/AccessRightsSelection.tsx"
click node_classes "https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dashboard/PolicyClassesPanel.tsx"
click node_types "https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp.types.ts"
click node_query "https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_query.api.ts"
click node_adjudication "https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_adjudication.api.ts"
click node_transport "https://github.com/usnistgov/policy-machine-admin/blob/main/src/lib/grpc-client.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_router,node_guard,node_login,node_dashboard,node_auth toneBlue
class node_tree,node_treeops,node_treefetch,node_treeutils,node_info,node_dag,node_assocmodal,node_graph,node_pdp toneAmber
class node_pml,node_operations,node_prohibitions,node_obligations,node_access,node_classes toneMint
class node_types,node_query,node_adjudication,node_transport toneRose
class node_user,node_proxy toneIndigo
```

## Components

### Application shell

- [Route dispatcher](https://github.com/usnistgov/policy-machine-admin/blob/main/src/Router.tsx): `src/Router.tsx`
- [Protected route](https://github.com/usnistgov/policy-machine-admin/blob/main/src/ProtectedRoute.tsx): `src/ProtectedRoute.tsx`
- [Login](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/login/Login.tsx): `src/pages/login/Login.tsx`
- [Dashboard](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dashboard/DashboardPage.tsx): `src/pages/dashboard/DashboardPage.tsx`
- [Local auth](https://github.com/usnistgov/policy-machine-admin/blob/main/src/lib/auth.tsx): `src/lib/auth.tsx`

### Policy browsing

- [Policy tree](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/PMTree.tsx): `src/features/pmtree/PMTree.tsx`
- [Tree operations](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/hooks/usePMTreeOperations.ts): `src/features/pmtree/hooks/usePMTreeOperations.ts`
- [Tree data fetch](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/tree-data-fetcher.ts): `src/features/pmtree/tree-data-fetcher.ts`
- [Tree model](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pmtree/tree-utils.tsx): `src/features/pmtree/tree-utils.tsx`
- [Node details](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/info/InfoPanel.tsx): `src/features/info/InfoPanel.tsx`
- [Association graph](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dag/dag.tsx): `src/pages/dag/dag.tsx`
- [Association editor](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dag/AssociationModal.tsx): `src/pages/dag/AssociationModal.tsx`
- [Graph rendering](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/graph/GraphBuilder.tsx): `src/features/graph/GraphBuilder.tsx`

### Policy administration

- [PML editor](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/pml/PMLEditor.tsx): `src/features/pml/PMLEditor.tsx`
- [Operations](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/operations/Operations.tsx): `src/features/operations/Operations.tsx`
- [Prohibitions](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/prohibitions/ProhibitionsPanel.tsx): `src/features/prohibitions/ProhibitionsPanel.tsx`
- [Obligations](https://github.com/usnistgov/policy-machine-admin/blob/main/src/features/obligations/ObligationsPanel.tsx): `src/features/obligations/ObligationsPanel.tsx`
- [Access rights](https://github.com/usnistgov/policy-machine-admin/blob/main/src/components/access-rights/AccessRightsSelection.tsx): `src/components/access-rights/AccessRightsSelection.tsx`
- [Policy classes](https://github.com/usnistgov/policy-machine-admin/blob/main/src/pages/dashboard/PolicyClassesPanel.tsx): `src/pages/dashboard/PolicyClassesPanel.tsx`

### Backend access

- [Policy data types](https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp.types.ts): `src/shared/api/pdp.types.ts`
- [PDP queries](https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_query.api.ts): `src/shared/api/pdp_query.api.ts`
- [PDP adjudication](https://github.com/usnistgov/policy-machine-admin/blob/main/src/shared/api/pdp_adjudication.api.ts): `src/shared/api/pdp_adjudication.api.ts`
- [gRPC-Web transport](https://github.com/usnistgov/policy-machine-admin/blob/main/src/lib/grpc-client.ts): `src/lib/grpc-client.ts`

### Other components

- **Administrator**
- **Envoy proxy**
- **Policy Machine backend**

## Connections

- Administrator → Route dispatcher: opens (evidence: `src/Router.tsx`)
- Route dispatcher → Login: routes (evidence: `src/Router.tsx`)
- Route dispatcher → Protected route: protects (evidence: `src/Router.tsx`)
- Protected route → Local auth: checks session (evidence: `src/ProtectedRoute.tsx`)
- Route dispatcher → Dashboard: routes (evidence: `src/Router.tsx`)
- Login → Local auth: authenticates (evidence: `src/pages/login/Login.tsx`)
- Dashboard → Node details: displays (evidence: `src/pages/dashboard/DashboardPage.tsx`)
- Dashboard → Policy classes: displays (evidence: `src/pages/dashboard/DashboardPage.tsx`)
- Dashboard → Association graph: opens graph
- Dashboard → PML editor: opens editor
- Policy tree → Tree operations: loads children
- Tree operations → Tree data fetch: fetches filtered children (evidence: `src/features/pmtree/hooks/usePMTreeOperations.ts`)
- Tree operations → Tree model: updates children (evidence: `src/features/pmtree/hooks/usePMTreeOperations.ts`)
- Tree data fetch → PDP queries: queries nodes (evidence: `src/features/pmtree/tree-data-fetcher.ts`)
- Node details → Policy tree: renders picker (evidence: `src/features/info/InfoPanel.tsx`)
- Node details → Tree data fetch: fetches associations (evidence: `src/features/info/InfoPanel.tsx`)
- Association graph → Association editor: opens editor (evidence: `src/pages/dag/dag.tsx`)
- Association editor → PDP queries: reads policy (evidence: `src/pages/dag/AssociationModal.tsx`)
- Association editor → PDP adjudication: changes associations (evidence: `src/pages/dag/AssociationModal.tsx`)
- PML editor → PDP adjudication: executes PML (evidence: `src/features/pml/PMLEditor.tsx`)
- Operations → PDP queries: reads operations (evidence: `src/features/operations/Operations.tsx`)
- Operations → PDP adjudication: adjudicates (evidence: `src/features/operations/Operations.tsx`)
- Prohibitions → PDP queries: reads policy
- Prohibitions → PDP adjudication: changes policy
- Obligations → PDP queries: reads policy
- Obligations → PDP adjudication: changes policy
- Policy classes → PDP queries: queries policy (evidence: `src/pages/dashboard/PolicyClassesPanel.tsx`)
- Policy classes → PDP adjudication: changes policy (evidence: `src/pages/dashboard/PolicyClassesPanel.tsx`)
- Access rights → Policy data types: uses policy types
- PDP queries → Policy data types: uses models (evidence: `src/shared/api/pdp_query.api.ts`)
- PDP adjudication → gRPC-Web transport: sends RPCs (evidence: `src/shared/api/pdp_adjudication.api.ts`)
- PDP queries → gRPC-Web transport: sends RPCs (evidence: `src/shared/api/pdp_query.api.ts`)
- gRPC-Web transport → Envoy proxy: gRPC-Web (evidence: `README.md`)
- Envoy proxy → Policy Machine backend: forwards requests (evidence: `README.md`)
- Graph rendering → Association graph: renders graph
