# jaydhulia/iam-policy-generator architecture

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

- Interactive diagram: https://gitdiagram.com/jaydhulia/iam-policy-generator
- Repository: https://github.com/jaydhulia/iam-policy-generator

## Overview

1. **Overall shape**
   - This is a **single-page React front end** for generating AWS IAM policies.
   - There is **no backend service** in the repo; all current behavior is client-side, with static data shipped in `public/iam_definition.json`.

2. **Application entry and bootstrapping**
   - `src/index.js` is the React entry point.
   - It mounts `App` into the DOM and pulls in global CSS.
   - Standard Create React App support files exist (`reportWebVitals.js`, `setupTests.js`), but they are not central to the product architecture.

3. **Top-level composition**
   - `src/App.js` is the main composition layer.
   - It likely wires together the page layout, header, search, and policy-generation sections.
   - `App.css` and `index.css` define the app-wide presentation layer.

4. **Core feature subsystem: policy generation**
   - `src/Components/PolicyGen.js` is the main domain component.
   - It appears responsible for managing the selected AWS service, actions, and the evolving IAM policy state.
   - From the README, this is where future capabilities will expand: statements, resources, conditions, CRUD templates, and export formats.

5. **Service and action selection**
   - `src/Components/Search.js` is the discovery interface for AWS services.
   - README status says the user can currently **search and select an AWS service**, then **select actions based on that service**.
   - This suggests a data flow of: service search input → filtered service list → selected service → action list.

6. **UI framing and navigation**
   - `src/Components/PolicyGenHeader.js` is a lightweight presentational/header component.
   - It likely provides the page title or contextual controls for the policy generator.
   - Semantic UI is used for the interface styling and components, so the UI is component-driven rather than custom-built from scratch.

7. **Static AWS dataset**
   - `public/iam_definition.json` is the main data asset.
   - It contains the IAM definitions used to drive service/action lookup and suggestion logic.
   - The README credits the source dataset to `iann0036/iam-dataset`, which means the app’s behavior depends on a precomputed, local data file rather than live AWS API calls.

8. **Data flow through the app**
   - The architecture is essentially: **static IAM dataset → search/filter UI → selected AWS service/actions → policy generation state → rendered policy output**.
   - The current repo shows the left side of that flow most clearly; the output/export side is listed as future work.

9. **Current boundaries and limitations**
   - The codebase is intentionally minimal and WIP.
   - It currently stops short of handling several important IAM policy modeling concepts: removing actions, preventing duplicates, multiple statements, resources, conditions, and output formats.
   - That means the present architecture is focused on **selection and assembly**, not full policy validation or export pipelines.

10. **Deployment/runtime model**
   - As a CRA-style React app, it is meant to be built into static assets and served like a normal web app.
   - `public/index.html`, `public/manifest.json`, and `public/robots.txt` are standard web app shell assets.
   - There are no infrastructure dependencies or external runtime services visible in the repo.

11. **Useful diagram boundaries**
   - A good architecture diagram would show:
     - **Browser UI layer**: App, Header, Search, PolicyGen
     - **Local dataset layer**: `iam_definition.json`
     - **Generated policy state**: maintained in React component state
     - **Future export/output layer**: JSON / Terraform / YAML, noted in README but not yet implemented

12. **What matters most for understanding the repo**
   - The repository is a **front-end policy authoring tool** centered on AWS IAM metadata.
   - Its current differentiator is searchable AWS service/action selection from a bundled dataset.
   - Everything else in the repo supports that single workflow.

