From 5445e48f1740201cdea6f61e80b17b70cc78c8a1 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Thu, 1 May 2025 09:36:04 -0700 Subject: [PATCH] Add top-level diagram and bottom-level common catalogue --- docs/common.models.dsl | 15 +++ docs/common.views.dsl | 10 ++ docs/general.dsl | 64 +++++++++ docs/general.json | 285 +++++++++++++++++++++++++++++++++++++++++ docs/structurizr.sh | 2 +- 5 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 docs/common.models.dsl create mode 100644 docs/common.views.dsl create mode 100644 docs/general.dsl create mode 100644 docs/general.json diff --git a/docs/common.models.dsl b/docs/common.models.dsl new file mode 100644 index 0000000000..97b8c73083 --- /dev/null +++ b/docs/common.models.dsl @@ -0,0 +1,15 @@ +user = person "User" "An end user of the application" +admin = person "Organization Admin" "An administrator of an organization" { + tags "Admin" +} +provider = person "MSP" "And employee of a managed service provider" { + tags "MSP" +} +customer_success = person "Customer Success" "A customer success engineer. Inspects bitwarden state through the admin portal and internal tools" { + tags "Bitwarden Employee" +} +system_admin = person "System Admin" "Either a Bitwarden site-reliability engineer or administrator of a self-hosted instance" { + tags "Bitwarden Employee" "Self-Host Admin" +} +api = softwareSystem "API" { +} diff --git a/docs/common.views.dsl b/docs/common.views.dsl new file mode 100644 index 0000000000..bf5e7b2f4b --- /dev/null +++ b/docs/common.views.dsl @@ -0,0 +1,10 @@ +styles { + element "Person" { + background #d34407 + shape person + } + element "MSP" { + background #3107d3 + shape person + } +} diff --git a/docs/general.dsl b/docs/general.dsl new file mode 100644 index 0000000000..10223ceeb5 --- /dev/null +++ b/docs/general.dsl @@ -0,0 +1,64 @@ +workspace "Bitwarden" "General Bitwarden System" { + + !identifiers hierarchical + + model { + !include "common.models.dsl" + payment_systems = softwareSystem "Payment Systems" { + tags "External" + } + + bitwarden_pm = softwareSystem "Bitwarden System" { + wa = container "Web Application" + db = container "Database Schema" { + tags "Database" + } + } + + identity = softwareSystem "Identity" { + tags "Auth" + # This would point to a production on-prem instance hosting an auth-owned workspace defining an Identity system + url "http://localhost:8085/workspace/3/diagrams#Identity" + } + + user -> bitwarden_pm "Uses" + user -> identity "Authenticates with" + bitwarden_pm -> identity "validates tokens with" + admin -> bitwarden_pm "Administers Organizations" + provider -> bitwarden_pm "Administers Providers and Organizations" + customer_success -> bitwarden_pm "Inspects and supports" + system_admin -> bitwarden_pm "Administers System" + bitwarden_pm.wa -> bitwarden_pm.db "Reads from and writes to" + } + + views { + !include "common.views.dsl" + systemContext bitwarden_pm "Diagram1" { + include * + } + + container bitwarden_pm "Diagram2" { + include * + } + + styles { + element "Element" { + color #ffffff + } + element "Software System" { + background #f86628 + } + element "Container" { + background #f88728 + } + element "Database" { + shape cylinder + } + } + } + + configuration { + scope softwaresystem + } + +} diff --git a/docs/general.json b/docs/general.json new file mode 100644 index 0000000000..e3ca13ce32 --- /dev/null +++ b/docs/general.json @@ -0,0 +1,285 @@ +{ + "configuration" : { + "scope" : "SoftwareSystem" + }, + "description" : "General Bitwarden System", + "documentation" : { }, + "id" : 1, + "lastModifiedDate" : "2025-05-01T16:54:52Z", + "model" : { + "people" : [ { + "description" : "An end user of the application", + "id" : "1", + "location" : "Unspecified", + "name" : "User", + "properties" : { + "structurizr.dsl.identifier" : "user" + }, + "relationships" : [ { + "description" : "Uses", + "destinationId" : "8", + "id" : "12", + "sourceId" : "1", + "tags" : "Relationship" + }, { + "description" : "Authenticates with", + "destinationId" : "11", + "id" : "13", + "sourceId" : "1", + "tags" : "Relationship" + } ], + "tags" : "Element,Person" + }, { + "description" : "An administrator of an organization", + "id" : "2", + "location" : "Unspecified", + "name" : "Organization Admin", + "properties" : { + "structurizr.dsl.identifier" : "admin" + }, + "relationships" : [ { + "description" : "Administers Organizations", + "destinationId" : "8", + "id" : "15", + "sourceId" : "2", + "tags" : "Relationship" + } ], + "tags" : "Element,Person,Admin" + }, { + "description" : "And employee of a managed service provider", + "id" : "3", + "location" : "Unspecified", + "name" : "MSP", + "properties" : { + "structurizr.dsl.identifier" : "provider" + }, + "relationships" : [ { + "description" : "Administers Providers and Organizations", + "destinationId" : "8", + "id" : "16", + "sourceId" : "3", + "tags" : "Relationship" + } ], + "tags" : "Element,Person,MSP" + }, { + "description" : "A customer success engineer. Inspects bitwarden state through the admin portal and internal tools", + "id" : "4", + "location" : "Unspecified", + "name" : "Customer Success", + "properties" : { + "structurizr.dsl.identifier" : "customer_success" + }, + "relationships" : [ { + "description" : "Inspects and supports", + "destinationId" : "8", + "id" : "17", + "sourceId" : "4", + "tags" : "Relationship" + } ], + "tags" : "Element,Person,Bitwarden Employee" + }, { + "description" : "Either a Bitwarden site-reliability engineer or administrator of a self-hosted instance", + "id" : "5", + "location" : "Unspecified", + "name" : "System Admin", + "properties" : { + "structurizr.dsl.identifier" : "system_admin" + }, + "relationships" : [ { + "description" : "Administers System", + "destinationId" : "8", + "id" : "18", + "sourceId" : "5", + "tags" : "Relationship" + } ], + "tags" : "Element,Person,Bitwarden Employee,Self-Host Admin" + } ], + "softwareSystems" : [ { + "documentation" : { }, + "id" : "6", + "location" : "Unspecified", + "name" : "API", + "properties" : { + "structurizr.dsl.identifier" : "api" + }, + "tags" : "Element,Software System" + }, { + "documentation" : { }, + "id" : "7", + "location" : "Unspecified", + "name" : "Payment Systems", + "properties" : { + "structurizr.dsl.identifier" : "payment_systems" + }, + "tags" : "Element,Software System,External" + }, { + "containers" : [ { + "documentation" : { }, + "id" : "9", + "name" : "Web Application", + "properties" : { + "structurizr.dsl.identifier" : "bitwarden_pm.wa" + }, + "relationships" : [ { + "description" : "Reads from and writes to", + "destinationId" : "10", + "id" : "19", + "sourceId" : "9", + "tags" : "Relationship" + } ], + "tags" : "Element,Container" + }, { + "documentation" : { }, + "id" : "10", + "name" : "Database Schema", + "properties" : { + "structurizr.dsl.identifier" : "bitwarden_pm.db" + }, + "tags" : "Element,Container,Database" + } ], + "documentation" : { }, + "id" : "8", + "location" : "Unspecified", + "name" : "Bitwarden System", + "properties" : { + "structurizr.dsl.identifier" : "bitwarden_pm" + }, + "relationships" : [ { + "description" : "validates tokens with", + "destinationId" : "11", + "id" : "14", + "sourceId" : "8", + "tags" : "Relationship" + } ], + "tags" : "Element,Software System" + }, { + "documentation" : { }, + "id" : "11", + "location" : "Unspecified", + "name" : "Identity", + "properties" : { + "structurizr.dsl.identifier" : "identity" + }, + "tags" : "Element,Software System,Auth", + "url" : "http://localhost:8085/workspace/3/diagrams#Identity" + } ] + }, + "name" : "Bitwarden", + "properties" : { + "structurizr.dsl" : "d29ya3NwYWNlICJCaXR3YXJkZW4iICJHZW5lcmFsIEJpdHdhcmRlbiBTeXN0ZW0iIHsKCiAgICAhaWRlbnRpZmllcnMgaGllcmFyY2hpY2FsCgogICAgbW9kZWwgewogICAgICAgIHVzZXIgPSBwZXJzb24gIlVzZXIiICJBbiBlbmQgdXNlciBvZiB0aGUgYXBwbGljYXRpb24iCiAgICAgICAgYWRtaW4gPSBwZXJzb24gIk9yZ2FuaXphdGlvbiBBZG1pbiIgIkFuIGFkbWluaXN0cmF0b3Igb2YgYW4gb3JnYW5pemF0aW9uIiB7CiAgICAgICAgICB0YWdzICJBZG1pbiIKICAgICAgICB9CiAgICAgICAgcHJvdmlkZXIgPSBwZXJzb24gIk1TUCIgIkFuZCBlbXBsb3llZSBvZiBhIG1hbmFnZWQgc2VydmljZSBwcm92aWRlciIgewogICAgICAgICAgdGFncyAiTVNQIgogICAgICAgIH0KICAgICAgICBjdXN0b21lcl9zdWNjZXNzID0gcGVyc29uICJDdXN0b21lciBTdWNjZXNzIiAiQSBjdXN0b21lciBzdWNjZXNzIGVuZ2luZWVyLiBJbnNwZWN0cyBiaXR3YXJkZW4gc3RhdGUgdGhyb3VnaCB0aGUgYWRtaW4gcG9ydGFsIGFuZCBpbnRlcm5hbCB0b29scyIgewogICAgICAgICAgdGFncyAiQml0d2FyZGVuIEVtcGxveWVlIgogICAgICAgIH0KICAgICAgICBzeXN0ZW1fYWRtaW4gPSBwZXJzb24gIlN5c3RlbSBBZG1pbiIgIkVpdGhl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BpZGVudGl0eSAiQXV0aGVudGljYXRlcyB3aXRoIgogICAgICAgIGJpdHdhcmRlbl9wbSAtPiBpZGVudGl0eSAidmFsaWRhdGVzIHRva2VucyB3aXRoIgogICAgICAgIGFkbWluIC0+IGJpdHdhcmRlbl9wbSAiQWRtaW5pc3RlcnMgT3JnYW5pemF0aW9ucyIKICAgICAgICBwcm92aWRlciAtPiBiaXR3YXJkZW5fcG0gIkFkbWluaXN0ZXJzIFByb3ZpZGVycyBhbmQgT3JnYW5pemF0aW9ucyIKICAgICAgICBjdXN0b21lcl9zdWNjZXNzIC0+IGJpdHdhcmRlbl9wbSAiSW5zcGVjdHMgYW5kIHN1cHBvcnRzIgogICAgICAgIHN5c3RlbV9hZG1pbiAtPiBiaXR3YXJkZW5fcG0gIkFkbWluaXN0ZXJzIFN5c3RlbSIKICAgICAgICBiaXR3YXJkZW5fcG0ud2EgLT4gYml0d2FyZGVuX3BtLmRiICJSZWFkcyBmcm9tIGFuZCB3cml0ZXMgdG8iCiAgICB9CgogICAgdmlld3MgewogICAgICAgIHN0eWxlcyB7CiAgICAgICAgICBlbGVtZW50ICJQZXJzb24iIHsKICAgICAgICAgICAgYmFja2dyb3VuZCAjZDM0NDA3CiAgICAgICAgICAgIHNoYXBlIHBlcnNvbgogICAgICAgICAgfQogICAgICAgICAgZWxlbWVudCAiTVNQIiB7CiAgICAgICAgICAgIGJhY2tncm91bmQgIzMxMDdkMwogICAgICAgICAgICBzaGFwZSBwZXJzb24KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgc3lzdGVtQ29udGV4dCBiaXR3YXJkZW5fcG0gIkRpYWdyYW0xIiB7CiAgICAgICAgICAgIGluY2x1ZGUgKgogICAgICAgIH0KCiAgICAgICAgY29udGFpbmVyIGJpdHdhcmRlbl9wbSAiRGlhZ3JhbTIiIHsKICAgICAgICAgICAgaW5jbHVkZSAqCiAgICAgICAgfQoKICAgICAgICBzdHlsZXMgewogICAgICAgICAgICBlbGVtZW50ICJFbGVtZW50IiB7CiAgICAgICAgICAgICAgICBjb2xvciAjZmZmZmZmCiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxlbWVudCAiU29mdHdhcmUgU3lzdGVtIiB7CiAgICAgICAgICAgICAgICBiYWNrZ3JvdW5kICNmODY2MjgKICAgICAgICAgICAgfQogICAgICAgICAgICBlbGVtZW50ICJDb250YWluZXIiIHsKICAgICAgICAgICAgICAgIGJhY2tncm91bmQgI2Y4ODcyOAogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsZW1lbnQgIkRhdGFiYXNlIiB7CiAgICAgICAgICAgICAgICBzaGFwZSBjeWxpbmRlcgogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQoKICAgIGNvbmZpZ3VyYXRpb24gewogICAgICAgIHNjb3BlIHNvZnR3YXJlc3lzdGVtCiAgICB9Cgp9" + }, + "views" : { + "configuration" : { + "branding" : { }, + "lastSavedView" : "Diagram2", + "styles" : { + "elements" : [ { + "background" : "#d34407", + "shape" : "Person", + "tag" : "Person" + }, { + "background" : "#3107d3", + "shape" : "Person", + "tag" : "MSP" + }, { + "color" : "#ffffff", + "tag" : "Element" + }, { + "background" : "#f86628", + "tag" : "Software System" + }, { + "background" : "#f88728", + "tag" : "Container" + }, { + "shape" : "Cylinder", + "tag" : "Database" + } ] + }, + "terminology" : { } + }, + "containerViews" : [ { + "dimensions" : { + "height" : 1926, + "width" : 2835 + }, + "elements" : [ { + "id" : "9", + "x" : 817, + "y" : 742 + }, { + "id" : "10", + "x" : 1567, + "y" : 742 + } ], + "externalSoftwareSystemBoundariesVisible" : false, + "key" : "Diagram2", + "order" : 2, + "relationships" : [ { + "id" : "19" + } ], + "softwareSystemId" : "8" + } ], + "systemContextViews" : [ { + "dimensions" : { + "height" : 1400, + "width" : 3600 + }, + "elements" : [ { + "id" : "1", + "x" : 210, + "y" : 790 + }, { + "id" : "2", + "x" : 900, + "y" : 165 + }, { + "id" : "3", + "x" : 1600, + "y" : 165 + }, { + "id" : "4", + "x" : 2300, + "y" : 165 + }, { + "id" : "5", + "x" : 3000, + "y" : 165 + }, { + "id" : "8", + "x" : 1575, + "y" : 865 + }, { + "id" : "11", + "x" : 0, + "y" : 0 + } ], + "enterpriseBoundaryVisible" : true, + "key" : "Diagram1", + "order" : 1, + "relationships" : [ { + "id" : "12", + "vertices" : [ { + "x" : 750, + "y" : 565 + } ] + }, { + "id" : "13" + }, { + "id" : "14" + }, { + "id" : "15" + }, { + "id" : "16" + }, { + "id" : "17" + }, { + "id" : "18", + "vertices" : [ { + "x" : 2850, + "y" : 565 + } ] + } ], + "softwareSystemId" : "8" + } ] + } +} \ No newline at end of file diff --git a/docs/structurizr.sh b/docs/structurizr.sh index f1e0ed74e3..4027371a6e 100644 --- a/docs/structurizr.sh +++ b/docs/structurizr.sh @@ -3,7 +3,7 @@ ## start Structurizr Lite with the given workspace file, relative to the current working directory. Omit the file extension. ## Optional second argument of a port number to use. Default is 8085. -PORT=${2:-8085} +echo "hosting on ${PORT:=${2:-8085}}" # Check if the workspace file exists if [ ! -f "$1.dsl" ]; then echo "Workspace file $1 does not exist."