Diagrams you draw in Flowgraph Studio, now in your README

flowgraph sync can put a diagram saved in your account into your README, in its own theme, and keep a saved diagram in step with the code, with every change in its version history.

News · · 2 min read

Some diagrams can be read straight from a repository: the services in a Compose file, the modules that import each other, the tables in your migrations. Others can't. A target architecture, an overview arranged to tell a story, or a diagram that leaves out the boring parts on purpose lives in Flowgraph Studio, styled by hand.

Until now those two kinds lived apart. From today, flowgraph sync connects them in both directions.

Compare versions in Flowgraph Studio: the saved Services diagram before the last sync and after it, side by side, with the new cache service and its connection marked as added
A saved diagram kept current with save-to: Compare with current shows exactly what the code changed.

From your account to the README

Add a diagram from your account to flowgraph.yml with draw: saved and its id:

diagrams:
  target-architecture:
    draw: saved
    id: 5f2c9a7e

On each sync, it's rendered with the theme it has in the app and filled into the README block that names it. Change its colours or rearrange it in the editor, and the next sync puts the new version in the README. Edits in the app don't start your CI, so run the sync on a schedule too, for example every morning.

The id is in the editor's address (/editor?diagram=…), and flowgraph diagrams lists every saved diagram with its id.

From the code to your account

The other direction matters for diagrams your team reviews in the app. With save-to:, a diagram drawn from the repository also updates a saved one:

diagrams:
  services:
    draw: compose
    save-to: 81b3d0c4

Sync keeps what makes the saved diagram yours: its title, its theme, and the positions you gave nodes in Manual mode. New nodes are placed for you, and nodes that are gone simply disappear. Each change is a new version, so Version history and Compare with current show exactly what changed, and a reviewed diagram is marked Changed since review.

flowchart LR
  code[Code and config<br/>in the repository] -->|save-to| saved[Saved diagram<br/>in Flowgraph Studio]
  saved -->|draw: saved| readme[README]
  code -->|draw| readme

Good to know

  • Plans and keys. Both directions need Pro or Pro Max, and an API key with Read and change saved diagrams ticked when you create it.
  • Nothing is touched needlessly. A saved diagram that already matches the code isn't updated, and sync --check in a pull request leaves saved diagrams alone.
  • If someone is editing it. When a saved diagram changes while sync is updating it, sync reads it again and retries once; otherwise the next run catches up.
  • Only diagrams. LinkedIn explainers, design documents and whiteboards can't be used with draw: saved.

The setup, with videos of both directions, is in Keep README architecture diagrams up to date in CI.

More from the blog

Follow the blog by RSS