{"id":13610159,"url":"https://github.com/iurysza/module-graph","last_synced_at":"2025-05-16T04:00:26.457Z","repository":{"id":143300053,"uuid":"614389109","full_name":"iurysza/module-graph","owner":"iurysza","description":"A Gradle Plugin for visualizing your project's structure, powered by mermaidjs","archived":false,"fork":false,"pushed_at":"2025-02-23T10:43:38.000Z","size":634,"stargazers_count":376,"open_issues_count":5,"forks_count":16,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-08T14:07:48.726Z","etag":null,"topics":["android","automation","gradle","gradle-kotlin-dsl","gradle-plugin","kotlin","mermaidjs"],"latest_commit_sha":null,"homepage":"https://plugins.gradle.org/plugin/dev.iurysouza.modulegraph","language":"Kotlin","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/iurysza.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T13:44:19.000Z","updated_at":"2025-03-26T07:48:11.000Z","dependencies_parsed_at":"2023-07-25T17:16:37.461Z","dependency_job_id":"534cb00b-c57e-4c5e-92c6-8ec1b2a505bd","html_url":"https://github.com/iurysza/module-graph","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":"cortinico/kotlin-gradle-plugin-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iurysza%2Fmodule-graph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iurysza%2Fmodule-graph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iurysza%2Fmodule-graph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iurysza%2Fmodule-graph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iurysza","download_url":"https://codeload.github.com/iurysza/module-graph/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464890,"owners_count":22075570,"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","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":["android","automation","gradle","gradle-kotlin-dsl","gradle-plugin","kotlin","mermaidjs"],"created_at":"2024-08-01T19:01:41.891Z","updated_at":"2025-05-16T04:00:26.434Z","avatar_url":"https://github.com/iurysza.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/iurysza"],"categories":["Kotlin"],"sub_categories":[],"readme":"[![Pre Merge Checks](https://github.com/iurysza/module-graph/workflows/Pre%20Merge%20Checks/badge.svg)](https://github.com/iurysza/module-graph/actions?query=workflow%3A%22Pre+Merge+Checks%22) [![License](https://img.shields.io/github/license/cortinico/kotlin-android-template.svg)](LICENSE) ![Language](https://img.shields.io/github/languages/top/cortinico/kotlin-android-template?color=blue\u0026logo=kotlin)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/module-graph-icon.png\" alt=\"module graph icon\" width=\"100px\"\u003e\n\u003c/p\u003e\n\n## Module Graph Plugin\n\nThis plugin generates a [Mermaid](https://github.com/mermaid-js/mermaid) graph of your project's module relationships,\nso you can see how your modules interact at a glance.\n\n\n\u003e A diagram about the current system is only useful if it's generated. If it is produced by hand it\n\u003e documents the author's belief, not the system. Still, important, but not an input for decision\n\u003e making. Development is primarily decision-making. Enable it through custom\n\u003e tools. [source](https://twitter.com/girba/status/1628326848256962561)\n\nYou can read more about the background story of this\nplugin [here](https://iurysouza.dev/automating-project-architecture-graphs/).\n\n## Main Features ⭐\n\n- Automatically append/update the generated graph to your project's README file.\n- Enables you to focus and highlight specific nodes in the graph\n- Exclude specific configurations from the graph.\n- Built in themes and customization options.\n- The raw code block automatically renders as a graph on\n  both [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/),\n  [Gitlab](https://about.gitlab.com/handbook/tools-and-tips/mermaid/#mermaid-diagrams), [Jetbrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)\n  and [VSCode ](https://marketplace.visualstudio.com/items?itemName=MermaidChart.vscode-mermaid-chart).\n\n## Getting Started\n\nYou'll just need to add it to your project's **root** `build.gradle` or `build.gradle.kts` file.\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003ebuild.gradle (Groovy DSL)\u003c/b\u003e\u003c/summary\u003e\n\n#### Using the plugins DSL\n\n```groovy\nplugins {\n    id \"dev.iurysouza.modulegraph\" version \"0.12.0\"\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eUsing Legacy Plugin application\u003c/b\u003e\u003c/summary\u003e\n\n```groovy\n    buildscript {\n    repositories {\n        maven {\n            url \"https://plugins.gradle.org/m2/\"\n        }\n    }\n    dependencies {\n        classpath \"dev.iurysouza:modulegraph:0.12.0\"\n    }\n}\n\napply plugin: \"dev.iurysouza.modulegraph\"\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eConfiguration Properties\u003c/b\u003e\u003c/summary\u003e\n\n```groovy\nimport dev.iurysouza.modulegraph.LinkText\nimport dev.iurysouza.modulegraph.ModuleType\nimport dev.iurysouza.modulegraph.Orientation\nimport dev.iurysouza.modulegraph.Theme\n\nmoduleGraphConfig {\n    // readmePath = \"./README.md\"\n    // heading = \"### Module Graph\"\n    // showFullPath = false\n    // orientation = Orientation.LEFT_TO_RIGHT\n    // linkText = LinkText.NONE\n    // excludedConfigurationsRegex = \".*test.*\"\n    // excludedModulesRegex = \".*moduleName.*\"\n    // focusedModulesRegex = \".*(projectName).*\"\n    // rootModulesRegex = \".*moduleName.*\"\n    // setStyleByModuleType = true\n    // strictMode = false\n    // nestingEnabled = true\n\n    // theme = Theme.NEUTRAL\n    // Or you can fully customize it by using the BASE theme:\n    // theme = new Theme.BASE(\n    //     [\n    //         \"primaryTextColor\": \"#F6F8FAff\", // All text colors\n    //         \"primaryColor\": \"#5a4f7c\", // Node color\n    //         \"primaryBorderColor\": \"#5a4f7c\", // Node border color\n    //         \"tertiaryColor\": \"#40375c\", // Container box background\n    //         \"lineColor\": \"#f5a623\",\n    //         \"fontSize\": \"12px\"\n    //     ],\n    //     focusColor = \"#F5A622\" // Color of the focused nodes if any\n    // )\n    // theme.set(\n    //     new Theme.BASE(\n    //         themeVariables: [\n    //             \"primaryTextColor\": \"#F6F8FAff\", // All text colors\n    //             \"primaryColor\": \"#5a4f7c\", // Node color\n    //             \"primaryBorderColor\": \"#5a4f7c\", // Node border color\n    //             \"tertiaryColor\": \"#40375c\", // Container box background\n    //             \"lineColor\": \"#f5a623\",\n    //             \"fontSize\": \"12px\"\n    //         ],\n    //         focusColor: \"#F5A622\", // Color of the focused nodes if any\n    //         moduleTypes: [\n    //             new ModuleType.AndroidLibrary(\"#2C4162\")\n    //         ]\n    //     )\n    // )\n\n    // You can add additional graphs.\n    // A separate graph will be generated for each config below.\n    // graph(\n    //     \"./README.md\",\n    //     \"# Graph with root: gama\",\n    // ) {\n    //     it.rootModulesRegex = \".*gama.*\"\n    // }\n    // graph(\n    //     \"./SomeOtherReadme.md\",\n    //     \"# Graph\",\n    // ) {\n    //     it.rootModulesRegex = \".*zeta.*\"\n    // }\n\n}\n```\n\n\u003c/details\u003e\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003ebuild.gradle.kts (Kotlin DSL)\u003c/b\u003e\u003c/summary\u003e\n\n\u003cp\u003e\u003c/p\u003e\n\n#### Using the plugins DSL\n\n```kotlin\nplugins {\n    id(\"dev.iurysouza.modulegraph\") version \"0.12.0\"\n}\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eUsing Legacy Plugin application\u003c/b\u003e\u003c/summary\u003e\n\n```kotlin\n    buildscript {\n    repositories {\n        maven {\n            url = uri(\"https://plugins.gradle.org/m2/\")\n        }\n    }\n    dependencies {\n        classpath(\"dev.iurysouza:modulegraph:0.12.0\")\n    }\n}\n\napply(plugin = \"dev.iurysouza.modulegraph\")\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eConfiguration Properties\u003c/b\u003e\u003c/summary\u003e\n\n```kotlin\nimport dev.iurysouza.modulegraph.LinkText\nimport dev.iurysouza.modulegraph.ModuleType\nimport dev.iurysouza.modulegraph.Orientation\nimport dev.iurysouza.modulegraph.Theme\n\nmoduleGraphConfig {\n    // readmePath.set(\"./README.md\")\n    // heading.set(\"### Module Graph\")\n    // showFullPath.set(false)\n    // orientation.set(Orientation.LEFT_TO_RIGHT)\n    // linkText.set(LinkText.NONE)\n    // setStyleByModuleType.set(true)\n    // excludedConfigurationsRegex.set(\".*test.*\")\n    // excludedModulesRegex.set(\".*moduleName.*\")\n    // focusedModulesRegex.set(\".*(projectName).*\")\n    // rootModulesRegex.set(\".*moduleName.*\")\n    // strictMode.set(false)\n    // nestingEnabled.set(true)\n\n    // theme.set(Theme.NEUTRAL) // optional\n    // or you can fully customize it by using the BASE theme:\n    // Theme.BASE(\n    //     themeVariables = mapOf(\n    //         \"primaryTextColor\" to \"#F6F8FAff\", // Text\n    //         \"primaryColor\" to \"#5a4f7c\", // Node\n    //         \"primaryBorderColor\" to \"#5a4f7c\", // Node border\n    //         \"tertiaryColor\" to \"#40375c\", // Container box background\n    //         \"lineColor\" to \"#f5a623\",\n    //         \"fontSize\" to \"12px\",\n    //     ),\n    //     focusColor = \"#F5A622\",\n    //     moduleTypes = listOf(\n    //         ModuleType.AndroidLibrary(\"#2C4162\"),\n    //     )\n    // ),\n    // )\n\n    // You can include additional graphs.\n    // A separate graph will be generated for each config below.\n    // graph(\n    //     readmePath = \"./README.md\",\n    //     heading = \"# Graph with root: gama\",\n    // ) {\n    //     rootModulesRegex = \".*gama.*\"\n    // }\n    // graph(\n    //     readmePath = \"./SomeOtherReadme.md\",\n    //     heading = \"# Graph\",\n    // ) {\n    //     rootModulesRegex = \".*zeta.*\"\n    // }\n}\n```\n\n\u003c/details\u003e\n\u003c/details\u003e\n\n### Running it\nYou can run the plugin's task right away without any extra configuration. The plugin tries to provide sensible defaults, so after applying it to your project you can:\n\n```sh\n./gradlew createModuleGraph\n```\n\nThis will generate a module graph in your README file. If you need further customization, keep reading for more detailed examples of how to configure it.\n\n\n## Configuration Docs\n\nEach Graph has the following configuration parameters.\n\nOptional settings:\n\n- **readmePath**: The path of the file where the dependency graph will be added. Defaults to \"README.md\" in the root directory of the project.\n- **heading**: The heading where the dependency graph will be added. Defaults to \"# Primary Graph\".\n- **setStyleByModuleType**: Whether to style the modules based on their type (KotlinMultiplatform, Android Library, etc.). Default is `false`. [Read more](#module-type-based-styling).\n- **nestingEnabled**: Whether to enable nested subgraphs in the generated graph. Groups modules into subgraphs based on their path structure. Default is `false`. [Read more](#nested-subgraphs).\n- **focusedModulesRegex**: The regex to match nodes in the graph (project names) that should be focused. By\n  default, no nodes are focused.\n  If set, the matching nodes will be highlighted and only related nodes will be shown. The color can be customized via the `focusColor` property\n  from `Theme.BASE`. [Read more](#focusing-on-specific-nodes).\n- **showFullPath**: Whether to show the full path of the modules in the graph. Default is `false`. This removes sub-graphs.\n- **theme**: The [mermaid theme](https://mermaid.js.org/config/theming.html) to be used for styling\n  the graph. Default is `NEUTRAL`.\n    - Further customization is possible by setting the `themeVariables` property on the `BASE` theme. Check the\n      [mermaid docs](https://mermaid-js.github.io/mermaid/#/theming) for more info.\n- **orientation**:\n  The [orientation](https://mermaid.js.org/syntax/flowchart.html#flowchart-orientation) that the\n  flowchart will have. Default is `LEFT_TO_RIGHT`.\n- **linkText**:\n  Whether to add information as text on links in graph. Available values:\n    - `NONE`: No text added. (Default.)\n    - `CONFIGURATION`: The name of the configuration which the dependency belongs to (e.g. \"\n      implementation\", \"compileOnly\", \"jsMain\").\n- **excludedConfigurationsRegex**:\n    - Regex matching the configurations which should be ignored. e.g. \"implementation\", \"testImplementation\".\n- **excludedModulesRegex**:\n    - Regex matching the modules which should be ignored when traversing dependencies.\n    - When a module matches this pattern, it and its dependencies will be excluded from the graph.\n    - Note: This only excludes modules when they appear as dependencies. If a module matches this pattern but is also selected as a root module (either explicitly via `rootModulesRegex` or implicitly when `rootModulesRegex` is not set), it will still appear in the graph.\n- **rootModulesRegex**:\n    - Regex matching the modules that should be used as starting points for building the graph.\n    - If set, only these modules and their dependencies (direct and transitive) will be included in the graph.\n    - If not set, all modules are considered root modules, which means the graph will include all modules and their dependencies.\n    - This is useful when you want to focus on a specific part of your project's dependency structure.\n\n### Multiple graphs\n\nYou can apply configuration options directly in the root of the `moduleGraphConfig` block like so:\n\n```kotlin\nmoduleGraphConfig {\n    readmePath.set(\"${rootDir}/README.md\")\n    heading.set(\"### Module Graph\")\n    showFullPath.set(false)\n}\n```\n\nWhen you do this, you are configuring the 'Primary Graph'.\nThis is useful if you only need one graph to be generated.\n\nBut sometimes you want multiple graphs to be generated.\nTo achieve this you can add additional graph configs using `graph`.\nEach additional graph has exactly the same configuration parameters as the primary graph:\n\n```kotlin\nmoduleGraphConfig {\n    graph(\n        readmePath = \"${rootDir}/README.md\",\n        heading = \"### Module Graph\",\n    ) {\n        showFullPath = false\n    }\n}\n```\n\nNote that `graph` requires the required parameters to be provided in the function call,\nwhile the optional parameters can be provided in the configuration block.\n\nYou can add as many `graph` calls as you like: each one will generate a separate graph:\n\n```kotlin\nmoduleGraphConfig {\n    graph(\n        readmePath = \"${rootDir}/README.md\",\n        heading = \"### Module Graph\",\n    ) {\n        showFullPath = false\n    }\n    graph(\n        readmePath = \"${rootDir}/README.md\",\n        heading = \"### Another Module Graph\",\n    ) {\n        showFullPath = true\n    }\n}\n```\n\nFor this plugin to work, you need to configure at least one graph.\nThis can be via the Primary Graph, or via a `graph` call.\n\nIf using only `graph` calls, then the Primary Graph doesn't need to be setup at all!\nYou can see this in the samples above.\n\n### Show me that graph!\n\nThis is an example of using the plugin on an Android project with a multi-module setup.\nHere, the following configuration was used:\n\n```kotlin\nmoduleGraphConfig {\n    readmePath.set(\"${rootDir}/README.md\")\n    heading.set(\"### Module Graph\")\n    theme.set(\n        Theme.BASE(\n            mapOf(\n                \"primaryTextColor\" to \"#fff\",\n                \"primaryColor\" to \"#5a4f7c\",\n                \"primaryBorderColor\" to \"#5a4f7c\",\n                \"lineColor\" to \"#f5a623\",\n                \"tertiaryColor\" to \"#40375c\",\n                \"fontSize\" to \"12px\",\n            ),\n            focusColor = \"#FA8140\"\n        ),\n    )\n}\n```\n\nAnd we got this graph:\n\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n\t'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\ngraph LR\n    subgraph app\n        main\n        playground\n    end\n    subgraph core\n        common\n        design-system\n        footballinfo\n        reddit\n        webview-to-native-player\n    end\n    subgraph features\n        match-day\n        match-thread\n    end\n    footballinfo --\u003e common\n    match-day --\u003e common\n    match-day --\u003e footballinfo\n    match-day --\u003e design-system\n    match-day --\u003e reddit\n    match-thread --\u003e webview-to-native-player\n    match-thread --\u003e common\n    match-thread --\u003e footballinfo\n    match-thread --\u003e design-system\n    match-thread --\u003e reddit\n    playground --\u003e webview-to-native-player\n    playground --\u003e match-thread\n    playground --\u003e match-day\n    playground --\u003e design-system\n    reddit --\u003e common\n    webview-to-native-player --\u003e common\n    main --\u003e match-thread\n    main --\u003e match-day\n    main --\u003e design-system\n    main --\u003e common\n```\n\nToo much information? We can fix that.\n\n## Focusing on specific nodes\n\nIf you want to focus on specific nodes in the graph, you can use the `focusedModulesRegex` property in the\nconfiguration.\n\n```kotlin\nmoduleGraphConfig {\n    //... keep previous configs\n    focusedModulesRegex.set(\".*(reddit).*\")\n}\n```\n\nBy doing this, the plugin will highlight the nodes that match the pattern, and will only show the other nodes that are\nconnected to them.\nIt will generate the following graph:\n\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n\t'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\ngraph LR\n    subgraph core\n        common\n        reddit\n    end\n    subgraph features\n        match-day\n        match-thread\n    end\n    match-day --\u003e reddit\n    match-thread --\u003e reddit\n    reddit --\u003e common\n    classDef focus fill:#E04380,stroke:#fff,stroke-width:2px,color:#fff;\n    class reddit focus\n```\n\nSince it's just a regex pattern, you can, for example, match multiple nodes by using the `|` operator,\nor you can come up with whatever cryptic regex patterns you want if you're into that kind of thing.\n\nWhen was the last time Regex made you happy? =)\n\n```kotlin\n// This matches module names that contain \"reddit\" or \"match-day\"\nfocusedModulesRegex.set(\".*(reddit|match-day).*\")\n```\n\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n\t'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\ngraph LR\n    subgraph app\n        main\n        playground\n    end\n    subgraph core\n        common\n        design-system\n        footballinfo\n        reddit\n    end\n    subgraph features\n        match-day\n        match-thread\n    end\n    match-day --\u003e common\n    match-day --\u003e footballinfo\n    match-day --\u003e design-system\n    match-day --\u003e reddit\n    match-thread --\u003e reddit\n    playground --\u003e match-day\n    reddit --\u003e common\n    main --\u003e match-day\n    classDef focus fill:#E04380,stroke:#fff,stroke-width:2px,color:#fff;\n    class match-day focus\n    class reddit focus\n```\n\n## Module type based styling\n\nThis feature enables detecting and rendering modules based on their type, eg.: kotlin, java, android-library,\nkotlin-multiplatform, etc\n\n### Getting Started\n\nJust toggle this option on:\n\n```kotlin\nmoduleGraphConfig {\n    //..\n    setStyleByModuleType.set(true)\n}\n```\n\nThat's it. Just run the task and you'll get a graph identifying modules by their type.\n\n### Batteries included\n\nWe have default styling for these module types:\n\n- Android Application\n- React Native\n- Kotlin Multiplatform\n- Android Library\n- Kotlin\n- Java Library\n- Java\n\nThese supported plugins are pre-configured with a default color pattern, but can be customized further if needed. **You\ncan also add you own module type.**\n\n### Customization\n\nThe **supported plugins already have a default color pattern** , but you can also customize them via the `Theme.BASE`\nobject.\n\nAdditionally, you can detect and customize styling for **other plugins** by providing a `CustomPlugin` with an `id` and\nits color. The `ID` will be used to match a Gradle plugin applied to that module and will have higher precedence than\nall the others. For example, if you have a plugin defined with the `app.compose` id, you can pass it\nas `Custom(\"app.compose\", \"#0E0E0E\")` and the graph will be generated accordingly.\neg.:\n\n```kotlin\nimport dev.iurysouza.modulegraph.ModuleType.*\nimport dev.iurysouza.modulegraph.Theme\n\nmoduleGraphConfig {\n    theme.set(\n        Theme.BASE(\n            moduleTypes = listOf(\n                Custom(id = \"app.compose\", color = \"#0E0E0E\"),\n                AndroidApp(\"#3CD483\"),\n                AndroidLibrary(\"#292B2B\"),\n            ),\n        ),\n    )\n}\n```\n\nBelow is an example of how the module graph would show up:\n\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n    'themeVariables': {\"lineColor\":\"#676767\"},\n  }\n}%%\ngraph LR\n    subgraph app\n        playground\n        main\n    end\n    subgraph core\n        webview-to-native-player\n        common\n        footballinfo\n        design-system\n        reddit\n    end\n    subgraph features\n        match-thread\n        match-day\n    end\n    match-thread --\u003e webview-to-native-player\n    match-thread --\u003e common\n    match-thread --\u003e footballinfo\n    match-thread --\u003e design-system\n    match-thread --\u003e reddit\n    match-day --\u003e common\n    match-day --\u003e footballinfo\n    match-day --\u003e design-system\n    match-day --\u003e reddit\n    playground --\u003e webview-to-native-player\n    playground --\u003e match-thread\n    playground --\u003e design-system\n    playground --\u003e match-day\n    main --\u003e match-thread\n    main --\u003e match-day\n    main --\u003e design-system\n    main --\u003e common\n    reddit --\u003e common\n    webview-to-native-player --\u003e common\n    footballinfo --\u003e common\n    classDef android_library fill:#292B2B,stroke:#fff,stroke-width:2px,color:#fff;\n    classDef app_compose fill:#82AAFF,stroke:#fff,stroke-width:2px,color:#fff;\n    classDef android_application fill:#3CD483,stroke:#fff,stroke-width: 2px,color:#fff;\n    class match-thread app_compose\n    class webview-to-native-player android_library\n    class common android_library\n    class footballinfo android_library\n    class design-system app_compose\n    class reddit android_library\n    class match-day app_compose\n    class playground android_application\n    class main android_application\n\n```\n\n\u003e [!NOTE]\n\u003e Modules can only have one type. So we're using a hardcoded precedence order for identifying them.\n\n### Precedence\n\nThe system determines the module type based on the hierarchy of applied plugins. For instance:\n\n- A module with both `React Native` and `Android Library` will be identified as `React Native`.\n- A module with both `Android Library` and `Kotlin` will be identified as `Android Library`.\n\n## Nested Subgraphs\n\nThe plugin supports two ways of organizing modules in the graph: flat subgraphs (default) and nested subgraphs. You can enable nested subgraphs using the `nestingEnabled` property:\n\n```kotlin\nmoduleGraphConfig {\n    //... keep previous configs\n    nestingEnabled.set(true)\n}\n```\n\n### Flat vs Nested Example\n\nGiven these modules:\n- :App\n- :libs:crash-reporting:api\n- :libs:crash-reporting:firebase\n- :libs:app-common\n\n**Flat subgraphs** (default):\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n    'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\n\ngraph LR\n  subgraph :libs\n    :libs:app-common[\"app-common\"]\n  end\n  subgraph :libs:crash-reporting\n    :libs:crash-reporting:api[\"api\"]\n    :libs:crash-reporting:firebase[\"firebase\"]\n  end\n  :App --\u003e :libs:app-common\n  :App --\u003e :libs:crash-reporting:api\n  :App --\u003e :libs:crash-reporting:firebase\n  classDef focus fill:#E04380,stroke:#fff,stroke-width:2px,color:#fff;\n  class :App focus\n```\n\n**Nested subgraphs** (with `nestingEnabled = true`):\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n    'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\n\ngraph LR\n  subgraph :libs\n    :libs:app-common[\"app-common\"]\n    subgraph :crash-reporting\n      :libs:crash-reporting:api[\"api\"]\n      :libs:crash-reporting:firebase[\"firebase\"]\n    end\n  end\n  :App --\u003e :libs:app-common\n  :App --\u003e :libs:crash-reporting:api\n  :App --\u003e :libs:crash-reporting:firebase\n  classDef focus fill:#E04380,stroke:#fff,stroke-width:2px,color:#fff;\n  class :App focus\n```\n\nNested subgraphs can help better visualize your project's module hierarchy, especially in larger projects with many nested modules. Note that this feature is automatically disabled if `showFullPath` is true.\n\n### Full Path View\n\nYou can also choose to show the full path of each module using the `showFullPath` property:\n\n```kotlin\nmoduleGraphConfig {\n    //... keep previous configs\n    showFullPath.set(true)\n}\n```\n\nThis will display the complete path for each module without any subgraph grouping:\n\n```mermaid\n%%{\n  init: {\n    'theme': 'base',\n    'themeVariables': {\"primaryTextColor\":\"#fff\",\"primaryColor\":\"#5a4f7c\",\"primaryBorderColor\":\"#5a4f7c\",\"lineColor\":\"#f5a623\",\"tertiaryColor\":\"#40375c\",\"fontSize\":\"12px\"}\n  }\n}%%\n\ngraph LR\n  :App\n  :libs:app-common\n  :libs:crash-reporting:api\n  :libs:crash-reporting:firebase\n  :App --\u003e :libs:app-common\n  :App --\u003e :libs:crash-reporting:api\n  :App --\u003e :libs:crash-reporting:firebase\n  classDef focus fill:#E04380,stroke:#fff,stroke-width:2px,color:#fff;\n  class :App focus\n```\n\nThis view can be useful when you want to see the full module paths at a glance without any grouping structure.\n\n\n```kotlin\nmoduleGraphConfig {\n    // ... other config ...\n\n    // Example: Include only modules under the 'features' directory as roots,\n    // and exclude any test modules\n    rootModulesRegex.set(\".*:features:.*\")\n    excludedModulesRegex.set(\".*test.*\")\n}\n```\n\n### Common Module Filtering Scenarios\n\n```kotlin\n// Scenario 1: Show everything ✅\nmoduleGraphConfig {\n    // No filters - shows all modules and all dependencies\n}\n\n// Scenario 2: Show only feature modules and what they depend on ✅\nmoduleGraphConfig {\n    rootModulesRegex.set(\":features:.*\")\n    // Result:\n    // - Shows all :features:* modules\n    // - Shows only dependencies of feature modules\n}\n```\n\n\n#### Excluding Modules\n\nTo effectively exclude certain modules from your graph, you need to:\n\n1. Set `rootModulesRegex` to match your desired root modules\n2. Set `excludedModulesRegex` to match the modules you want to ignore\n\n```kotlin\n// Scenario 3: Try to exclude feature modules ❌\nmoduleGraphConfig {\n    // Don't set rootModulesRegex (all modules are roots)\n    excludedModulesRegex.set(\":features:.*\")\n    // Result:\n    // - Shows ALL modules (because they're all roots)\n    // - The exclusion pattern has no effect since all modules are roots\n}\n\n// Scenario 3 (CORRECT WAY): Focus on app module, ignore feature modules ✅\nmoduleGraphConfig {\n    rootModulesRegex.set(\":app\")\n    excludedModulesRegex.set(\":features:.*\")\n    // Result:\n    // - Shows :app module\n    // - Shows its dependencies (except feature modules)\n    // - Shows dependencies of dependencies (except feature modules)\n}\n```\n\nIf you don't set `rootModulesRegex`, all modules will be considered root modules and cannot be excluded, even if they match `excludedModulesRegex`.\n\n## Contributing 🤝\n\nFeel free to open an issue or submit a pull request for any bugs/improvements.\n\n## License 📄\n\nThis project is licensed under the MIT License - see the [License](./LICENSE) file for details.\n\n## Buy Me a Coffee\n\nIf you found this project useful or want to support the development, consider buying me a coffee! Any donations are\ngreatly appreciated and help to support the development. [Relevant xkcd](https://xkcd.com/2347/).\n\n\u003ca href=\"https://www.buymeacoffee.com/iurysza\" target=\"_blank\"\u003e\n\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Pingado\" style=\"height: 51px !important;width: 217px !important;\" \u003e\n\u003c/a\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiurysza%2Fmodule-graph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiurysza%2Fmodule-graph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiurysza%2Fmodule-graph/lists"}