Templates / sequenceDiagram

User login sequence

A login flow with token issuance and a failure branch. Useful for documenting auth endpoints and session behavior.

Open in studio

Preview

Mermaid 11 renderer

Rendering preview...

Mermaid source

sequenceDiagram

sequenceDiagram
    autonumber
    actor User
    participant App as Web app
    participant API as Auth API
    participant DB as User store

    User->>App: Enter email and password
    App->>API: POST /sessions
    API->>DB: Look up user record
    DB-->>API: User + password hash
    alt Credentials valid
        API-->>App: 201 session + JWT
        App-->>User: Redirect to dashboard
    else Credentials invalid
        API-->>App: 401 unauthorized
        App-->>User: Show error message
    end

More templates