This repo is still in early stage, currently it supports pydantic v2 only, previous name: fastapi-router-viz
Inspect your API interactively

- FastAPI
- pydantic-resolve
For scenarios of using FastAPI as internal API integration endpoints, fastapi-voyager helps to visualize the dependencies.
It is also an architecture inspection tool that can identify issues in data relationships through visualization during the design phase.
If the process of building the view model follows the ER model, the full potential of fastapi-voyager can be realized. It allows for quick identification of APIs that use entities, as well as which entities are used by a specific API
after initialization, pick tag, rotue (optional) and click generate.

click a node to highlight it's upperstream and downstream nodes. figure out the related models of one page, or homw many pages are related with one model.

shift click a node to check related node, pick a field to narrow the result.

alt click a node to show source code or open file in vscode.


alt click a route to show source code or open file in vscode

The tool will generate a DOT file that you can render using Graphviz:
or you can open router_viz.dot with vscode extension graphviz interactive preview
features
- group schemas by module hierarchy
- module-based coloring via Analytics(module_color={...})
- view in web browser
- config params
- make a explorer dashboard, provide list of routes, schemas, to make it easy to switch and search
- support programmatic usage
- better schema /router node appearance
- hide fields duplicated with parent's (show parent fields instead)
- refactor the frontend to vue, and tweak the build process
- find dependency based on picked schema and it's field.
- optimize static resource (cdn -> local)
- add configuration for highlight (optional)
- alt+click to show field details
- display source code of routes (including response_model)
- handle excluded field
- ui optimization
- fixed left/right bar show field information
- user can generate nodes/edges manually and connect to generated ones
- support dataclass
- group routes by module hierarchy
- display standard ER diagram
- display potential invalid links
- integration with pydantic-resolve
- show difference between resolve, post fields
- strikethrough for excluded fields
- display loader as edges
- add tests
bugs:
- fix duplicated link from class and parent class, it also break clicking highlight
pydantic-resolve's @ensure_subset decorator is helpful to pick fields from source class in safe.
TODO: ...
- https://apis.guru/graphql-voyager/, for inspiration.
- https://github.com/tintinweb/vscode-interactive-graphviz, for web visualization.