Draw a Bitbucket repository's architecture from its own files
Turn a Bitbucket Cloud repository's Compose files, Kubernetes manifests, Terraform, OpenAPI descriptions, bitbucket-pipelines.yml, SQL migrations and workspace packages into editable diagrams, including private repositories in your workspaces.
Flowgraph Studio reads the files that already describe a system (Docker Compose, Kubernetes manifests, Terraform, OpenAPI descriptions, the CI configuration, SQL migrations, workspace packages) and draws each one as a diagram you can edit. This guide covers what is particular to Bitbucket Cloud. The diagrams themselves are the same for every host, and Draw a GitHub repository's architecture describes each one in detail.
Import a public repository
Open Flowgraph Studio, choose Import repository, paste the repository's address and choose Scan repository. Any of these work:
bitbucket.org/workspace/repositorygit@bitbucket.org:workspace/repository.git, the SSH address you clone with
To scan one folder, open it on Bitbucket and paste that address, which has the form bitbucket.org/workspace/repository/src/branch/folder. Branch names that contain a slash work too, and an address that points at a file scans the folder the file is in.
Your browser reads a public repository straight from Bitbucket, with no sign-in. Bitbucket allows only about 60 such reads an hour from one network, and a large repository is listed folder by folder. If the limit runs out, the scan says when you can try again. Scanning one folder uses far fewer reads, and private repositories (below) are read with your own account, which has a much higher limit.
Scanning needs no account. Adding the diagrams, and refreshing them later, needs one: Free accounts can add diagrams from 3 repositories in all and refresh them 50 times a month, and Pro and Pro Max have no limit. Delete every diagram from a repository to free its place for another, once a month.
What the scan finds
The scan lists each diagram it can draw, for example:
- Services from
docker-compose.yml - Kubernetes from the manifests in
k8s/ - Infrastructure from the Terraform in
infra/ - Endpoints from
openapi.yaml - Bitbucket Pipelines from
bitbucket-pipelines.yml - Data model from the SQL migrations, a schema dump or a Prisma schema
- Package map of the workspace packages
- Mermaid diagrams already written in the README and documentation
- Under From the code, a Codebase map of the folders and, for TypeScript, JavaScript, Python, Java, Go and C#, the Module dependencies and Class diagrams, and a Route map when the code uses a web framework it knows, drawn from the code when you choose Draw (what it shows). Signed in, the whole commit is downloaded at once; without signing in, the files are read one by one within Bitbucket's 60 reads an hour, so draw it for one folder.
Tick the ones you want. They go into a new project named after the repository.
Bitbucket Pipelines
The pipeline diagram is drawn from bitbucket-pipelines.yml:
- Each pipeline is a group: the default one, one for each branch, pull request and tag pattern, and each custom pipeline run by hand. Each starts from what runs it ("every push", "push to main").
- Its steps follow in order. Parallel steps fan out from the step before and join again, and a stage's steps run one after another.
- Steps you trigger by hand and steps that deploy to an environment are marked, so the step to production stands out.
- YAML anchors (
&buildand*build), which these files use a lot, are followed, so a reused step shows its image and settings.
Private repositories (Pro and Pro Max)
Connect Bitbucket under Account → GitLab, Bitbucket, and Azure DevOps, or from the Bitbucket tab under Your repositories in the import dialog. Bitbucket asks you to grant Flowgraph Studio read-only access: your account's details, which workspaces you belong to, and your repositories. It can't change anything.
Your repositories then appear on the Bitbucket tab, across all your workspaces, the most recently updated first. Pick one, or paste its address as you would a public one.
A private repository is read by Flowgraph's server with your own connection, and handed straight to your browser to draw. Bitbucket checks on every read that you can still read the repository. Its files are never stored, cached or logged. Before diagrams from a private repository are added, you choose their titles and the project's name, because those are what people see if you share them.
Disconnect under Account deletes Flowgraph's tokens for Bitbucket. Bitbucket has no way for an app to withdraw its own access, so Account links you to Bitbucket's App authorizations page to remove Flowgraph Studio there too. A connection you don't use for three months stops working, and Flowgraph asks you to connect again. Account also shows what Flowgraph read in the last 90 days: which repository and commit, and how many files.
AI overviews (Pro and Pro Max)
In the scan result, Make overview has AI read the code and draw what the system is made of and how the parts connect. Make request flow follows its main request step by step as a sequence diagram. Each uses 5 AI credits, and an overview someone already made of the same public commit costs nothing. See AI architecture overview of a repository and AI request flow: trace a route through the code.
For a private repository, the first overview asks you to agree that excerpts of its code may be sent to Anthropic, our AI provider. Your answer is remembered for that repository, and you can withdraw it under Account. Private overviews are never cached or shared with anyone else. For every repository, files that hold credentials are left out, and values that look like secrets are replaced before anything is sent.
Link to it from your README
A link such as https://flowgraph.studio/bitbucket/workspace/repository opens the import with the repository filled in; add /src/branch/folder for one folder. The scan result has an Open in Flowgraph badge to copy into the README:
[](https://flowgraph.studio/bitbucket/workspace/repository)
Keep it up to date
Open a diagram, choose From Bitbucket in the editor's top bar, then Refresh from Bitbucket. Flowgraph reads the latest commit of the same branch, draws the diagram again from the same files, and shows what changed side by side. Replace the diagram, with the earlier one kept in version history, or add the new drawing beside it. Refreshing is free. From Bitbucket also lists the files each diagram came from, linked to Bitbucket at that commit.
Only Bitbucket Cloud (bitbucket.org) is supported for now. Repositories on Bitbucket Data Center can't be imported yet.
See also GitLab, Azure DevOps and Keep architecture diagrams up to date.
More guides
- Edit Mermaid diagrams visually in VS CodeDrag, connect and restyle a Mermaid diagram on Flowgraph's canvas inside VS Code, and every change is written back into the .mmd file or Markdown block as ordinary code.
- Keep a diagram's style in its code with %% flowgraph-themeOne comment line keeps a Mermaid diagram's Flowgraph theme in the file, so it looks the same in your repository, in VS Code, from the CLI and through the render API.
- Preview Flowgraph diagrams in VS Code, with icons, layout and your themeInstall the Flowgraph Studio extension to preview Mermaid files and Markdown blocks in VS Code as Flowgraph draws them, see mistakes in plain words, and export SVG or PNG.