I built a tool to visualize Django REST Framework architecture (URLs, serializers, models, and more)
As Django REST Framework projects grow, one of the biggest challenges is understanding how everything is connected.
In my recent projects, I kept running into the same problem:
- Which view is using which serializer?
- How are models connected across the system?
- Where are potential N+1 or optimization issues?
- How does the API structure actually look as a whole?
I found myself constantly jumping between:
urls.pyviews.pyserializers.pymodels.py
At some point, it becomes hard to mentally map the entire architecture.
So I decided to experiment with building something to make DRF structure more visual and explorable.
π§ What I built
I created a Django package called:
DRF Inspector
It automatically analyzes a Django REST Framework project and provides a visual dashboard inside Django.
β¨ Features
π API Structure Visualization
- Lists all API endpoints
- Maps URLs β views
- Shows HTTP methods (GET, POST, etc.)
π§ Model Relationship Graph
- Visual graph of:
- ForeignKey
- ManyToManyField
- OneToOneField
- Helps understand DB structure instantly
π Serializer Inspection
- Detects serializers used in views
- Shows nested serializer relationships
- Maps serializer β model relationships
π§ View Analysis
- Authentication classes
- Permissions
- Pagination
- Throttling
β‘ Query Optimization Hints
- Detects potential N+1 query issues
- Suggests
select_related/prefetch_related
π¦ Export Options
- JSON export
- Markdown export
π Links
- PyPI: https://pypi.org/project/drf-inspector/
π₯οΈ How it works
After installing, it adds a dashboard inside your Django project.
β‘ Installation
Step 1: Install the package
pip install drf-inspector==0.1.4
Step 2: Add in settings.py:
installed_apps = [
drf_inspector,
....
]
Step 3: Add in project urls.py:
from django.urls import path, include
urlpatterns = [
...,
path("drf-inspector/",include("drf_inspector.urls")),
]
Final Step : Go to the url and that's it:
http://127.0.0.1:8000/drf-inspector/
Top comments (0)