Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. id: c4
  3. title: C4
  4. ---
  5. ## C4 Diagrams
  6. [C4](https://c4model.com/) is a standardized model to visualize software architecture.
  7. You can generate C4 diagrams by using the node and edge classes from the `diagrams.c4` package:
  8. ```python
  9. from diagrams import Diagram
  10. from diagrams.c4 import Person, Container, Database, System, SystemBoundary, Relationship
  11. graph_attr = {
  12. "splines": "spline",
  13. }
  14. with Diagram("Container diagram for Internet Banking System", direction="TB", graph_attr=graph_attr):
  15. customer = Person(
  16. name="Personal Banking Customer", description="A customer of the bank, with personal bank accounts."
  17. )
  18. with SystemBoundary("Internet Banking System"):
  19. webapp = Container(
  20. name="Web Application",
  21. technology="Java and Spring MVC",
  22. description="Delivers the static content and the Internet banking single page application.",
  23. )
  24. spa = Container(
  25. name="Single-Page Application",
  26. technology="Javascript and Angular",
  27. description="Provides all of the Internet banking functionality to customers via their web browser.",
  28. )
  29. mobileapp = Container(
  30. name="Mobile App",
  31. technology="Xamarin",
  32. description="Provides a limited subset of the Internet banking functionality to customers via their mobile device.",
  33. )
  34. api = Container(
  35. name="API Application",
  36. technology="Java and Spring MVC",
  37. description="Provides Internet banking functionality via a JSON/HTTPS API.",
  38. )
  39. database = Database(
  40. name="Database",
  41. technology="Oracle Database Schema",
  42. description="Stores user registration information, hashed authentication credentials, access logs, etc.",
  43. )
  44. email = System(name="E-mail System", description="The internal Microsoft Exchange e-mail system.", external=True)
  45. mainframe = System(
  46. name="Mainframe Banking System",
  47. description="Stores all of the core banking information about customers, accounts, transactions, etc.",
  48. external=True,
  49. )
  50. customer >> Relationship("Visits bigbank.com/ib using [HTTPS]") >> webapp
  51. customer >> Relationship("Views account balances, and makes payments using") >> [spa, mobileapp]
  52. webapp >> Relationship("Delivers to the customer's web browser") >> spa
  53. spa >> Relationship("Make API calls to [JSON/HTTPS]") >> api
  54. mobileapp >> Relationship("Make API calls to [JSON/HTTPS]") >> api
  55. api >> Relationship("reads from and writes to") >> database
  56. api >> Relationship("Sends email using [SMTP]") >> email
  57. api >> Relationship("Makes API calls to [XML/HTTPS]") >> mainframe
  58. customer << Relationship("Sends e-mails to") << email
  59. ```
  60. It will produce the following diagram:
  61. ![c4](/img/c4.png)