Skip to main content

Interactive schema visualization for Django projects — React Flow + force-directed layout

Project description

django-schematic

Latest on Django Packages PyPI version PyPI downloads Python versions License Python Tests UI Tests TypeScript React Vite React Flow d3-force dagre ELK

Interactive schema visualization for Django projects.

See all your models, fields, and relationships as an interactive, force-directed graph — directly in your browser. Zero Node.js required at runtime.

Features

  • Force-directed layout with physics settle animation (drag-to-pin support)
  • Hierarchical layout via dagre
  • Click to expand/collapse field lists per model
  • App-based color coding
  • Show/hide models and apps via sidebar
  • Export/import view state as JSON
  • Export diagram as PNG
  • Clean JSON API endpoint (GET /schema/api/)
  • Django 5.x + Python 3.12+ only

Visualize

output

Frontend Stack

Aspect Technology
Framework React 18
Language TypeScript
Graph Visualization React Flow (@xyflow/react 12)
Layout Engines d3-force + dagre + ELK (3 options)
UI / Styling TailwindCSS 4
State Management Zustand 5
Bundler Vite 6
Type Safety Full TypeScript
Testing Vitest + ESLint
CDN Dependencies None (all bundled)
Package Manager npm

Exported PNG file with embedded config data

This is an example output PNG file, that can be re-imported into django-schematic

output

Quick Start

pip install django-schematic

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "schematic",
]

Add to urls.py:

from django.urls import include, path

urlpatterns = [
    ...
    path("schema/", include("schematic.urls")),
]

Visit http://localhost:8000/schema/ — your model graph will be there.

Security

The viewer is only accessible when DEBUG = True. In production (DEBUG = False) both the HTML view and the API return 404, making the URL appear non-existent.

To expose the viewer in production behind your own auth layer, set the visible option to a callable:

SCHEMATIC = {
    "visible": lambda request: request.user.is_staff,
}

Configuration

# settings.py (all optional — these are the defaults)
SCHEMATIC = {
    "visible": lambda request: settings.DEBUG,  # or any callable, or True/False
    "include_apps": [],           # empty = all apps
    "exclude_apps": ["admin", "contenttypes", "sessions", "auth"],
    "exclude_models": {},         # {"myapp": ["InternalModel"]}
    "include_abstract": False,
    "include_proxy": True,
}

API

The schema is also available as JSON:

GET /schema/api/
GET /schema/api/?apps=myapp,otherapp

Development

# Backend
pip install -e ".[dev]"
pytest

# Frontend
cd ui
npm install
npm run dev   # Vite dev server with HMR
npm run build # Outputs to schematic/static/schematic/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_schematic-1.3.4.tar.gz (602.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_schematic-1.3.4-py3-none-any.whl (606.9 kB view details)

Uploaded Python 3

File details

Details for the file django_schematic-1.3.4.tar.gz.

File metadata

  • Download URL: django_schematic-1.3.4.tar.gz
  • Upload date:
  • Size: 602.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_schematic-1.3.4.tar.gz
Algorithm Hash digest
SHA256 9850b0d1a316d73fbbe1a4bd2cc6b4ef1b30a96efc7a13e59de2a4c8730ae4bd
MD5 9082468807ba4e1ba452e0489e298523
BLAKE2b-256 2ca394cd21a49a8500c6af96bcf8b1fa0769dd390e20aa193633ec1ef4e107ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_schematic-1.3.4.tar.gz:

Publisher: release.yml on jsheffie/django-schematic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_schematic-1.3.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_schematic-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a9ff3db981f9944d24a27e00ffeeec7bcf0aed01a579a83e68d3a437d35fcb30
MD5 70c7bcad4f9d98d003081106584d7d9b
BLAKE2b-256 98366d4c75b87b6448f7b7e8809faa0a80895c29ab23dd8d663c7a8e38501c6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_schematic-1.3.4-py3-none-any.whl:

Publisher: release.yml on jsheffie/django-schematic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page