Draw a GitHub repository's architecture from its own files
Turn a public GitHub repository's Compose files, Kubernetes manifests, Terraform, OpenAPI descriptions, CI workflows, SQL migrations, and workspace packages into editable diagrams, get an AI overview of its architecture and its main request flow, and check each one against the files it came from.
A repository already describes much of its own structure. Docker Compose lists the services and what they depend on, and Kubernetes manifests what runs in the cluster and how traffic reaches it. GitHub Actions workflows list the jobs and their order. SQL migrations build the data model one change at a time. A monorepo's package.json names its packages. Flowgraph Studio reads those files and draws them, so the diagram starts from what the code says rather than from memory.
This guide uses GitHub. The same import works for GitLab, Bitbucket and Azure DevOps, private repositories included; their guides cover what differs.
Import a repository
Open Flowgraph Studio and choose Import repository. Paste the repository's address, such as github.com/owner/repository, and choose Scan repository.

For a large repository, scan one folder: add /tree/branch/folder to the address, exactly as GitHub shows it when you open that folder. Branch names that contain a slash, such as feature/login, work too.
The scan lists what it found, for example:
- Services from
docker-compose.yml - Kubernetes from the manifests in
k8s/ - Infrastructure from the Terraform in
infra/ - Endpoints from
openapi.yaml - GitHub Actions pipeline from
.github/workflows/ - Data model from the SQL migrations in
db/migrations/ - 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, an approximate Call map of a folder or a file, and a Function flowchart of any function you choose.