Main entry points: [`src/App.js`](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/App.js) (App), [`src/Components/PolicyGen.js`](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/PolicyGen.js) (Policy builder), [`src/index.js`](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/index.js) (Entry), [`src/Components/Search.js`](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/Search.js) (Search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React app"]
  node_index_js["Entry<br/>React bootstrap<br/>[index.js]"]
  node_app_js["App<br/>composition<br/>[App.js]"]
  node_policy_header["Header<br/>presentational<br/>[PolicyGenHeader.js]"]
  node_search["Search<br/>service finder<br/>[Search.js]"]
  node_policy_gen["Policy builder<br/>domain state<br/>[PolicyGen.js]"]
  node_app_css["App styles<br/>presentation CSS<br/>[App.css]"]
  node_index_css["Global styles<br/>presentation CSS<br/>[index.css]"]
end

subgraph group_static["Static assets"]
  node_iam_definition[("IAM dataset<br/>static AWS metadata")]
  node_index_html["HTML shell<br/>web shell<br/>[index.html]"]
  node_manifest["Web manifest<br/>PWA metadata<br/>[manifest.json]"]
  node_robots["Robots<br/>crawler policy<br/>[robots.txt]"]
end

node_index_html -->|"loads"| node_index_js
node_index_js -->|"mounts"| node_app_js
node_index_js -->|"imports"| node_index_css
node_app_js -->|"renders"| node_policy_header
node_app_js -->|"renders"| node_search
node_app_js -->|"renders"| node_policy_gen
node_app_js -->|"imports"| node_app_css
node_search -->|"reads"| node_iam_definition
node_policy_gen -->|"reads"| node_iam_definition
node_search -->|"updates"| node_policy_gen
node_policy_header -->|"frames"| node_policy_gen
node_manifest -.->|"supports"| node_index_html
node_robots -.->|"supports"| node_index_html

click node_index_js "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/index.js"
click node_app_js "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/App.js"
click node_policy_header "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/PolicyGenHeader.js"
click node_search "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/Search.js"
click node_policy_gen "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/PolicyGen.js"
click node_app_css "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/App.css"
click node_index_css "https://github.com/jaydhulia/iam-policy-generator/blob/master/src/index.css"
click node_iam_definition "https://github.com/jaydhulia/iam-policy-generator/blob/master/public/iam_definition.json"
click node_index_html "https://github.com/jaydhulia/iam-policy-generator/blob/master/public/index.html"
click node_manifest "https://github.com/jaydhulia/iam-policy-generator/blob/master/public/manifest.json"
click node_robots "https://github.com/jaydhulia/iam-policy-generator/blob/master/public/robots.txt"

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_index_js,node_app_js,node_policy_header,node_search,node_policy_gen,node_app_css,node_index_css toneBlue
class node_iam_definition,node_index_html,node_manifest,node_robots toneAmber
```

## Components

### React app

Client-side IAM policy authoring UI

- [Entry](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/index.js): React bootstrap · Mounts the app and loads global styles · `src/index.js`
- [App](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/App.js): composition · Top-level page composition and wiring · `src/App.js`
- [Header](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/PolicyGenHeader.js): presentational · Page title and contextual header area · `src/Components/PolicyGenHeader.js`
- [Search](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/Search.js): service finder · Discovers AWS services and selects actions · `src/Components/Search.js`
- [Policy builder](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/Components/PolicyGen.js): domain state · Manages selected service, actions, and policy assembly · `src/Components/PolicyGen.js`
- [App styles](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/App.css): presentation CSS · App-wide component styling · `src/App.css`
- [Global styles](https://github.com/jaydhulia/iam-policy-generator/blob/master/src/index.css): presentation CSS · Global page styles · `src/index.css`

### Static assets

Bundled data and web shell files

- [IAM dataset](https://github.com/jaydhulia/iam-policy-generator/blob/master/public/iam_definition.json): static AWS metadata · Local service and action definitions used by the UI · `public/iam_definition.json`
- [HTML shell](https://github.com/jaydhulia/iam-policy-generator/blob/master/public/index.html): web shell · Root document served to the React app · `public/index.html`
- [Web manifest](https://github.com/jaydhulia/iam-policy-generator/blob/master/public/manifest.json): PWA metadata · Browser installation metadata · `public/manifest.json`
- [Robots](https://github.com/jaydhulia/iam-policy-generator/blob/master/public/robots.txt): crawler policy · Search crawler directives · `public/robots.txt`

## Connections

- HTML shell → Entry: loads · Browser shell hosts the React bundle
- Entry → App: mounts · Bootstraps the main application component
- Entry → Global styles: imports · Applies global page styles
- App → Header: renders · Composes the page header
- App → Search: renders · Composes the service discovery UI
- App → Policy builder: renders · Composes the policy authoring workspace
- App → App styles: imports · Applies app-level styling
- Search → IAM dataset: reads · Filters services and actions from the bundled dataset
- Policy builder → IAM dataset: reads · Uses the local IAM metadata to build policy state
- Search → Policy builder: updates · Selected service and actions flow into the policy builder
- Header → Policy builder: frames · Provides contextual UI for the builder
- Web manifest → HTML shell: supports · Provides web app metadata for the shell
- Robots → HTML shell: supports · Defines crawler behavior for the public site
