Blueprints using User Defined Architecture (UDA) Demonstration

Purpose of the demonstration is to use a well-defined and simple codebase to illustrate the use of UDA in building a blueprints diagram.

 Instructions

  1. Codebase - the codebase is a modular monolithic application that has well defined components for testing and learning purposes

    1. From GitHub download this code to your computer.

git clone https://github.com/kgrzybek/modular-monolith-with-ddd.git

In the Modules directory of the codebase you will find the four modules that we’ll be using to create the UDA. On my computer it looks like this directory.

Here is a snapshot of the components based on the conceptual model in the code documentation. As you can see, there are four distinct components, User Access, Administration, Payments and Meetings.

 

  1. Vault setup - Create a vault, project and a system for this demonstration.

# Create a vault, make sure to use a path on your computer cmri vault create --vault /home/scott/vaults/mono_test # change directory to the vault and use the cmri shell cd ~/vaults/mono_test/ && cmri shell project add -n mono-demo # add the system, make sure to use the path to the codebase on your computer system add -n mono-demo --origin /home/scott/tutorials/modular-monolith --version 1.0 # log into your codemri account account login
  1. UDA - system components - now that a vault, project and system are setup, let’s add the system components

    1. The command to create system components is as follows:

      system component add -n -e '/relative/path/to/component/*'
    2. Create the components for the UDA

System components use expressions to identify the components. In particular, the expression is from the origin or code base directory, in my case this in the directory modular-monolith

c. Removal of the Tests directory from the components, the Tests directory isn’t needed for this analysis so we should remove them from the components.

d. Now do the following command to view the system components.

Results should look like this:

The text is yellow is warning that the file count could not be fetched because we don’t have a database to house the component information in relation to the files in the codebase

e. Run the database command

f. Now run the system component command again and there should be a file count next to the components.

  1. UDA Component Relationships - Define what you believe the component relationships are.

    1. The command for component relationships is below:

b. For our example we are going to declare the following:

c. Check the list with this command:

  1. API Diagram Commands

a. Now run the produce reports command:

b. Now run the command to create the blueprints diagram:

 

  1. Reviewing the output of the produce_api_reports API

a. Now when you navigate to the systems system directory there will be a uda.json file.

b. There will also be a new report directory avaliable in your reports directory path that will follow a naming pattern of 'APiDiagrams-<system>-<language>

c. Now go into the APiDiagram directory and there will be a png file named Component API View.png

d. If you want to analyze the arrows and relationships of the diagram further, take a look at this link,

  1. Creating blueprints a uda.json file

    1. Once there a build json file, the file can be used to produce API diagrams without declaring components and relationships from the command line.

    2. First step, move or cut/paste the uda.json file to another directory, then navigate back to the cmri shell where you selected your project and system. Run the following command in the screenshot below. The value is the current location of the uda file being used by the system to produce the API diagram.

c. Second step, let’s change this value to wherever the uda.json file was moved with the set command, in my case i have moved the file to the Desktop.

d. Third step, now let’s re-run the commands and view the diagram again, First, we’ll have to clean the database and API diagrams out. After running these commands verify that the API directory is gone from the system reports.

e. Now run the commands to build the database and diagrams again.

f. Now, the API directory should be present again in the systems folder with the Component API view.

 

  1. Creating a subset of the api diagram.

    1. For a large and complex diagram, there might be a desire to view and analyze only a portion of the diagram at a time, this can be accomplished with the argument to the produce_api_diagrams command named subset.

b. the component file is very simple, in this example we are writing our two components of ‘Meetings’ and ‘Payments’ the file accepts one module per line.

c. The results are in the API diagrams folder and can be seen below:

 

Filter by label

There are no items with the selected labels at this time.