Graphfity creates a dependency nodes diagram graph about your internal modules dependencies, specially useful if you are developing a multi-module application

View Demo ยท Report Bug ยท Request Feature



Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact

About The Project

product-image

As a software engineer, you should know how difficult is to maintain a project without a previous initial good
architecture. The project scales, new libraries, new features, new dependencies between the internal modules
are added...

The purpose of this plugin is help to visualize all the project dependencies between the internal modules, as the
projects grows, having of this way a main screenshot of all the features, libraries, core modules, components, or
whatever kind of module you want to analise in your project.

Built With

  • Graphviz Graph visualization software
  • Kotlin-DSL An alternative to the traditional Groovy DSL
    using a modern language as Kotlin
  • Kotlin The natural Java evolution, a modern, concise and save programming language

Getting Started

Prerequisites

Graphviz setup full guide: https://graphviz.org/download/

Mac ๐Ÿ

Option #1
sudo port install graphviz
Option #2
brew install graphviz

Windows ๐ŸชŸ

Option #1
winget install graphviz
Option #2
choco install graphviz

Linux ๐Ÿง

Option #1
sudo apt install graphviz
Option #2
sudo yum install graphviz
Option #3
sudo apt install graphviz

Installation

Groovy DSL

root build.gradle

plugins {
    id "com.github.ivancarras.graphfity" version "1.0.0"
}

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "com.github.ivancarras:graphfity-plugin:1.0.0"
    }
}

apply plugin: com.github.ivancarras.graphfity.plugin.main.GraphfityPlugin

Kotlin DSL

root build.gradle.kts

plugins {
  id("com.github.ivancarras.graphfity") version "1.0.0"
}
buildscript {
  repositories {
      maven {
          url = uri("https://plugins.gradle.org/m2/")
      }
  }
  dependencies {
      classpath('com.github.ivancarras:graphfity-plugin:1.0.0')
  }
}

apply(plugin = "com.github.ivancarras.graphfity.plugin.main.GraphfityPlugin")

Plugin configuration

The plugin admits 3 configuration properties:

  • nodeTypesPath (mandatory): this is the path for your json node types configuration file (explanation below)
  • projectRootName (optional): start point from the task draws the dependencies, the default value is the ":app"
    module
  • graphImagePath (optional): path where your graph image will be placed

NodeTypes.json

This is the file used to establish the different nodeTypes of your project a perfect example could be a project divided
into:

  • App
  • Features
  • Components
  • Libraries
  • Core

nodeTypes.json

[
  {
    "name": "App",
    "regex": "^:app$", 
    "isEnabled": true, 
    "shape": "box3d",
    "fillColor": "#BAFFC9"
  },
  {
    "name": "Feature",
    "regex": "^.*feature.*$",
    "isEnabled": true,
    "shape": "tab",
    "fillColor": "#E6F98A"
  },
  {
    "name": "Component",
    "regex": "^.*component.*$",
    "isEnabled": true ,
    "shape": "component",
    "fillColor": "#8AD8F9"
  },
  {
    "name": "Libraries",
    "regex": "^.*libraries.*$",
    "isEnabled": true,
    "shape": "cylinder",
    "fillColor": "#FFACFA"
  },
  {
    "name": "Core",
    "regex": "^.*core.*$",
    "isEnabled": true,
    "shape": "hexagon",
    "fillColor": "#D5625A"
  }
]

Node explanation

{
"name": "App", //Node name
"regex": "^:app$", //This regex corresponds to the modules which will be draw as this node type
"isEnabled": true, //Enable o disable the visualization of this node
"shape": "box3d", // Graphviz node shape you can choose another one using: https://graphviz.org/doc/info/shapes.html
"fillColor": "#BAFFC9"//Hexadecimal color for these nodes
}

Copy this initial configuration file in an accessible path in your project. (the root path is perfect)

Now is time to configure the plugin:

Groovy DSL

graphfityExtension {
  nodeTypesPath = "<nodesTypes.json>" //(mandatory) Examples: graphfityConfig/nodesTypes.json establish the route to your nodeTypes.json
  projectRootName = "<projectNameToAnalise>" //(optional) Examples: ":app", ":feature:wishlist"... is up to you
  graphImagePath = "<graphsFolder>" //(optional)the folder where will be placed your graph.png image
}

Kotlin DSL

configure<GraphfityPluginExtension> {
  nodeTypesPath.set("<nodesTypes.json>") //(mandatory) Examples: graphfityConfig/nodesTypes.json establish the route to your nodeTypes.json
  projectRootName.set("<projectNameToAnalise>") //(optional) Examples: ":app", ":feature:wishlist"... is up to you
  graphImagePath.set("<graphsFolder>") //(optional)the folder where will be placed your graph.png image
}

Usage

When your configuration is done now you can execute:

Mac ๐Ÿ & Linux ๐Ÿง

./gradlew graphfity

Windows ๐ŸชŸ

gradle graphfity

The graph is going to be generated in the respective graphImagePath defined in the configuration

Roadmap

See the open issues for a list of proposed features (and known issues)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any
contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

GitHub

https://github.com/ivancarras/graphfity