Giter VIP home page Giter VIP logo

c4sharp's Introduction

logo

C4Sharp (C4S) is a .net library for building C4 Model diagrams. It's works like a superset of C4-PlantUML through which developers can create, share, and consume C4 Model diagrams as code (C#) such as Context, Container, Component and Deployment diagrams.

.NET CodeQL

Getting Started

Instalation

This package is available through Nuget Packages: https://www.nuget.org/packages/C4Sharp

Package Version Downloads Maintainability
C4Sharp NuGet Nuget Codacy Badge

Nuget

Install-Package C4Sharp

.NET CLI

dotnet add package C4Sharp

Dependencies

You need these things to run C4Sharp:

Coding

To create C4S diagrams, we need a set of C4 structures and inform their Relationships, as shown in the following example:

structures

To start using C4S, you should create the basic structures of your architecture design, like this:

//Person
public static Person Customer => new Person("customer", "Personal Banking Customer")
{
    Description = "A customer of the bank, with personal bank accounts."
};

// Systems
public static SoftwareSystem BankingSystem => new SoftwareSystem("BankingSystem", "Internet Banking System")
{
    Description = "Allows customers to view information about their bank accounts, and make payments."
};

public static SoftwareSystem Mainframe => new SoftwareSystem("Mainframe", "Mainframe Banking System")
{
    Description = "Stores all of the core banking information about customers, accounts, transactions, etc.",
    Boundary = Boundary.External
};

public static SoftwareSystem MailSystem => new SoftwareSystem("MailSystem", "E-mail system")
{
    Description = "The internal Microsoft Exchange e-mail system.",
    Boundary = Boundary.External
};

Then, you'll be able to create a C4 Context Diagram:

var diagram = new ContextDiagram
{
    Title = "System Context diagram for Internet Banking System",
    Structures = new Structure[]
    {
        Customer,
        BankingSystem,
        Mainframe,
        MailSystem
    },
    Relationships = new []
    {
        (Customer > BankingSystem),
        (Customer < MailSystem)["Sends e-mails to"],
        (BankingSystem > MailSystem)["Sends e-mails", "SMTP"][Neighbor],
        (BankingSystem > Mainframe),
    }
};

new PlantumlSession()
    .UseDiagramImageBuilder()
    .UseStandardLibraryBaseUrl()
    .Export(diagrams);

See more in our sample code:

The result will be:

logo

Learn

To learn more about C4S access our wiki.

Thanks

C4 community

Contributors

Colleagues

Guide to contributing to a GitHub project

This is a guide to contributing to this open source project that uses GitHub. It’s mostly based on how many open sorce projects operate. That’s all there is to it. The fundamentals are:

  • Fork the project & clone locally.
  • Create an upstream remote and sync your local copy before you branch.
  • Branch for each separate piece of work.
  • Do the work, write good commit messages, and read the CONTRIBUTING file if there is one.
  • Push to your origin repository.
  • Create a new PR in GitHub.
  • Respond to any code review feedback.

If you want to contribute to an open source project, the best one to pick is one that you are using yourself. The maintainers will appreciate it!

c4sharp's People

Contributors

albertomonteiro avatar nino-dioses avatar yanjustino 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.