Now that we've seen a simple message between two systems, let's show the database's role in fulfilling the request: sequenceDiagram The -> arrow (note the two dashes instead of one) indicates a dotted line return value This will not appear in the examples in this article Note: for asynchronous messages you would indicate them with -). The value after the : describes the contents of the message. The -> arrow indicates that the message is intended to be synchronous. Next, we declare a message from a Client to the Server. Here we start by specifying that the Mermaid diagram we want to use is a sequence diagram. sequenceDiagramĬlient->Server: Login (Username, Password) Let's start with a simple sequence diagram representing a message from the client to the server and the server's response back. If you're curious about this, however, I do have an article and video on understanding JWT authentication. However, the focus of the article's text will be on the diagrams themselves, not the process of JWT authentication. Over the course of this article, we'll create and expand a sequence diagram to explain JSON Web Token (JWT) authentication. If you're curious about sequence diagrams in general, a good starting point might be Visual Paradigm's Guide to Sequence Diagrams. This can help explain complex logic and interactions with a technical diagram and identify areas of confusion or misunderstanding. Sequence diagrams represent systems and individuals as vertical columns and messages between these parts as horizontal lines that move across the various lanes to show how data flows between different pieces of the system. What are Sequence Diagrams?įor those of you who haven't been exposed, sequence diagrams describe a series of messages in a sequence between different objects. Mermaid.js is available in a variety of tools, but I most frequently use it in GitHub markdown files and in Polyglot Notebooks. It also means that the diagram source is easily version-controlled and anyone on your team can modify it without special tooling or licenses. This means your time is focused on actually writing the interaction logic instead of generating a visual. With Mermaid.js you can write a few lines of text and use its JavaScript library to generate a professional sequence diagram like the one below: Mermaid.js is the solution I needed 20 years ago. I distinctly remember working on sequence diagrams in my undergraduate computer science education and having so many issues trying to get the various boxes and arrows to look standard, rearrange shapes as I needed to expand the diagram, and generally focusing on anything but the logic the diagrams intended to create. Previously I've shown how Mermaid.js allows you to create entity relationship diagrams and class diagrams, but in this article we'll cover a far more complex diagram: the sequence diagram. I've been really enjoying seeing how Mermaid.js lets you generate technical diagrams from simple markdown.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |