├── .gitignore ├── CHANGES.md ├── LICENSE ├── README.md ├── customized-system.png ├── horizontal-system.png ├── project.clj ├── sample-system-bad.png ├── sample-system.png ├── src └── com │ └── walmartlabs │ └── system_viz.clj └── test └── com └── walmartlabs └── system_viz_test.clj /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /classes 3 | /checkouts 4 | pom.xml 5 | pom.xml.asc 6 | *.jar 7 | *.class 8 | /.lein-* 9 | /.nrepl-port 10 | .hgignore 11 | .hg/ 12 | .idea 13 | *.iml -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | ## 0.4.0 -- 9 Feb 2018 2 | 3 | Internally, now uses [dorothy](https://github.com/daveray/dorothy) to generate 4 | the GraphViz DOT source. 5 | 6 | A decorator option makes it possible to customize individual component 7 | node attributes in an open-ended way. 8 | 9 | ## 0.3.0 -- 2 Feb 2018 10 | 11 | New options allow node attributes in the graph to be controlled 12 | for specific components. 13 | 14 | ## 0.2.0 -- 19 Jan 2018 15 | 16 | Update dependencies, add new options: 17 | 18 | :horizontal -- to layout the diagram left-to-right instead of top-to-bottom. 19 | 20 | :save-as -- to specify path to the GraphViz file that is generated. 21 | 22 | ## 0.1.1 -- 11 Mar 2016 23 | 24 | You may now control the output format (for example, to output as SVG or PNG, rather than PDF). 25 | 26 | The enabled flag has been removed; `visualize-system` will now always visualize the system. 27 | 28 | Invalid dependencies are now highlighted in red. 29 | 30 | [Closed Issues](https://github.com/walmartlabs/system-viz/issues?q=milestone%3A0.1.1+is%3Aclosed) 31 | 32 | ## 0.1.0 -- 10 Dec 2015 33 | 34 | Initial release. 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | 167 | END OF TERMS AND CONDITIONS 168 | 169 | APPENDIX: How to apply the Apache License to your work 170 | 171 | To apply the Apache License to your work, attach the following boilerplate 172 | notice, with the fields enclosed by brackets "[]" replaced with your own 173 | identifying information. (Don't include the brackets!) The text should be 174 | enclosed in the appropriate comment syntax for the file format. We also 175 | recommend that a file or class name and description of purpose be included on 176 | the same "printed page" as the copyright notice for easier identification within 177 | third-party archives. 178 | 179 | Copyright [yyyy] [name of copyright owner] 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # system-viz 2 | 3 | [![Clojars Project](https://img.shields.io/clojars/v/walmartlabs/system-viz.svg)](https://clojars.org/walmartlabs/system-viz) 4 | 5 | system-viz is a tiny, simple library to visualize 6 | a system, constructed using Stuart Sierra's 7 | [component](https://github.com/stuartsierra/component) 8 | library. 9 | 10 | 11 | Use of this project requires that [Graphviz](http://www.graphviz.org) is installed, which can be checked by running `dot -V` at the command line. If it's not installed, you can do the following: 12 | 13 | | platform | directions | 14 | |----------|------------| 15 | | Linux | install `graphviz` using your package manager | 16 | | OS X | [download the installer](http://www.graphviz.org/Download_macos.php) | 17 | | Windows | [download the installer](http://www.graphviz.org/Download_windows.php) | 18 | 19 | 20 | [API documentation](http://walmartlabs.github.io/apidocs/system-viz/) 21 | 22 | ## Usage 23 | 24 | Here, we are creating a very hypothetical stand-in for some kind of system: 25 | 26 | ```clj 27 | (require '[com.walmartlabs.system-viz :refer [visualize-system]] 28 | '[com.stuartsierra.component :as component]) 29 | 30 | (def sys 31 | (component/system-map 32 | :auth (component/using {} {:delegate :local/auth}) 33 | :local/auth (component/using {} [:database]) 34 | :database (component/using {} []) 35 | :handler (component/using {} [:database :message-queue]) 36 | :message-queue {} 37 | :router (component/using {} {:queue :message-queue}) 38 | :web-server (component/using {} [:auth :router :handler]))) 39 | 40 | (visualize-system sys) 41 | ``` 42 | 43 | This will open a window displaying an image somewhat like: 44 | 45 | ![System](sample-system.png) 46 | 47 | Dependencies between components are shown as arrows; the arrows are only labeled 48 | when the component's local key for the dependency is different from the target component's system key. 49 | 50 | visualize-system returns the system it is passed; it is intended as a filter used for 51 | side effects (creating and opening the graph image). 52 | 53 | ## Horizontal Output 54 | 55 | Some systems will render more readibly with a horizontal layout. 56 | 57 | ```clj 58 | (visualize-system sys {:horizontal true}) 59 | ``` 60 | 61 | will render as: 62 | 63 | ![Horizontal System](horizontal-system.png) 64 | 65 | ## Broken Systems 66 | 67 | Sometimes, in larger and more complex projects, you may have errors in your inter-component 68 | dependencies. 69 | The component library detects this, but the exception can be extremely difficult to parse. 70 | 71 | system-viz can help here: it will identify dependencies that link to non-existent components, 72 | highlighting the missing components in red: 73 | 74 | ![Bad System](sample-system-bad.png) 75 | 76 | ## Customizing 77 | 78 | The visual representation of the components in the graph can be adjusted for 79 | specific nodes, using particular component keys in the `:systemviz` namespace. 80 | 81 | Example: 82 | 83 | ```c;j 84 | 85 | (require '[com.walmartlabs.system-viz :refer [visualize-system]] 86 | '[com.stuartsierra.component :as component]) 87 | 88 | (def sys 89 | (component/system-map 90 | :auth (component/using {} {:delegate :local/auth}) 91 | :local/auth (component/using {:systemviz/color :magenta} [:database]) 92 | :database (component/using {:systemviz/highlight true} []) 93 | :handler (component/using {} [:database :message-queue]) 94 | :message-queue {:systemviz/attrs {:shape :box3d}} 95 | :router (component/using {} {:queue :message-queue}) 96 | :web-server (component/using {} [:auth :router :handler]))) 97 | ``` 98 | 99 | ![Customized System](customized-system.png) 100 | 101 | ## Customization Component Attributes 102 | 103 | `:systemviz/color` 104 | 105 | Sets the color of the node to the provided value, and sets the style of the node 106 | to filled. 107 | 108 | `:systemviz/highlight` 109 | 110 | Sets the color of the node to a light blue, and increases the font size from 111 | the default 14 point to 24 point. 112 | 113 | `:systemviz/attrs` 114 | 115 | Allows the specification of arbitrary [Graphviz node attributes](https://graphviz.gitlab.io/_pages/doc/info/attrs.html) 116 | as a nested map of keys and values. 117 | Values should be strings, numbers, or keywords and will be quoted as 118 | necessary. 119 | 120 | ## Customization Options 121 | 122 | Two options to `visualize-system` support customization: 123 | 124 | `:highlight` 125 | 126 | Defines the set of GraphViz node attributes used when a component 127 | has the `:systemviz/highlight` attribute. 128 | 129 | `:decorator` 130 | 131 | A function that is passed each component's key and component map 132 | and return nil, or a map of GraphViz node attributes. 133 | 134 | For example, this could allow easy customization of components 135 | based on the namespace of thier component keys, or other 136 | factors. 137 | 138 | ## License 139 | 140 | Copyright © 2015-2018 Walmart Labs 141 | 142 | Distributed under the Apache Software License 2.0. 143 | -------------------------------------------------------------------------------- /customized-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/system-viz/d0011babd92fef343895984eecae081f592bba58/customized-system.png -------------------------------------------------------------------------------- /horizontal-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/system-viz/d0011babd92fef343895984eecae081f592bba58/horizontal-system.png -------------------------------------------------------------------------------- /project.clj: -------------------------------------------------------------------------------- 1 | (defproject walmartlabs/system-viz "0.4.0" 2 | :description "Graphviz visualization of a component system" 3 | :url "https://github.com/walmartlabs/system-viz" 4 | :license {:name "Apache Sofware License 2.0" 5 | :url "http://www.apache.org/licenses/LICENSE-2.0.html"} 6 | :plugins [[lein-codox "0.10.3"]] 7 | :dependencies [[org.clojure/clojure "1.8.0"] 8 | [dorothy "0.0.6"] 9 | [com.stuartsierra/component "0.3.2"]] 10 | :aliases {"release" ["do" 11 | "clean," 12 | "deploy" "clojars"]} 13 | :codox {:source-uri "https://github.com/walmartlabs/system-viz/blob/master/{filepath}#L{line}" 14 | :metadata {:doc/format :markdown}}) 15 | -------------------------------------------------------------------------------- /sample-system-bad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/system-viz/d0011babd92fef343895984eecae081f592bba58/sample-system-bad.png -------------------------------------------------------------------------------- /sample-system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/walmartlabs/system-viz/d0011babd92fef343895984eecae081f592bba58/sample-system.png -------------------------------------------------------------------------------- /src/com/walmartlabs/system_viz.clj: -------------------------------------------------------------------------------- 1 | (ns com.walmartlabs.system-viz 2 | "Visualize a component system using Graphviz." 3 | (:require 4 | [com.stuartsierra.component :as component] 5 | [dorothy.core :as dorothy :as d] 6 | [clojure.set :as set] 7 | [clojure.java.browse :refer [browse-url]] 8 | [clojure.java.io :as io] 9 | [clojure.string :as str]) 10 | (:import 11 | (java.io File))) 12 | 13 | (defn ^:private component-attributes 14 | [component-key component highlight-attrs decorator] 15 | (if-not (map? component) 16 | {} 17 | (let [{:keys [:systemviz/attrs :systemviz/highlight :systemviz/color]} component] 18 | (cond-> (decorator component-key component) 19 | attrs (merge attrs) 20 | color (assoc :color color :style :filled) 21 | highlight (merge highlight-attrs))))) 22 | 23 | (defn ^:private system->dot 24 | [system options] 25 | (let [{:keys [horizontal highlight decorator] 26 | :or {horizontal false 27 | decorator (constantly nil) 28 | highlight {:color :skyblue 29 | :style :filled 30 | :fontsize 24}}} options 31 | dependency-keys (->> system 32 | vals 33 | (mapcat (comp vals component/dependencies)) 34 | set) 35 | all-keys (into dependency-keys (keys system)) 36 | id (volatile! 0) 37 | key->node-id (reduce (fn [m k] 38 | (assoc m k (str (name k) "_" (vswap! id inc)))) 39 | {} 40 | all-keys) 41 | component-nodes (for [[component-key component] system] 42 | [(key->node-id component-key) (assoc (component-attributes component-key component highlight decorator) 43 | :label (str component-key))]) 44 | edges (for [[component-key component] system 45 | [local-key system-key] (component/dependencies component)] 46 | (cond-> [(key->node-id component-key) (key->node-id system-key)] 47 | (not= local-key system-key) (conj {:label (str local-key)}))) 48 | bad-keys (set/difference all-keys (-> system keys set)) 49 | bad-nodes (map (fn [k] 50 | [(key->node-id k) {:label (str k)}]) bad-keys)] 51 | (->> [(when horizontal 52 | [(d/graph-attrs {:rankdir :LR})]) 53 | component-nodes 54 | (when (seq bad-nodes) 55 | [(d/node-attrs {:color :red :style :filled :fontcolor :white})]) 56 | bad-nodes 57 | ;; edges have to come last, otherwise they may "create" the bad nodes 58 | ;; and the node-attrs above do not take effect 59 | edges] 60 | (remove nil?) 61 | (reduce into []) 62 | (d/digraph) 63 | d/dot))) 64 | 65 | (defn visualize-system 66 | "Visualizes the system as a graph, using Graphviz. 67 | A temporary file is created to store the Graphviz 68 | program; this is then fed through the `dot` 69 | command line tool to generate a PDF file. 70 | 71 | Visualization recognizes three special keys: 72 | 73 | :graphviz/highlight 74 | : Adds node attributes to highlight the component in 75 | the graph. By default, skyblue color and 24 point font. 76 | 77 | :graphviz/color 78 | : Sets the color of the component to the provided color value, 79 | and sets the style of the node to be filled. 80 | 81 | :graphviz/attrs 82 | : A map of keys and values; these are added as node attributes. 83 | 84 | The resulting PDF file may optionally be opened, or 85 | its location output to the console. 86 | 87 | Generally, this should be invoked before the call to 88 | `system-start`. 89 | 90 | Options: 91 | 92 | :format 93 | : The output format as a keyword; defaults to :pdf, but 94 | :png or :svg are also good choices. 95 | 96 | :open 97 | : if true (the default), then the generated image file 98 | will be opened. If false, then the path to the image file 99 | will be printed to \\*out\\*. 100 | 101 | :horizontal 102 | : If true (the default is false), then the image will be laid out 103 | horizontally instead of vertically. 104 | 105 | :highlight 106 | : A map of Graphviz attributes and values to be applied to components 107 | where :graphviz/highlight is true. 108 | 109 | :decorator 110 | : A function that accepts a component key and component map, and 111 | returns nil, or a map of additional attributes. 112 | 113 | :save-as 114 | : If provided, then this is the path to which the graphviz source file 115 | will be saved. If not provided, the graphviz source file is generated 116 | as a temporary file. 117 | 118 | Returns the system unchanged." 119 | ([system] 120 | (visualize-system system nil)) 121 | ([system options] 122 | (let [{:keys [format open save-as] 123 | :or {format :pdf 124 | open true}} options 125 | format-name (name format) 126 | image-file (File/createTempFile "system-" (str "." format-name)) 127 | image-url (.toURL image-file) 128 | dot (system->dot system options)] 129 | 130 | (d/save! dot image-file {:format format}) 131 | 132 | (when save-as 133 | (spit (io/file save-as) dot)) 134 | 135 | (if open 136 | (browse-url image-url) 137 | (println "System graph rendered to:" (str image-url)))) 138 | 139 | ;; Ignore the result of the above, and just return the system. 140 | system)) 141 | -------------------------------------------------------------------------------- /test/com/walmartlabs/system_viz_test.clj: -------------------------------------------------------------------------------- 1 | (ns com.walmartlabs.system-viz-test 2 | (:require [com.walmartlabs.system-viz :refer [visualize-system]] 3 | [com.stuartsierra.component :as component])) 4 | 5 | (def sys 6 | (component/system-map 7 | :auth (component/using {} {:delegate :local/auth}) 8 | :local/auth (component/using {} [:database]) 9 | :database (component/using {} []) 10 | :handler (component/using {} [:database :message-queue]) 11 | :message-queue {} 12 | :router (component/using {} {:queue :message-queue}) 13 | :web-server (component/using {} [:auth :router :handler]))) 14 | 15 | 16 | (def bad-sys 17 | (component/system-map 18 | :auth (component/using {} {:delegate :local/auth}) 19 | :local/auth (component/using {} [:database]) 20 | :database (component/using {} []) 21 | :handler (component/using {} [:database :massage-queue]) 22 | :message-queue {} 23 | :router (component/using {} {:queue :message-queue}) 24 | :web-server (component/using {} [:authr :router :handler]))) 25 | 26 | (def customized-sys 27 | (component/system-map 28 | :auth (component/using {} {:delegate :local/auth}) 29 | :local/auth (component/using {:systemviz/color :magenta} [:database]) 30 | :database (component/using {:systemviz/highlight true} []) 31 | :handler (component/using {} [:database :message-queue]) 32 | :message-queue {:systemviz/attrs {:shape :box3d}} 33 | :router (component/using {} {:queue :message-queue}) 34 | :web-server (component/using {} [:auth :router :handler]))) 35 | 36 | 37 | (comment 38 | (visualize-system sys) 39 | (visualize-system bad-sys {:save-as "target/bad.gv"}) 40 | (visualize-system customized-sys) 41 | (visualize-system sys {:horizontal true}) 42 | (visualize-system sys {:decorator (fn [k _] 43 | (when (namespace k) 44 | {:color :green 45 | :style :filled 46 | :fontsize :20}))}) 47 | 48 | 49 | ) 50 | --------------------------------------------------------------------------------