Black Friday race Join
General

Sequence diagram template

A sign-in drawn message by message: User, Web app, API and Database across the top, and eight calls and replies running down the page in the order they happen.

The Sequence diagram template

What is a sequence diagram?

A sequence diagram shows how the parts of a system talk to each other over time. The participants stand in a row across the top. Time runs down the page. Each arrow is one message from one participant to another, and the higher an arrow sits, the earlier it happens.

The template draws a sign-in from the first click to the first screen. Four participants take part: a User, a Web app, an API and a Database. Eight messages pass between them, starting with “Sign in” and ending with “Show the dashboard”. It is the kind of flow every product has, which makes it a good pattern to adapt.

The sequence diagram template: User, Web app, API and Database across the top with lifelines below, and eight messages from Sign in down to Show the dashboard.
Four participants, eight messages, time running from top to bottom.

Participants and lifelines

The row at the top names who is involved. The User is a stick figure, the UML symbol for an actor: someone outside the system. The Web app, the API and the Database are boxes, because they are parts of it.

From each participant a dashed line drops straight down. That is its lifeline, and every message to or from the participant touches it. The narrow bars drawn over a lifeline mark when that participant is busy. The Web app’s bar runs almost the full height of the diagram, since it waits for everything else to finish. The Database has two short bars, one for each query.

Order the participants so that most arrows point to a neighbor. Here the caller is always on the left of the one it calls, and no arrow has to jump over a lifeline.

An actor outside the system on the left, three parts of the system to its right.

Read the messages from the top down

The first three arrows carry the request inward, one step at a time:

  • The user sends “Sign in” to the web app.
  • The web app sends “POST /sessions” to the API.
  • The API sends “Find user by email” to the database.

Look at how the labels change. The user’s message is in the user’s words. The web app’s message is an HTTP request, written as a developer would type it. The API’s message describes a query. Each label is in the language of the two participants it connects, and that is what makes the diagram useful to all of them. A label like “Request” or “Call backend” would be true and would tell nobody anything.

Each message is labeled in the language of the two parts it connects.

Calls and their replies

Solid arrows are calls. Dashed arrows pointing back are replies. Between the API and the Database the template shows two complete exchanges: “Find user by email” is answered with “User row”, then “Save session” is answered with “OK”.

After that the replies unwind in reverse order. The API returns “201 Created, token” to the web app, and the web app can finally “Show the dashboard” to the user. Every call that went in has an answer coming out, and you can check that by pairing them off.

What the template leaves out is just as instructive: there is no wrong-password path. One diagram, one scenario. Draw the failure as a second diagram, or add an alternative frame around the steps that differ, once the main path is agreed.

Two calls to the database, each followed by a dashed reply.

How to use the sequence diagram template

  1. Open it as a new board. The sign-in example is included.
  2. Pick one scenario and name it. “Customer pays by card and it succeeds” is a scenario. “Payments” is not.
  3. Rename the participants. Keep the actor on the left, then list the parts of your system in the order the request reaches them. Add or remove a box and its lifeline as needed.
  4. Rewrite the arrows top to bottom. Replace each label with the real message: the endpoint, the query, the event name. Move an arrow up or down to change when it happens.
  5. Pair each call with its reply. Write what comes back, as the example does with “201 Created, token”, and delete replies that carry nothing a reader needs.
The replies travel back toward the user in reverse order.

When a sequence diagram is the right choice

Use one when the order of calls between components is the thing to get right: designing an API, debugging a slow request, documenting an integration, reviewing where a timeout could strike. The guide on how to draw a sequence diagram covers frames for loops and alternatives.

It is the wrong tool for logic inside one component, where an activity diagram shows the branching better. For the structure of the code and not its behavior, draw a UML class diagram. If the flow you need is a login with a third-party provider, the OAuth 2.0 sequence template is a longer worked example of this same diagram type.

Questions about the Sequence diagram template

What is a lifeline in a sequence diagram?

It is the dashed vertical line under each participant. It stands for that participant existing over time, and every message the participant sends or receives starts or ends on it.

What is the difference between a solid and a dashed arrow?

A solid arrow is a call or a request going out. A dashed arrow is the reply coming back. In the template, POST /sessions is solid and 201 Created, token is the dashed reply to it.

How many participants should one sequence diagram have?

Three to six fits on a screen and stays readable. The template has four. If you need more, group several internal services behind one box and give them a diagram of their own.

Is the sequence diagram template free?

Yes. It has 33 elements and opens on the Free plan, where a board can hold up to 150. You can export the result as PNG, SVG or PDF for your documentation.