public C1(Workspace workspace) { var coursePlatformSystem = new C4Builder(workspace) .AddPerson("Admin", "Configuring platform, generating coupons") .AddPerson("Customer", "Using course platform, buy on platform") .AddSoftwareSystem("Course Platform", "Sell and delivery courses to customers") .AddSoftwareSystem("Stripe", "Handle payments", "External") .AddSoftwareSystem("iFirma", "Generate invoices", "External") .AddSoftwareSystem("SMTP", "Send emails", "External") .PersonUses("Customer", "Course Platform", "Buy and pass the courses") .PersonUses("Admin", "Course Platform", "Manages") .SoftwareSystemUses("Course Platform", "Stripe", "Request payments") .SoftwareSystemUses("Course Platform", "iFirma", "Generate invoices") .SoftwareSystemUses("Course Platform", "SMTP", "Send emails") .SoftwareSystemDelivers("SMTP", "Customer", "Send emails") .SoftwareSystemUses("Stripe", "Course Platform", "Responses") .AddStyle(new ElementStyle(Tags.SoftwareSystem) { FontSize = 30, Background = "#FB9D4B" }) .AddStyle(new ElementStyle("External") { FontSize = 30, Background = "#FFCEE0" }) .AddStyle(new ElementStyle(Tags.Person) { FontSize = 30, Background = "#FFF9B1", Shape = Shape.Person }).GetSoftwareSystem("Course Platform"); var contextView = workspace.Views.CreateSystemContextView( coursePlatformSystem, "Course Platform Context View", "System Context diagram for Course Platform."); contextView.PaperSize = PaperSize.A4_Portrait; contextView.EnableAutomaticLayout(RankDirection.RightLeft, 300, 50, 50, true); contextView.AddAllSoftwareSystems(); contextView.AddAllPeople(); }
public C2(Workspace workspace) { var coursePlatformSystem = new C4Builder(workspace) .SelectSoftwareSystem("Course Platform") .AddContainer("Course API", "Course platform core domain with endpoints", ".NET Core 5, WebApi") .AddContainer("Customer Web Page", "Sell and delivering courses for customers", "Angular 9, TypeScript", "WebPage") .AddContainer("Web Admin Panel", "Pane for courses management", ".NET Core 3.1, Razor Page", "WebPage") .AddContainer("Postgres Database", "Database course_db for whole application data", "RDB, Postgres 9.3", "Database") .ContainerUses("Course API", "Postgres Database", "Uses", "ORM") .ContainerUsesSofwareSystem("Course API", "Stripe", "Requesting payments", "HTTPS/REST") .ContainerUsesSofwareSystem("Course API", "iFirma", "Generate invoice", "HTTPS/POST REST") .ContainerUsesSofwareSystem("Course API", "SMTP", "Send invoice", "SMTP") .SoftwareSystemUsesContainer("Stripe", "Course API", "Respons", "HTTPS/REST") .PersonUsesContainer("Customer", "Customer Web Page", "Buy and pass the courses") .PersonUsesContainer("Admin", "Web Admin Panel", "Manages") .ContainerUses("Customer Web Page", "Course API", "Uses", "HTTPS/REST") .ContainerUses("Web Admin Panel", "Course API", "Uses", "HTTPS/REST") .AddStyle(new ElementStyle(Tags.Container) { FontSize = 30, Background = "#FB9D4B" }) .AddStyle(new ElementStyle("Database") { Background = "#808080", Shape = Shape.Cylinder }) .AddStyle(new ElementStyle("WebPage") { Shape = Shape.WebBrowser }).GetSoftwareSystem("Course Platform"); var containerView = workspace.Views.CreateContainerView(coursePlatformSystem, "Containers", null); containerView.PaperSize = PaperSize.A4_Landscape; containerView.EnableAutomaticLayout(RankDirection.LeftRight, 200, 200, 200, true); containerView.AddAllElements(); }
public C3(Workspace workspace) { var courseAPIContainer = new C4Builder(workspace) .SelectSoftwareSystem("Course Platform") .SelectContainer("Course API") .AddComponent("Product Controller", "Handle products requests.", ".NET Core 5, WebApi", "Controller") .AddComponent("Offer Controller", "Handle offers requests.", ".NET Core 5, WebApi", "Controller") .AddComponent("Order Controller", "Handle orders requests.", ".NET Core 5, WebApi", "Controller") .AddComponent("Invoice Controller", "Handle generate invoice requests.", ".NET Core 5, WebApi", "Controller") .AddComponent("Discount Controller", "Handle discount requests.", ".NET Core 5, WebApi", "Controller") .AddComponent("Order", "Handle orders logic. Uses: Database Prostgres Container to read/write [ORM].", ".NET Core 5, ClassLib") .AddComponent("Payment", "Handle payments logic.", ".NET Core 5, ClassLib, Stripe.NET") .AddComponent("Offer", "Handle offers logic.", ".NET Core 5, ClassLib") .AddComponent("Email", "Handle sending emails logic.", ".NET Core 5, ClassLib") .AddComponent("Invoice", "Handle invoice logic.", ".NET Core 5, ClassLib") .AddComponent("Discount", "Handle discount logic.", ".NET Core 5, ClassLib") .AddComponent("Delivery", "Handle delivery logic.", ".NET Core 5, ClassLib") .AddComponent("Sell", "Handle selling logic.", ".NET Core 5, ClassLib") .ContainerUsesComponent("Web Admin Panel", "Product Controller", "Uses", "[HTTPS/REST]") .ContainerUsesComponent("Web Admin Panel", "Offer Controller", "Uses", "[HTTPS/REST]") .ComponentUsesComponent("Offer Controller", "Offer", "Uses", "Internal") .ComponentUsesComponent("Product Controller", "Offer", "Uses", "Internal") .ComponentUsesContainer("Offer", "Postgres Database", "Read/write from", "[DB/ORM]") .ContainerUsesComponent("Web Admin Panel", "Discount Controller", "Uses", "[HTTPS/REST]") .ContainerUsesComponent("Customer Web Page", "Discount Controller", "Uses", "[HTTPS/REST]") .ComponentUsesComponent("Discount Controller", "Discount", "Uses", "Internal") .ComponentUsesContainer("Discount", "Postgres Database", "Read/write from", "[DB/ORM]") .ContainerUsesComponent("Customer Web Page", "Order Controller", "Uses", "[HTTPS/REST]") .ComponentUsesComponent("Order Controller", "Order", "Uses", "Internal") .ComponentUsesContainer("Order", "Postgres Database", "Read/write from", "[DB/ORM]") .ComponentUsesComponent("Order", "Order", "Payment", "Internal") .ComponentUsesSoftwareSystem("Payment", "Stripe", "Requesting payments", "[HTTPS/REST]") .SoftwareSystemUsesComponent("Stripe", "Payment", "Responses", "[HTTPS/REST]") .ComponentUsesComponent("Payment", "Sell", "Payment Success", "Internal") .ComponentUsesComponent("Sell", "Delivery", "Uses", "Internal") .ComponentUsesComponent("Sell", "Invoice", "Generate invoice", "Internal") .ComponentUsesSoftwareSystem("Invoice", "iFirma", "Generate invoice", "[HTTPS/POST REST]") .SoftwareSystemUsesComponent("iFirma", "Invoice Controller", "Responses", "[HTTPS/POST REST]") .ComponentUsesComponent("Invoice Controller", "Invoice", "Uses", "Internal") .ComponentUsesComponent("Invoice", "Email", "Send emails", "Internal") .ComponentUsesSoftwareSystem("Email", "SMTP", "Sending emails", "[SMTP]") .ComponentUsesContainer("Payment", "Postgres Database", "Read/write from", "[DB/ORM]") .ComponentUsesContainer("Sell", "Postgres Database", "Read/write from", "[DB/ORM]") .ComponentUsesContainer("Delivery", "Postgres Database", "Read/write from", "[DB/ORM]") .AddStyle(new ElementStyle(Tags.Component) { Background = "#FB9D4B", Shape = Shape.Hexagon }) .AddStyle(new ElementStyle("Controller") { Shape = Shape.Component }) .AddStyle(new RelationshipStyle(Tags.Relationship) { Routing = Routing.Curved }) .AddStyle(new RelationshipStyle("Internal") { Dashed = false, Color = "#8FD14F", Routing = Routing.Curved }) .GetContainer("Course API"); var componentView = workspace.Views.CreateComponentView(courseAPIContainer, "Components", null); componentView.PaperSize = PaperSize.A2_Landscape; componentView.EnableAutomaticLayout(RankDirection.LeftRight, 300, 100, 100, true); componentView.AddAllElements(); }