{"id":13576271,"url":"https://github.com/ljacobsson/cfn-diagram","last_synced_at":"2026-01-18T04:40:12.435Z","repository":{"id":37970945,"uuid":"263753576","full_name":"ljacobsson/cfn-diagram","owner":"ljacobsson","description":"CLI tool to visualise CloudFormation/SAM/CDK stacks as visjs networks, draw.io or ascii-art diagrams. ","archived":false,"fork":false,"pushed_at":"2024-04-19T10:32:58.000Z","size":8253,"stargazers_count":1003,"open_issues_count":38,"forks_count":88,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-10-14T05:07:36.149Z","etag":null,"topics":["aws-tools","cloudformation","sam","visualisation"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ljacobsson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-13T22:06:49.000Z","updated_at":"2025-10-01T04:49:29.000Z","dependencies_parsed_at":"2024-06-18T19:46:51.210Z","dependency_job_id":"ca315963-7cfc-4e57-8349-d7dbd8bab909","html_url":"https://github.com/ljacobsson/cfn-diagram","commit_stats":null,"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/ljacobsson/cfn-diagram","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljacobsson%2Fcfn-diagram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljacobsson%2Fcfn-diagram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljacobsson%2Fcfn-diagram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljacobsson%2Fcfn-diagram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljacobsson","download_url":"https://codeload.github.com/ljacobsson/cfn-diagram/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljacobsson%2Fcfn-diagram/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28529925,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-tools","cloudformation","sam","visualisation"],"created_at":"2024-08-01T15:01:08.713Z","updated_at":"2026-01-18T04:40:12.418Z","avatar_url":"https://github.com/ljacobsson.png","language":"JavaScript","funding_links":[],"categories":["others","Authoring and Testing Tools","JavaScript","Tools"],"sub_categories":["Hooks"],"readme":"# cfn-diagram\n![Node.js CI](https://github.com/mhlabs/cfn-diagram/workflows/Node.js%20CI/badge.svg)\n\nCLI tool to visualise CloudFormation/SAM/CDK templates as diagrams. \n\n## Installation\n`npm i -g @mhlabs/cfn-diagram`\n\n## Usage\n```\nUsage: cfn-dia [options] [command]\n\nOptions:\n  -v, --vers                          Output the current version\n  -h, --help                          Display help for command\n\nCommands:\n  draw.io|d [options]                 Generates a draw.io diagram from a CloudFormation template\n  html|h [options]                    Generates a vis.js diagram from a CloudFormation template\n  browse|b [options]                  Browses and generates diagrams from your deployed templates\n  help [command]                      Display help for command\n\nDraw.io Options:\n  -t, --template-file [templateFile]  Path to template or cdk.json file\n  -c, --ci-mode                       Disable terminal/console interactivity\n  -o, --output-file [outputFile]      Name of output file\n  -co, --cdk-output [outputPath]      CDK synth output path\n  -s, --skip-synth                    Skips CDK synth\n  -e, --exclude-types [excludeTypes]  List of resource types to exclude when using CI mode\n\nHtml Options:\n  -t, --template-file [templateFile]  Path to template or cdk.json file\n  -c, --ci-mode                       Disable terminal/console interactivity\n  -o, --output-path [outputPath]      Name of output file\n  -co, --cdk-output [outputPath]      CDK synth output path\n  -s, --skip-synth                    Skips CDK synth\n```\n\n## Output formats\n\n### Draw.io\n```\nUsage: cfn-dia draw.io|d [options]\n\nGenerates a draw.io diagram from a CloudFormation template\n\nOptions:\n  -t, --template-file [templateFile]     Path to template or cdk.json file (default: \"template.yaml or\n                                         cdk.json\")\n  -c, --ci-mode                          Disable terminal/console interactivity (default: false)\n  --stacks [stacks]                      Comma separated list of stack name(s) to include. Defaults to\n                                         all.\n  -o, --output-file [outputFile]         Name of output file (default: \"template.drawio\")\n  -co, --cdk-output [outputPath]         CDK synth output path (default: \"cdk.out\")\n  -s, --skip-synth                       Skips CDK synth (default: false)\n  -e, --exclude-types [excludeTypes...]  List of resource types to exclude when using CI mode\n  -h, --help                             display help for command\n```\n\nUse it in combination with the [Draw.io Integration](https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio) for VS Code to instantly visualise your stacks.\n\n![Demo](https://raw.githubusercontent.com/mhlabs/cfn-diagram/master/images/demo.gif)\n\n#### Example \n```\ncfn-dia draw.io -t template.yaml\n```\n\n#### Features \n* Select only the resource types you want to see. This lets you skip granlar things like roles and policies that might not add to the overview you want to see\n* Navigate through a new differnet layouts\n* Works for both JSON and YAML templates\n* Filter on resource type and/or resource names\n* Works with CloudFormation, SAM and CDK\n\n### HTML\n```\nUsage: cfn-dia html|h [options]\n\nGenerates a vis.js diagram from a CloudFormation template\n\nOptions:\n  -t, --template-file [templateFile]  Path to template or cdk.json file (default: \"template.yaml or\n                                      cdk.json\")\n  --stacks [stacks]                   Comma separated list of stack name(s) to include. Defaults to all.\n  -all --render-all                   If set, all nested stacks will be rendered. By default only root\n                                      template is rendered (default: false)\n  -c, --ci-mode                       Disable terminal/console interactivity (default: false)\n  -o, --output-path [outputPath]      Name of output file (default: \"/tmp/cfn-diagram\")\n  -co, --cdk-output [outputPath]      CDK synth output path (default: \"cdk.out\")\n  -s, --skip-synth                    Skips CDK synth (default: false)\n  -h, --help                          display help for command\n```\n\nThe HTML output uses [vis.js](https://github.com/visjs/vis-network) to generate an interactive diagram from your template.\n\n![Demo](https://raw.githubusercontent.com/mhlabs/cfn-diagram/master/images/demo-html.gif)\n\n#### Example \n```\ncfn-dia html -t template.yaml\n```\nor, for CDK stacks, go to project directory (where cdk.json is located) and enter\n```\ncfn-dia html \n```\n\nLarge stacks, in particular multi-stack CDK projects, tend to generate huge diagrams. You can pass the stack names you want to render using the `--stacks` argument followed by a comma separated list of stack names.\n\n### Ascii-art\n```\nUsage: cfn-dia ascii-art|a [options]\n\nGenerates an ascii-art diagram from a CloudFormation template\n\nOptions:\n  -t, --template-file [templateFile]     Path to template or cdk.json file (default: \"template.yaml or cdk.json\")\n  --stacks [stacks]                      Comma separated list of stack name(s) to include. Defaults to all.\n  -co, --cdk-output [outputPath]         CDK synth output path (default: \"cdk.out\")\n  -s, --skip-synth                       Skips CDK synth (default: false)\n  -w, --watch                            Watch for changes in template and rerender diagram on change (default: false)\n  -e, --exclude-types [excludeTypes...]  List of resource types to exclude when using CI mode\n  -h, --help                             display help for command                           display help for command\n```\n\nRenders a simple Ascii-art diagram of your template directly in the console. Useful to gain a quick overview of smaller stacks.\n\n![Demo](https://raw.githubusercontent.com/mhlabs/cfn-diagram/master/images/demo-ascii.gif)\n\nVideo demo of using the `--watch` option:\n[![Demo of watch command](https://img.youtube.com/vi/2V3zimGWTcU/0.jpg)](https://www.youtube.com/watch?v=2V3zimGWTcU)\n\n### Mermaid\n```\nUsage: cfn-dia mermaid|m [options]\n\nGenerates a mermaid graph from a template\n\nOptions:\n  -t, --template-file [templateFile]  Path to template or cdk.json file (default: \"template.yaml or cdk.json\")\n  -all --render-all                   If set, all nested stacks will be rendered. By default only root template is rendered (default: false)\n  -o, --output-path [outputPath]      Name of output file\n  -co, --cdk-output [cdkOutputPath]   CDK synth output path (default: \"cdk.out\")\n  -s, --skip-synth                    Skips CDK synth (default: false)\n  -h, --help                          display help for command\n```\n\nRenders a [mermaid](https://mermaid-js.github.io/mermaid/#/) diagram of your template directly in the console or to a file. Useful to gain a quick overview of smaller stacks and to generate as part of your CI/CD flow for up-to-date documentation.\n\n![Demo](https://raw.githubusercontent.com/mhlabs/cfn-diagram/master/images/demo-mermaid.gif)\n\n\n### CI-mode\nThis functionality lives in its own CLI, [cfn-diagram-ci](https://github.com/mhlabs/cfn-diagram-ci). This is beacuse it requires headless Chromium to be installed which makes the package size very large\n\nIt uses [pageres](https://github.com/sindresorhus/pageres) to generate a screenshot of a HTML diagram. This can be used in a CI/CD pipeline to keep an always up-to-date diagram in your readme-file.\n\n#### Installation\n```\nnpm install -g @mhlabs/cfn-diagram-ci\n```\n\n#### Example \n```\ncfn-dia-ci html -t template.yaml\n```\n\n\n## Known issues\n* Some icons are missing. Working on completing the coverage.\n* When using WSL you might experience `Error: spawn wslvar ENOENT` when trying to use HTML output. To resolve, install [wslu](https://github.com/wslutilities/wslu). See issue #9.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljacobsson%2Fcfn-diagram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljacobsson%2Fcfn-diagram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljacobsson%2Fcfn-diagram/lists"}