Skip to content

Django Orm Lens

Django ER diagrams, N+1 detection, schema drift & migration-risk linting, in VS Code, a CLI and an MCP server. Static analysis: no database, no django.setup(). Free & MIT.

Install: uvx django-orm-lens scan -f table

Works with Cursor · 89 GitHub stars

Install

$uvx django-orm-lens scan -f table

Install command taken from the project's README or registry entry. Always review code before running it.

English · Русский · Español · 中文

Django ORM Lens

ER diagrams, N+1 detection and migration-risk checks for Django — without booting it.

Your entire model graph — live in your editor sidebar, gating your CI, and answering your AI agent over MCP. All from static parsing: no database, no runserver, no working venv.

Replaces: graph_models + django-schema-graph + hand-drawn ER diagrams + grep archaeology.

Featured in Django News #347 · PyCoder's Weekly #746


⚡ 10 seconds to first insight

uvx django-orm-lens scan -f table   # every app and model at a glance
uvx django-orm-lens nplusone        # N+1 loops, with the select_related to add
uvx django-orm-lens migration-risk  # migrations that lock tables or fail on existing rows

Cold clone, broken venv, no settings module — you still see every app and model of the project, then the N+1 loops and risky migrations in it, right in your terminal. (uvx is from uv; pipx run works the same way.)

Then pick your surface — three distributions, one parser core:

You are Install You get
Editor user — VS Code / Cursor / Windsurf / VSCodium code --install-extension frowningdev.django-orm-lens Field autocomplete in .filter(), sidebar tree, live ER diagram, hover cards, 18 lint rules with QuickFixes
Terminal / CI user pip install django-orm-lens 17 subcommands, SARIF + PR annotations, pre-commit hooks, a GitHub Action
AI-agent user — Cursor / Claude Code / Aider / Zed / Continue pip install "django-orm-lens[mcp]" 13 read-only MCP tools answering schema questions from ground truth

MCP setup is one JSON block — see Integrations. Point DJANGO_ORM_LENS_ROOT at your Django project's absolute path.


🆓 Paid-tier capabilities, free and MIT

Schema review is a paid category nearly everywhere. A bot that reviews every pull request, analysis that follows a queryset past the function it was built in, a check that catches schema drift, index advice grounded in real table statistics — those normally sit behind a per-seat or per-database subscription.

All of it is here, MIT-licensed, with no tier gate, no seat count, no account, and no telemetry:

Capability usually sold as a paid tier Here
PR review bot for schema changes — posts once, then updates in place blast-radius + the Action
Analysis that follows a queryset across functions nplusone
Schema drift detection drift
Index proposals from observed QuerySet usage suggest-indexes
Migration risk weighed against real table sizes blast-radius --stats
Blast radius of a destructive migration blast-radius
Cross-layer impact of removing a field impact

There is no Pro tier, and none is planned. If the tool saves you an afternoon, a star is the entire ask.


📊 Traction

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

MCP serverDatabases+105 this week

Explore related