The scenario
You join a team with a FastAPI or Django backend. You want to know where login issues a token, which views read the blog model, and what breaks if you change a dependency. You want answers that cite files and lines, not a guess from your agent.What you’ll build
- A local code graph of the backend in
graphify-out/, with no API key and no model. - A
.graphifyignorethat keeps tests and generated migrations out of the first graph. - A set of
query,pathandexplaincommands you can reuse on your own app.
Setup
uvorpipx. See Installation.- A FastAPI or Django repository. To follow along exactly, clone the two used here:
Step 1: Install Graphify CLI
Step 2: Keep tests and migrations out of the first graph
Test files touch every model, so on a well tested app they crowd the top of every answer. On djangoproject.com, the first result for “how are blog entries published” was a test docstring. Add a.graphifyignore at the scan root:
- FastAPI
- Django
.graphifyignore
blog/models.py, blog/admin.py and blog/feeds.py. Remove the lines again when you want the graph to answer questions about the tests. See Ignoring files for the full syntax.
If you keep migrations in the graph, Graphify still drops the module docstrings that Django and Alembic write at the top of each migration file, so change notes don’t show up as design rationale. Docstrings on functions inside a migration are kept.
Step 3: Build the graph
Run this in the backend folder.--code-only parses code locally and skips docs, so nothing is sent to a model:
Both runs used 8 workers. For scale, the same command on the Django framework source (3,141 files at
0eae0b2) built 54,883 nodes and 131,242 edges in 57 seconds.
Step 4: Ask questions about a FastAPI app
Find where login creates a token.query takes a plain English question and starts from the names it matches:
path:
explain:
Step 5: Ask questions about a Django app
Find everything that reads the blogEntry model:
EXTRACTED edges are read straight from the source. INFERRED edges come from resolving names across files, so open the cited line before you rely on one.
How framework wiring shows up
Graphify links functions, classes, calls, imports and inheritance. Wiring that lives in module level code, outside any function, is linked through the file rather than with a direct edge:- FastAPI dependencies. An alias like
CurrentUser = Annotated[User, Depends(get_current_user)]has no edge toget_current_user. A route that uses it reaches the dependency through its file:read_items() <-- items.py --> deps.py --> get_current_user(). - FastAPI routers.
api_router.include_router(login.router)inapp/api/main.pyadds no call edges.explain "app/api/main.py"still lists every routes file it imports. - Django URLs.
urlpatternsentries don’t point at their views.path "blog/urls.py" "BlogDateDetailView"goes throughblog/views.py.
explain on the dependency or the urls.py file, or run path between the route and the dependency. Both answer from the import edges.
Keep the graph fresh
After you change code, update the graph. It reparses only what changed and needs no model:graphify hook install. See Keep the graph current.
How accurate are the cross-file edges?
The graph on the Graphify CLI README is the FastAPI library itself, built from code only. The maintainers audited everyINFERRED cross-file edge whose two ends both sit in the fastapi/ package, on a fresh build on 5 October 2026, and all 12 were correct. It’s a dated spot check on one codebase, not a running metric, and results vary by codebase. The method is in BENCHMARKS.md.
FAQ
Does Graphify support FastAPI and Django?
Does Graphify support FastAPI and Django?
Yes. Both are Python, and Graphify CLI parses them with its Python extractor. Routes, dependencies, models, views, admin classes and template tags all become nodes you can query.
Does it work for Flask or other Python frameworks?
Does it work for Flask or other Python frameworks?
Any Python web app is parsed the same way. This page only shows runs on FastAPI and Django apps.
Do I need an API key?
Do I need an API key?
No.
graphify extract . --code-only parses code locally. A model is only used for docs, papers and images.My app has a TypeScript frontend too. Does that work?
My app has a TypeScript frontend too. Does that work?
Yes. Run Graphify at the repository root and it parses the Python backend and the JavaScript or TypeScript frontend into one graph. See Supported inputs.
Next steps
Ask better graph questions
Pick query, path or explain for each kind of question.
Plan a safe refactor
List every caller and the tests to run before you change code.
Start free with Graphify
We build and host the graph for you, keep it current on every push, and add Memory, the Wiki and pull request reviews on top.