StackMap ZiadElraggal
winget install --id=ZiadElraggal.StackMap -e CLI tool that automatically generates interactive architecture diagrams from infrastructure code and live AWS environments.
winget install --id=ZiadElraggal.StackMap -e CLI tool that automatically generates interactive architecture diagrams from infrastructure code and live AWS environments.
Architecture diagrams that generate themselves from your infrastructure code and live AWS accounts.
StackMap is a CLI-first infrastructure visualization and architecture inference tool. It scans real infrastructure inputs, live AWS accounts, and repository sources, then produces interactive architecture maps with inferred relationships, smart grouping, cost forecasting, drift detection, live logs, billing-aware usage imports, and editable presentation workflows.
Instead of keeping diagrams up to date by hand, you point StackMap at what actually exists, inspect the evidence behind the generated graph, refine anything inference cannot know, and share the result as JSON, HTML, or the local interactive viewer.
StackMap turns infrastructure into:
It is designed for platform engineers, DevOps teams, cloud architects, and anyone who needs fast, trustworthy architecture visibility from real infrastructure.
StackMap can work with:
The StackMap web UI supports:
StackMap is not only a viewer. It also supports correcting the generated architecture when inference is incomplete.
Current editor features include:
StackMap organizes infrastructure into architecture lanes such as:
Users can also create custom layers for diagrams that need more structure than the default model.
StackMap can scan across multiple AWS accounts and merge them into one graph. This is useful when systems are split across development, sandbox, shared services, and production accounts.
Supported multi-account patterns include:
Live AWS scans now run a post-scan inference pass after resources are collected. The goal is to turn a raw inventory into a useful architecture graph.
The inference engine can resolve relationships such as:
SourceArnEach inferred edge can include metadata such as rule name, confidence, human-readable evidence, and the AWS API calls that supplied the evidence. High confidence means direct AWS configuration points to the target, medium confidence usually means IAM policy or SourceArn evidence implies the relationship, and low confidence is reserved for heuristics or network reachability context.
StackMap intentionally does not treat shared VPCs or shared security groups as application data flow by default. Network relationships are useful topology context, but functional data-flow edges require stronger evidence.
StackMap can compare infrastructure snapshots and visualize:
The UI supports AWS-specific visual identity with official AWS icon assets where mapped, plus fallbacks for unmapped resource types.
Stable install:
brew tap ziadelraggal/homebrew-stackmap
brew install ziadelraggal/homebrew-stackmap/stackmap
Verify install:
stackmap version
stackmap --help
Update:
brew upgrade stackmap
Uninstall:
brew uninstall stackmap
If you want the latest unreleased changes:
brew tap ziadelraggal/homebrew-stackmap
brew install --HEAD ziadelraggal/homebrew-stackmap/stackmap
Requirements:
Clone and install:
git clone https://github.com/ziadelraggal/stackmap.git
cd stackmap
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e ".[dev]"
Verify:
stackmap version
stackmap --help
Install via winget:
winget install ZiadElraggal.StackMap
Verify install:
stackmap version
stackmap --help
Update:
winget upgrade ZiadElraggal.StackMap
Uninstall:
winget uninstall ZiadElraggal.StackMap
New releases are automatically submitted to the winget package repository when a GitHub Release is published, just like Homebrew.
stackmap scan --source terraform.tfstate --format json --output stackmap-output.json
Or generate an interactive HTML output:
stackmap scan --source terraform.tfstate --format html --output stackmap-output.html
stackmap serve --source terraform.tfstate
Serve with drift detection against a second source:
stackmap serve --source terraform.tfstate --drift-against aws-live.json
If stackmap-output.json already exists, you can also serve that:
stackmap serve --source stackmap-output.json
stackmap scan-repo . --output stackmap-repo-output.json
Single account / profile:
stackmap scan-aws --profile dev --output aws-output.json --serve
Enable live CloudWatch logs in the viewer for that profile:
stackmap scan-aws --profile dev --output aws-output.json --serve --live-logs
Enable AWS billing and usage metric imports in the viewer:
stackmap scan-aws --profile dev --output aws-output.json --serve --live-billing
Multi-account via named profiles:
stackmap scan-aws --account-profiles dev,sandbox --output multi.json --serve
Multi-account via explicit role assumption:
stackmap scan-aws \
--accounts 'dev:arn:aws:iam::111122223333:role/StackMapReadOnly,sandbox:arn:aws:iam::444455556666:role/StackMapReadOnly' \
--output multi.json \
--serve
stackmap diff before.json after.json --output stackmap-diff.json
stackmap scanParses a single infrastructure source and produces JSON or HTML output.
Use this for:
stackmap scan-repoDiscovers infrastructure sources across a repository, merges them, and produces a unified graph.
Use this when:
stackmap scan-awsScans live AWS infrastructure through read-only APIs.
Use this for:
stackmap serveLaunches the interactive local web UI for exploring a graph.
Use this when:
Useful options:
--drift-against compares the served graph against another snapshot and enables drift badges in the UI--auto-group/--no-auto-group controls smart grouping during serve--aws-profile --live-logs enables the CloudWatch log viewer for locally served graphs when the profile has the separate logs policy--aws-profile --live-billing enables AWS billing and CloudWatch usage metric imports when the profile has the separate billing policystackmap diffComputes a diff between two infrastructure snapshots and outputs a graph with change metadata.
stackmap org-importImports / overlays organization data for AWS organization-aware views.
stackmap aws-policyBuilds AWS IAM policy documents for StackMap.
By default it prints the base read-only scan policy:
stackmap aws-policy
Optional live features are separate add-on policies, not part of the default scan policy:
stackmap aws-policy --addon logs
stackmap aws-policy --addon billing
stackmap setup-org-roleHelps set up an AWS Organizations-compatible read-only role flow for scanning.
stackmap versionPrints the installed StackMap version.
When you open the StackMap UI, you get:
Smart grouping is currently applied automatically during stackmap serve unless you disable it with --no-auto-group.
For live AWS scans, StackMap also applies a live-account grouping pass during scan assembly. That pass uses tags and inferred service relationships before falling back to network-level context.
The grouping engine prioritizes:
aws:cloudformation:stack-nameservice, app, application, project, component, and environment labelsEarlier strategies win, so a CloudFormation/SAM or business-tagged application cluster is preferred over a lower-signal VPC bucket. This keeps the UI focused on business components first and infrastructure topology second.
Auto-generated groups can include metadata such as grouping strategy, confidence, evidence, entrypoints, account IDs, regions, and resource counts by type. The detail panel shows a smart group reason when that metadata is available.
Live AWS scans attach evidence metadata to inferred relationships whenever possible.
Example edge metadata:
{
"source": "aws_live_inference",
"inference_rule": "apigateway_lambda_integration_uri",
"confidence": "high",
"evidence": "API Gateway integration URI references arn:aws:lambda:us-east-1:123456789012:function:orders-handler",
"api_calls": ["apigateway:get_integration"]
}
The UI surfaces this in the edge detail panel so users can see why an edge exists instead of treating generated architecture as a black box.
Default architecture views prioritize functional relationships such as triggers, routes_to, reads_from, writes_to, and cross_account_reference. Lower-signal relationship types such as generic references, IAM/auth edges, and network reachability context remain available for inspection and filtering without overwhelming the main architecture view.
The cost panel in the UI is a forecast overlay by default. It becomes billing-aware only when live billing is explicitly enabled.
Current behavior:
Optional live usage import:
--live-billing, StackMap can pull AWS Cost Explorer totals and CloudWatch usage metrics for supported services, then recalculate the forecast from those usage inputs.--live-billing, the UI stays on local heuristic forecasting and never calls AWS billing or CloudWatch metrics APIs.BytesDownloaded for replacing the default 100 GB transfer assumption.Live logs are optional and only run when you explicitly enable them:
stackmap scan-aws --profile dev --serve --live-logs
This keeps the default AWS scan on the minimal read-only policy. If your AWS profile also has the separate live logs policy attached, the UI shows a Live logs toggle in the Insights panel and a View CloudWatch logs button for supported resources in the detail panel.
The log panel can fetch the last hour, 6 hours, 24 hours, or 7 days, and can aggregate logs from all currently visible resources in the graph.
The live logs policy is separate from the normal scan policy so teams can review and attach it only when they want CloudWatch log access:
stackmap aws-policy --addon logs
The packaged policy file is also available for review at stackmap/cli/aws_policy_live_logs.json.
AWS billing is also optional and separate from the default scan policy:
stackmap scan-aws --profile dev --serve --live-billing
When enabled, the Cost & Usage panel can fetch AWS usage metrics for all supported resources and recalculate the forecast. Individual resources can also fetch their own usage from the detail panel. CloudFront distributions use the CloudWatch BytesDownloaded metric to replace the default transfer estimate when available.
The billing policy is separate from the normal scan policy:
stackmap aws-policy --addon billing
Drift detection is enabled by serving one graph against another:
stackmap serve --source desired.json --drift-against live.json
Current behavior:
Unknown resource types fall back to a broader property comparison with unstable keys such as IDs, ARNs, and timestamps ignored.
Edit mode is intended as a correction layer over real infrastructure, not a fully manual diagram editor.
Current edit capabilities:
Edits are currently persisted locally in the browser and can also be exported/imported as edit overlay JSON.
stackmap scan --source terraform.tfstate --format json --output stackmap-output.json
stackmap serve --source stackmap-output.json
Then in the UI:
stackmap scan-repo . --output stackmap-repo-output.json
stackmap serve --source stackmap-repo-output.json
Then:
stackmap scan-aws --account-profiles dev,sandbox,shared --output org.json --serve
Then:
Useful for:
Useful for:
make install-dev
Build frontend static assets:
make frontend-build
Sync generated frontend assets into the packaged Python web bundle:
make sync-webapp-assets
Build the Python package:
make package-build
Run tests:
make test
Lint:
make lint
Format:
make format
On GitHub Release publish (vX.Y.Z), the Homebrew Release workflow:
stackmap.rb formula.On GitHub Release publish (vX.Y.Z), the Windows Release workflow:
windows-latest.stackmap.exe and uploads it to the GitHub Release.wingetcreate to automatically submit an updated manifest PR to microsoft/winget-pkgs.You can also run the workflow manually from Actions to generate a Windows artifact before cutting a public release.
HOMEBREW_TAP_REPO
ziadelraggal/homebrew-stackmapHOMEBREW_TAP_TOKEN
WINGET_PAT
public_repo scope, used by wingetcreate to fork microsoft/winget-pkgs and open manifest update PRsmain.vX.Y.Z format.Homebrew Release and Windows Release to complete.brew upgrade stackmap
winget upgrade ZiadElraggal.StackMap
StackMap is evolving into a hybrid of:
The product direction is intentionally:
stackmap command not found after installRun:
brew doctor
brew --prefix
stackmap version
If installed from source, make sure your virtual environment is active or the install location is on your PATH.
Recent releases now build the packaged frontend in CI before publishing the release artifact used by Homebrew. If a just-published release is not yet available, wait for the Homebrew Release workflow to finish and then try:
brew upgrade stackmap
If a live AWS scan fails due to missing permissions, use:
stackmap aws-policy
to generate a read-only policy template for scanning.
Optional live UI features use separate policies that can be reviewed and attached independently:
stackmap aws-policy --addon logs
stackmap aws-policy --addon billing
The same reviewable JSON files are included in the package:
stackmap/cli/aws_policy.jsonstackmap/cli/aws_policy_live_logs.jsonstackmap/cli/aws_policy_billing.jsonMIT