Tick the ones you want. They go into a new project named after the repository, ready to edit, style, and export like any other diagram.
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.
Private repositories (Pro and Pro Max)
Connect GitHub under Account → GitHub repositories, or from Connect GitHub in the import dialog. GitHub asks you to allow the Flowgraph Studio app and to choose which repositories it may read: all of yours, or only some. The app can only read; it can't change anything.
Your repositories then appear on the GitHub tab under Your repositories in the import dialog, newest first. Pick one, or paste its address as you would a public one. The diagrams are drawn the same way, and each is marked Private in From GitHub, with Refresh from GitHub reading the latest commit through the same connection.
GitHub checks on every read that the app was given the repository and that you can still read it. If you lose access, or remove the app on GitHub, Flowgraph says it no longer has access, and the diagrams you made stay. Choose repositories on GitHub changes what the app may read at any time, and Disconnect under Account withdraws its access. Account also shows what Flowgraph read in the last 90 days: which repository and commit, and how many files.
A diagram made from a private repository can be shared like any other, after you confirm once that you mean to. Shared links and images show the diagram and its title, never its record of where it came from (repository, commit, and files). The import names diagrams and projects after the repository and its files, so rename them before sharing if those names are private too.
Link to it from your README
A link of the form https://flowgraph.studio/github/owner/repository opens Flowgraph with the import already filled in for that repository; add /tree/branch/folder for one folder. The scan result has an Open in Flowgraph badge to copy into the repository's README:
[](https://flowgraph.studio/github/owner/repository)
Nothing is read from GitHub until the person who follows the link chooses Scan repository.
What each diagram shows
Services. Each Compose service becomes a node with an icon chosen from its image (postgres:16 gets the PostgreSQL logo) and its image and published ports underneath. depends_on and links become arrows. Named volumes are drawn as cylinders; bind mounts such as ./src:/app are left out. When services are split across networks, each network becomes a group.

Kubernetes. Manifests in folders such as k8s/, kubernetes/, manifests/, deploy/ or argocd/, and files named for what they hold (deployment.yaml, service.yaml, ingress.yaml), are drawn together, one diagram for each such folder. Ingresses and HTTPRoutes point to the Services they route to, labelled with the path. Each Service points to the Deployments, StatefulSets, DaemonSets, Jobs, CronJobs or Pods its selector matches. A workload with an environment variable that holds another Service's address (DATABASE_URL=postgres://postgres:5432/shop, or orders.billing.svc.cluster.local) gets a dashed arrow to that Service; only the host part of an address counts. Each workload shows its kind, its image, and its replicas or autoscaling range, with an icon from the image where there is one. The ConfigMaps, Secrets and volume claims it uses hang off it; only their names are drawn, never a Secret's values. Namespaces become groups when there are several.
Kustomize overlays (overlays/) are left out, since they patch the base rather than describe the system. Helm charts aren't drawn, because their templates need values to render.
Endpoints. An OpenAPI 3 or Swagger 2.0 description (openapi.yaml, swagger.json, api-docs.yml, orders.openapi.yaml) becomes an endpoint map. The API's node shows its title, version, first server, and how it is secured (OAuth2, API key, Bearer). Its paths are grouped by tag, or by their first segment when they have no tag, and each path has a badge for every method it answers, with its summary underneath. Paths described in other files of the repository ($ref: paths/orders.yaml) are read too. An API with more than 40 paths is drawn one node per group instead, with how many paths and operations of each method it has. Descriptions in test, fixture, and example folders are left out.
Infrastructure. Each folder of Terraform files (.tf) is drawn as one diagram: a node for each resource and module call, with an icon for the service it creates (an S3 bucket, a Lambda function, a Cloud Run service, an Azure key vault, and many more), and an arrow wherever one refers to another, such as a function that uses a role's ARN or a module's output. Only references in the configuration count, including those inside ${…} in strings and heredocs; a name mentioned in a description doesn't. Resources that only connect others, such as policy attachments, security group rules, and random IDs, are left out and counted in the summary. count and for_each show as a badge. With resources from several providers, each provider is a group. The six folders nearest the top are drawn; examples, tests, and .terraform/ are left out.
GitHub Actions pipeline. Each workflow is a group that starts from its triggers (push, pull request, schedule). Every job is a node showing its runner, or the reusable workflow it calls, and a badge when it runs as a matrix. needs: becomes arrows between jobs, and a workflow started by another one (workflow_run) gets an arrow from it.
Data model. A schema dump (schema.sql, structure.sql) is drawn when there is one. Otherwise the migrations are replayed in order, so the ER diagram shows the schema as it is now: columns added later are there, and dropped or renamed tables are not. Down migrations are skipped. If a migration contains a change the importer can't read, the scan says which file and line, because the diagram may then be out of date.
A Prisma schema (prisma/schema.prisma, or the files of a multi-file schema in prisma/schema/) is drawn as its own ER diagram, with the models' names: @id and @unique fields become keys, each @relation becomes a relationship (one-to-one when its fields are unique), and lists on both sides become a many-to-many line. Prisma's own prisma/migrations folder isn't drawn as well, since it describes the same tables.
Package map. npm, pnpm, and Yarn workspaces become one node per package, with arrows for the dependencies between them. Development-only dependencies are dashed. Packages from outside the repository are left out.
From the code
The diagrams above come from configuration. Those under From the code come from the source code itself, with no AI, and the same commit always gives the same diagram. They read far more files, so the scan only offers them, with a line such as "214 files in 18 folders, code mostly in TypeScript" from the file list; their files are read when you choose Draw. At most 2,000 files and 25 MB are read, and no file over 400 KB, and the result says what was left out.
The code is read as one download of the commit where the host allows it. GitLab and Azure DevOps send it to your browser directly. GitHub and Bitbucket don't let a browser download it from another site, so when you are signed in, Flowgraph's server passes the download through to your browser as it arrives (at most 50 MB), without keeping or logging it. Signed out, or if the download fails, the files are read one by one, as for the scan. Private repositories are read one by one through your connection, as always.
A folder on your computer. The import dialog also takes a folder: choose Choose a folder, or drop one on the dialog. Your browser reads it and nothing is uploaded, and you get the same diagrams as from a repository, configuration and code alike. It counts as one of Free's 3 repositories, by the folder's name. Its diagrams show From your computer in the editor; Refresh from the folder asks you to pick the same folder again, draws it as it is now and shows what changed, and counts as a refresh.
From the command line. flowgraph-cli draws the same code diagrams from a folder on disk, for scripts and CI: npx flowgraph-cli code deps --out deps.mmd. It needs no account and makes no network request, and gives the same Mermaid as the app for the same files. See drawing diagrams from the code in CI.
Codebase map. The repository's folders, drawn from left to right. Each folder says what it holds, from its name and files (routes, models, migrations, components, tests, commands, documentation), or the package it is when it has a manifest such as package.json, pyproject.toml, go.mod or Cargo.toml, with its files and lines of code and its main language. Files where programs start are marked: main files, index, app and server at the top of a package, and what the manifest names (main, bin, scripts). Top-level folders that are opened up are drawn as boxes. A large repository is shown to about 50 folders: the largest are opened first, and the rest are counted in the folders that hold them, so choose one of the folders listed under the map to scan it in more detail.
Module dependencies. Which files import which, for TypeScript, JavaScript (with JSX), Python, Java, Go and C#. Your browser parses each file with Tree-sitter, in the background, and follows its imports to files in the repository: relative paths, index files and extensions (including .js written for a .ts file), paths and baseUrl from tsconfig.json or jsconfig.json, workspace packages by name and their exports, and in Python absolute and relative imports, packages with or without __init__.py, and src/ layouts, in Java single, wildcard and static imports, by each file's package below src/main/java (one in each Maven or Gradle module), and in Go packages by their module path from each go.mod (with replace lines that point to a folder, and the modules of a go.work workspace). Go is drawn by package, its folder, rather than by file, since a Go import names a package; Go's standard library is counted apart. Java classes use their own package's classes without importing them, so those uses aren't drawn. A C# using brings in a namespace rather than a file, so a C# file is linked to the files declaring the types it names, in its namespace, those around it and those its usings bring in; projects come from the .csproj files (named as the .sln names them), each seeing only the projects it references, and several projects are drawn whole. Up to 30 files are drawn one by one; more are drawn by folder, as deep as fits, with the number of imports on each arrow, and a workspace package stays one node. Circular imports are drawn as dotted arrows marked "circular" and named in the notes. Imports from outside packages (npm, PyPI, Go modules, NuGet) are counted, not drawn, and .NET's own namespaces apart. Imports whose module is worked out when the code runs (import(name), require(variable), importlib, Java's Class.forName) can't be followed and are counted, as are test files, which are left out. A file that takes too long to parse is skipped and named. The parser and its grammars come from Flowgraph's own site, and each grammar is downloaded only when the code has that language.
Class diagrams. The classes, interfaces, abstract classes and enums in TypeScript, JavaScript, Python, Java, Go and C# (with C#'s structs, records and partial classes, drawn as one), TypeScript types that describe objects, and Java records, as Mermaid class diagrams you can edit in Manual mode and compare like any other. Each shows its fields and methods with their visibility (private, protected, #private, Python's _name and __name, and ~ for Java's package-private members), and types where the code gives them: TypeScript's and Java's types, and Python's type hints, with a note saying how many are missing. Arrows show what each class extends and implements, and which classes it uses through its field types (solid) and parameter types (dashed). Names are matched across files through the imports, as for module dependencies, so a class imported from ../models points to the right one. Classes from packages, or from other folders, are drawn as empty boxes, and interfaces from outside as circles on the class. Choose Draw for one diagram, or One per folder for one diagram for each folder. A diagram shows up to 25 classes with their fields and methods; more are drawn without them, and more than 40 are split by folder, each folder its own diagram. Classes with many members show 10, private ones left out first. Classes inside functions, and test files, are left out, and the notes say so. In Go, structs and interfaces are drawn with the methods declared on them in any file of their package, exported names as public and the rest private, embedded fields as composition, constants of a named type (iota) as an enum, and a struct as implementing an interface of the same diagram when it declares each of its methods by name, since Go never says so; parameters aren't compared. In C#, names are matched through the namespaces in scope, classes are grouped by namespace, properties and events are fields, and internal is ~.
Route map. Each endpoint, page and command the code declares, and the function that handles it. It is offered when package.json, pyproject.toml, a requirements file, pom.xml, build.gradle or a file name shows a framework it reads: Express, Hono, Fastify, Koa, NestJS, Next.js (the app and pages routers, with API routes) and Remix routes, FastAPI, Flask and Django (urls.py), Spring's and JAX-RS's annotations (under a class's own path), commands from Commander, Click and Typer, with Cloudflare Workers' scheduled and queue handlers, and in Go net/http's ServeMux (with Go 1.22 patterns such as GET /items/{id}), Gin, Echo and chi, known from go.mod, or a main.go for net/http, and ASP.NET Core, known from a .csproj with the web SDK: controllers' [Route] and [HttpGet] attributes (with the [controller] and [action] tokens), and minimal APIs' MapGet and the like, with MapGroup prefixes and extension methods that map a group, and [Authorize] or RequireAuthorization() as badges. Go's groups (Group("/v1", auth)), chi's Route, Mount and With, and http.StripPrefix are followed with their prefixes, and Use and a group's middleware show as badges. Routes are grouped by the file that declares them; a handler in another file, such as a controller, gets an arrow to it, and one in the same file is named on the route. Routers mounted in others are followed with their prefixes where the code says so plainly (app.use('/v1', router), app.route('/api', api), register(plugin, { prefix }), include_router(prefix=…), blueprints' url_prefix, Django's include()), and a prefix worked out when the code runs is shown as "…". Middleware and guards named on a route, its router or where the router is mounted show as badges, as do Java's @PreAuthorize, @Secured and @RolesAllowed; in Java, paths built from string constants are followed; middleware the whole app uses is named in the notes instead. Routes made when the code runs, in a loop or from a list, can't be found, and the notes say how many files were read, which frameworks were recognised and what couldn't be followed. If the repository has an OpenAPI description, the notes compare the two: routes in the code that it leaves out, and operations in it that weren't found in the code. A large app is drawn with plain labels, and a very large one by file, with how many routes of each method, so the diagram stays readable.
Function flowchart. One function's logic, for TypeScript, JavaScript, Python, Java, Go and C#. Choose a file of the scan: only that file is read, and its outline lists its functions, methods, classes with their methods, and arrow functions given a name (in Java, constructors and lambdas assigned to fields too). Choose one to draw it: its start, each statement or call as a step, if/else, switch, match and ternaries that stand for statements as decisions, loops with the arrow back to their start, try/catch/finally, early returns, break and continue, and thrown errors as ends of their own (or dotted arrows to the catch that takes them). await and yield show in their steps. In Go, if with its init statement, switch, type switches and select are decisions (a case falls through only with fallthrough), for in every form is a loop, defer and go are steps, panic is a thrown error, and goto is an arrow to its label. Four or more plain statements in a row are one step ("5 statements"). A function over 500 lines, with branches and loops more than 6 deep, or with more than 60 steps even when grouped, isn't drawn: the outline says why. Refresh finds the function again by its name, class and kind, so moved lines don't matter, and says so when it is gone. Steps that call a function of the same repository (in the same file, a method of the same class, or a resolved import) are listed under From GitHub: Draw its flowchart adds that function's flowchart to the project and links the step to it, so its badge opens it and Back returns. Any code diagram's From GitHub can draw a function of one of its files the same way. In C#, the outline lists methods, constructors, property accessors and local functions; switch expressions that are returned or assigned are decisions, and using and lock blocks are steps with their body after them.
Call map. Which function calls which, in the folder scanned or in one file, for TypeScript, JavaScript, Python, Java, Go and C#. It is approximate, and says so on the diagram itself: calls are found by name, so calls through interfaces, callbacks and events aren't shown. A call is drawn when it can be matched: a function of the same file, a method of the same class through this or self, a class's constructor, or a function imported from a file of the map (followed through files that pass names on, such as an index.ts or a package's __init__.py). In Go, also a function of the same package or of an imported one, and a method on the caller's own receiver. Everything else is counted on each function as "not matched", never guessed: methods on other objects, callbacks and parameters, packages, and calls worked out when the code runs. Calls of the language's own functions and methods (print, len, map, push) aren't counted. Functions are grouped by file and class; a call made more than once is one arrow with its count ("×3"); recursion and loops are drawn as they are, and named in the notes. Rounded boxes are entry points: exported functions, and functions nothing in the map calls. One file's map draws the functions it imports as boxes of their own files, with dotted arrows. A map shows up to 40 boxes. Over that, functions with no matched calls are left out first. One file's map keeps open the class the file is about (named like the file, as Ky in Ky.ts; else its default export; else its largest) and groups the rest: helpers into boxes such as "7 helpers of buildRequest()", named after the function that calls them; then other classes, one box each; then the main class's private methods, then its methods called from one place. Entry points always stay open. Over 60 arrows, its calls into other files are counted on each box instead of drawn. A folder's map draws classes as one box each, then groups helpers. If it still doesn't fit, it isn't drawn, and the result suggests a smaller folder, one file or a function's flowchart. A folder of more than 80 source files is refused before anything is read, with smaller folders to scan. Test files are left out of a folder's map. Under From GitHub, each function of a map can draw its flowchart, linked from its box, and any code diagram can draw a call map of its folder or of one of its files.
AI architecture overview (Pro and Pro Max)
Configuration only shows the structure it spells out. The AI architecture overview reads the code itself: the folder outline, the README, manifests and configuration, and the start of the main source files. From those it draws what the system is made of and how the parts connect: the apps people use, the services, background jobs, databases, queues, and outside services such as a payment provider or an email API.
Choose Make overview in the scan result. It takes up to a minute and uses 5 of your plan's AI credits. If someone has already made an overview of the same commit and folder, you get that one at once, and it isn't counted. AI architecture overview of a repository covers what it reads, caching and what to do when it fails.
When the code is in TypeScript, JavaScript, Python, Java, Go or C#, your browser first reads its structure, as for the module dependencies and the route map: which files import which, and the routes with their handlers. Only those names are sent with the request, never the code. Flowgraph then reads the files that matter most, where the program starts and the files most others import, instead of choosing by name, and tells the AI the real imports and routes. It reads no more of the code than before. For other languages, or when the code can't be read, the files are chosen by name as before.
AI request flow
The AI request flow follows the system's main request, such as placing an order or signing in, through the code, and draws it as a sequence diagram: who calls whom, in order, with each step numbered. Calls that wait for an answer, the answers, and messages sent without waiting (a queue message or an event) each have their own arrow. Choose Make request flow in the scan result. It costs the same as the architecture overview and is cached the same way. You can make both and add them together.
When the code uses a framework the route map reads, choose Choose a route under the request flow to pick which route it traces, from the routes found in the code (for example POST /orders). The AI then reads that route's handler and what it imports first, and traces that request. Without a choice, it traces the main request it finds. See 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 → GitHub repositories. Private overviews are never cached or shared with anyone else.
Before anything is sent, for public and private repositories alike, files that hold credentials (.env files, keys, certificates, credential files) are left out, and values that look like secrets (cloud access keys, tokens, private keys, written-out passwords) are replaced with [removed].
Each part of an overview or request flow lists the files it was read from. Open a diagram made this way and choose the From GitHub button in the top bar to see each part's files, linked to GitHub at that commit, and what the AI couldn't see, such as folders that weren't read. Regenerate makes a new one of the same kind from the branch's latest commit, as a new diagram beside the earlier one, and uses 5 AI credits.
Check the diagram against its source
A generated diagram is a starting point, not a verdict. Before you use it in a design review:
- Compare it with what runs in production. Compose files often describe local development, with an extra database or mail catcher that production doesn't have.
- Look for what the files can't say. A service may call another over HTTP without any
depends_online, so that arrow is missing until you add it. - Read the notes in the scan result. They say what was left out and why: files over 1 MB, files stored with Git LFS, or more workflows or packages than one diagram shows.

- For an AI overview, open the files each part lists. The AI describes only what the files it read show, so it can miss a part or misread how two parts connect.
Each diagram keeps the repository, branch, commit, and files it came from, so anyone reading it later can see what it was drawn from: choose From GitHub in the editor's top bar.
Keep it up to date
When the repository changes, choose From GitHub, then Refresh from GitHub. Flowgraph reads the latest commit of the same branch and draws the diagram again with the same files. If nothing changed, it says the diagram is up to date. Otherwise it shows the diagram now and the new drawing side by side, with every change marked, and you choose:
- Replace this diagram: the new drawing takes its place. If you're signed in, the diagram as it was goes into version history first, and
Ctrl+Zundoes the refresh too. If you changed the diagram since it was made, replacing it replaces your changes, so the panel says so first. - Add as a new diagram: the new drawing goes beside the old one, which stays as it is.
Each refresh counts toward Free's 50 a month (Pro and Pro Max have no limit) and, like the import, your browser reads the repository straight from GitHub. AI overviews aren't refreshed; Regenerate makes a new one instead.
Privacy
Your browser reads a public repository straight from GitHub. The files are not sent to Flowgraph, which keeps only the diagrams you add and where they came from.
A private repository is read by Flowgraph's server, with your own GitHub connection, and handed straight to your browser to draw. Its files are never stored, cached, or written to logs; Flowgraph keeps only the diagrams you add, and your GitHub connection (encrypted) until you disconnect.
An AI overview is the exception: Flowgraph's server reads the repository from GitHub and sends excerpts of it to Anthropic, which writes the overview. The overview is kept for 30 days for that public commit, so the next person to ask gets the same one; the repository's files aren't kept.
GitHub limits how often one network can read repositories without signing in. A scan uses only a few of those requests, but if many people share your network's address, the limit can run out; the scan then says when you can try again.
For more about the diagrams themselves, see Convert SQL to an ER diagram 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.