Coder Social home page Coder Social logo

c4-models's Introduction

C4 Models

Context, Containers, Components and Code - https://c4model.com/

Getting Started

Create diagrams using PlantUML - https://github.com/plantuml-stdlib/C4-PlantUML.

  1. Create a .puml file using the following template:
@startuml <Name>

' Diagram Type
!include <Diagram_Type>

' C4 models

@enduml
  1. Set diagram type:
  1. Define C4 elements - https://github.com/plantuml-stdlib/C4-PlantUML#supported-diagram-types - to build Container diagram.

  2. Optionally include a legend LAYOUT_WITH_LEGEND()

Generating Images

Online

Copy content from .puml file:

https://www.plantuml.com/plantuml

Locally

Prerequisites:

See https://plantuml.com/starting for full options.

java -jar plantuml.jar file1 file2 file3

Previewing Images

Download VS Code PlantUML plugin - https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml

Docker

https://hub.docker.com/r/dstockhammer/plantuml - Not an official PlantUML docker image.

Run the following command to generate images using default options:

docker run --rm -v $(pwd):/data dstockhammer/plantuml **/*.puml

Run the following command to see full options:

docker run --rm dstockhammer/plantuml -h

Generating Documentation

Create Markdown from .puml files using https://github.com/adrianvlupu/C4-Builder.

Run following command to install c4builder:

npm i -g c4builder

Create .c4builder config:

{
	"plantumlVersion": "latest",
	"projectName": "<Name>",
	"homepageName": "Overview",
	"rootFolder": "diagrams",
	"distFolder": "docs",
	"generateMD": true, // automatically generate MD file
	"generatePDF": false,
	"generateCompleteMD": false,
	"generateCompletePDF": false,
	"generateWEB": false,
	"webTheme": "//unpkg.com/docsify/lib/themes/vue.css",
	"supportSearch": "false",
	"repoUrl": "false",
	"docsifyTemplate": "",
	"webPort": "3000",
	"pdfCss": "/opt/homebrew/lib/node_modules/c4builder/pdf.css",
	"includeBreadcrumbs": false,
	"includeLinkToDiagram": false,
	"includeTableOfContents": true, // add table of contents
	"diagramsOnTop": true,
	"embedDiagram": false,
	"excludeOtherFiles": false,
	"generateLocalImages": true, // generate images vs plantuml links
	"plantumlServerUrl": "https://www.plantuml.com/plantuml",
	"diagramFormat": "png",
	"charset": "UTF-8"
}

Run following command to generate Markdown:

cd <config location>
c4builder

Note: when you run c4builder it add/updates checksums property in the config.

c4-models's People

Contributors

matteus6007 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.