{"id":14991029,"url":"https://github.com/lotas/contentful-graph","last_synced_at":"2025-08-21T15:32:52.358Z","repository":{"id":21563631,"uuid":"93277280","full_name":"lotas/contentful-graph","owner":"lotas","description":"Visual representation of contentful content models in form of graphs","archived":false,"fork":false,"pushed_at":"2025-07-22T06:03:08.000Z","size":562,"stargazers_count":60,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-09T03:37:53.717Z","etag":null,"topics":["contentful","graph","graphviz","graphviz-dot","nodejs","pdf","png","svg"],"latest_commit_sha":null,"homepage":"https://www.contentful.com/blog/2017/08/08/how-to-quickly-visualize-your-content-model/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lotas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-03T22:31:33.000Z","updated_at":"2025-05-02T15:56:06.000Z","dependencies_parsed_at":"2023-01-11T21:16:08.810Z","dependency_job_id":null,"html_url":"https://github.com/lotas/contentful-graph","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/lotas/contentful-graph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotas%2Fcontentful-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotas%2Fcontentful-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotas%2Fcontentful-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotas%2Fcontentful-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lotas","download_url":"https://codeload.github.com/lotas/contentful-graph/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lotas%2Fcontentful-graph/sbom","scorecard":{"id":599513,"data":{"date":"2025-08-11","repo":{"name":"github.com/lotas/contentful-graph","commit":"c756a98ba46dcae11e86ec0e786297e772baca89"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":5,"reason":"Found 7/14 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/lotas/contentful-graph/nodejs.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/lotas/contentful-graph/nodejs.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:22","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T00:02:57.066Z","repository_id":21563631,"created_at":"2025-08-21T00:02:57.066Z","updated_at":"2025-08-21T00:02:57.066Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"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":["contentful","graph","graphviz","graphviz-dot","nodejs","pdf","png","svg"],"created_at":"2024-09-24T14:21:20.678Z","updated_at":"2025-08-21T15:32:52.343Z","avatar_url":"https://github.com/lotas.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/lotas/contentful-graph.svg?branch=master)](https://travis-ci.org/lotas/contentful-graph)\n[![npm version](https://badge.fury.io/js/contentful-graph.svg)](https://badge.fury.io/js/contentful-graph)\n\n# contentful-graph\nVisual representation of contentful content models in form of graphs\n\nCan be exported with fields:\n\n![alt](./samples/model.png)\n\nor without:\n\n![alt](./samples/model-nofields.png)\n\n# Requirements\n\n## graphviz\n\nIf you plan to render the graph as image or PDF, make sure you have `graphviz` installed on your system.\n\n## node.js\n\nThis library supports all LTS Versions of node.js. Current state: You need at least node version `20`.\n\n# Installation\n\nCan be installed globally:\n\n`npm i -g contentful-graph`\n\nOr locally\n\n`npm i --save-dev contentful-graph`\n\n# Running without installation\n\nImport script can be executed with the help of [npx](https://www.npmjs.com/package/npx)\n\n`npx contentful-graph`\n\n# Running import\n\nThere are several ways of running the import:\n\n1. running CLI `bin/contentful-graph` command\n2. import API and invoking functions programmatically\n\nFor this purpose, you'll need to know your contentful `spaceId` and `token`\n\nToken may come in two flavors: Delivery token or Management token\n\n**Management token** has an advantage of showing one-to-one relationships for models (as pointed by @jelz in #1)\n\n## Command-line version\n\nWhen running the command line version, make sure you export following variables:\n\n```sh\nCONTENTFUL_SPACE_ID= spaceId\nCONTENTFUL_TOKEN= either deliveryToken\nCONTENTFUL_MANAGEMENT_TOKEN= or management token\nCONTENTFUL_ENVIRONMENT_ID= environment id\n```\n\nor simply in command-line:\n\n`CONTENTFUL_ENVIRONMENT_ID=master CONTENTFUL_SPACE_ID=123 CONTENTFUL_MANAGEMENT_TOKEN=token ./bin/contentful-graph`\n\n### EU Hosting\n\nIf your contentful space is hosted in EU (or potential any future other region), you need to set the environment variable `CONTENTFUL_HOST`\n\nBased on your usage (Management API or Delivery API), you need to adjust the contentful host accordingly.\n\n## Command-line options\n\n`--help` (`-h`) Displays usage information\n\n`--dev` (`-d`)  Includes developer information (model Id's and field Id's)\n\n`--hide-fields` (`-n`) Do not include fields information, only entities\n\n## Reading from local file\n\nIt is possible to run import against local file with exported model defintions:\n\n```sh\n./bin/contentful-graph ./my-contentful-model.json\n```\n\n## Web version\n\nYou can run it locally or host it on any server using [contentful-graph-web](https://github.com/lotas/contentful-graph-web)\n\n```sh\ndocker run -it --rm -p 3000:3000 lotas/contentful-graph-web\n# or checkout project locally and\nmake BUILD \u0026\u0026 make RUN\n# or if you have graphviz in your system simply\nnpm run dev\n```\n\n## Api version\n\nPackage exposes the following functions:\n\n`getContentTypesFromManagementApi(spaceId: string, managementToken: string, environment: string): Promise\u003cObject\u003e`\n\nWill import content types from contentful using management api\n\n`getContentTypesFromDistributionApi(spaceId: string, apiToken: string, environment: string): Promise\u003cObject\u003e`\n\nWill import content types from contentful using distributions api\n\n`contentTypesToModelMap(contentTypes: Object): Object`\n\nWill enrich existing content types with mapping information (one-to-one, one-to-many)\n\n`modelsMapToDot(modelsMap: Object, {hideEntityFields: Boolean, dev: Boolean}): String`\n\nWill create a dot graph definition out of the model map\n\nYou can use them as follows:\n\n```javascript\nconst convertApi = require('contentful-graph');\n\n// either with managementToken\nconst contentTypes = await convertApi.getContentTypesFromManagementApi(spaceId, managementToken);\n// or with apiToken, you just need one of the calls\nconst contentTypes = await convertApi.getContentTypesFromDistributionApi(spaceId, apiToken);\n\n// enrich content types with relationship definitions\nconst modelsMap = convertApi.contentTypesToModelMap(contentTypes);\n\n// generate dot string that can be passed to graphviz\nconst dotStr = convertApi.modelsMapToDot(modelsMap, {});\n```\n\n# Generating graphs\n\nAfter you would run the import, you should have something like this:\n\n```dot\ndigraph obj {\n  node[shape=record];\n\n  Image [label=\"{Image |        | \u003ctitle\u003e Title|\u003cphoto\u003e Photo|\u003cimageCaption\u003e Image caption|\u003cimageCredits\u003e Image credits|\u003ccategoryId\u003e CategoryId}\" shape=Mrecord];\n  Asset\n  Author [label=\"{Author |        | \u003cname\u003e Name|\u003ctwitterHandle\u003e Twitter handle|\u003cprofilePhoto\u003e Profile photo|\u003cbiography\u003e Biography|\u003ccreatedEntries\u003e Created entries}\" shape=Mrecord];\n  Category [label=\"{Category |        | \u003ccategoryId\u003e Category Id|\u003ccategoryName\u003e Category name}\" shape=Mrecord];\n  PhotoGallery [label=\"{Photo Gallery |        | \u003ctitle\u003e Title|\u003cslug\u003e Slug|\u003cauthor\u003e Author|\u003ccoverImage\u003e Cover Image|\u003cdescription\u003e Description|\u003cimages\u003e Images|\u003ctags\u003e Tags|\u003cdate\u003e Date|\u003clocation\u003e Location}\" shape=Mrecord];\n\n  Image:photo -\u003e Asset [dir=forward];\n  Image:categoryId -\u003e Category [dir=forward];\n  Author:profilePhoto -\u003e Asset [dir=forward];\n  Author:createdEntries -\u003e Image [dir=forward,label=\"1..*\"];\n  PhotoGallery:author -\u003e Author [dir=forward];\n  PhotoGallery:coverImage -\u003e Asset [dir=forward];\n  PhotoGallery:images -\u003e Image [dir=forward,label=\"1..*\"];\n}\n```\n\nTo render this to image or PDF, pipe it to the `dot` command:\n\n```sh\n./import.js | dot -Tpng \u003e model.png\n./import.js | dot -Tpdf \u003e model.pdf\n```\n\nWhere `./import` is the script that produces `dot` output\n\n## Links\n\n[Contentful Management API](https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types)\n\n[Contentful Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-types)\n\n[GraphViz Fiddle](http://stamm-wilbrandt.de/GraphvizFiddle/)\n\n\n## FAQ\n\n### What is the difference between Delivery and Management API?\n\nThe RichText configuration is not available in Delivery API. If you want to display links used in a RichText field, you need to use Management API.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flotas%2Fcontentful-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flotas%2Fcontentful-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flotas%2Fcontentful-graph/lists"}