109
This is a local-first Command Line Interface (CLI) tool designed to help developers understand FastAPI codebases. It scans a FastAPI project, identifies all API routes, constructs call chains with associated confidence scores, and presents this information through an interactive dashboard. Notably, it operates without relying on any Large Language Models (LLMs), tokens, or external services, ensuring a fully deterministic and private analysis.
Comprehensive Analysis: Detects API routes defined with decorators like @app.get(), @router.post(), and @app.api_route(). It also parses APIRouter definitions and app.include_router() calls, including nested routers.
Detailed Call Graph: Visualizes function call chains and dependencies using an interactive node graph built with @xyflow/react. It provides confidence levels for each step in the chain.
Interactive Dashboard: Offers a user-friendly interface with a route list (searchable, filterable by HTTP method and tag), a call graph, an inspector for route and function details, and a code viewer with syntax highlighting (Prism.js).
Static Analysis: Employs AST parsing to analyze Python code without executing it, ensuring safety and determinism. It uses only Python's standard library for scanning.
Local-First Operation: All analysis and dashboard functionalities run locally, requiring no internet connection after initial setup (via npx).
Production-Ready Dashboard: The dashboard is a pre-built Next.js application, ensuring a fast and secure user experience without exposing source files or requiring a development server.
Detailed Insights: Provides information on request/response models, dependencies (like Depends()), security utilities, return types, raised exceptions, cyclomatic complexity, and Markov chain similarity between routes.
Node.js 18+
Python 3.10+ (standard library only)
Use the following commands:
To scan a project: npx api-understanding scan /path/to/your-fastapi-project
To view the analysis: npx api-understanding dashboard analysis.json
To run a demo: npx api-understanding demo
Built with