Giter Site home page Giter Site logo

c4-modeling's Introduction

Example

See example code here

Model system architecure in code

object PersonalBankingCustomer extends Person("personal customer of the bank")

object EMailSystem extends System("microsoft exchange", external = true)
object MainframeBankingSystem extends System("old", external = true)
object InternetBankingSystem extends System {

  object WebApplication extends Container(
    "Java and Spring MVC", "delivers the static content"
  )

  object SinglePageApplication extends Container("Javascript and Angular")
  object MobileApp extends Container("Xamarin", "subset of web functionality")
  object Database extends Container("Oracle", "user info", true)

  object APIApplication extends Container("Java and Spring MVC") {

    object PasswordResetController extends Component("Spring MVC Rest controller")

    object SignInComponent extends Component(
      "Spring MVC Rest controller", "lets users sign in"
    )

    object AccountsSummaryController extends Component(
      "Spring MVC Rest controller", 
      "gives customers summaries of their accounts"
    )

    object SecurityComponent extends Component(
      "Spring Bean", "functions related to sign in, password change, etc"
    )

    object EMailComponent extends Component(
      "Spring Bean", "sends emails to users"
    )

    object MainframeBankingSystemFacade extends Component(
      "Spring Bean", "facade to mainframe bank system"
    )
  }
}

Create diagrams by describing relationships in the model

render(
  PersonalBankingCustomer-
    "visits website"-->InternetBankingSystem.WebApplication,

  PersonalBankingCustomer-
    "views account balances"-->InternetBankingSystem.SinglePageApplication,

  PersonalBankingCustomer-
    "views account balances"-->InternetBankingSystem.MobileApp,

  InternetBankingSystem.WebApplication-
    "delivers to browser"-->InternetBankingSystem.SinglePageApplication,

  InternetBankingSystem.MobileApp-
    "makes api calls"-->InternetBankingSystem.APIApplication,

  InternetBankingSystem.SinglePageApplication-
    "makes api calls"-->InternetBankingSystem.APIApplication,

  InternetBankingSystem.APIApplication-
    "r/w"-->InternetBankingSystem.Database,

  InternetBankingSystem.APIApplication-
    "sends email using"-->EMailSystem,

  InternetBankingSystem.APIApplication-
    "makes api calls to"-->MainframeBankingSystem
)

Render diagrams using plantUML

$ ./big-bank-plc-containers.sc | java -jar plantuml.jar -pipe > big-bank-plc-containers.png
$ ./big-bank-plc-containers.sc > big-bank-plc-containers.puml

Install

  1. Install ammonite
  2. Download the modeling script wget https://raw.githubusercontent.com/kag0/c4-modeling/main/c4.sc
  3. Reference from your modeling and diagram code
    import $file.^.c4
    import c4._

c4-modeling's People

Contributors

nrktkt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.