Skip to main content
Back to packages
90 GitHub stars

albertoarena/laravel-truss

View on GitHub

Description

A live database structure viewer for Laravel that renders your schema as a scrollable, zoomable ER diagram. Structure only, never data.

Laravel Truss is a live database structure viewer. It scans your live schema and renders it as a scrollable, zoomable ER diagram right inside your app, so you can see how the tables actually connect without opening a DB client. It reads structure only (tables, columns, keys, indexes); row data is never queried or exposed.

Features

  • Live ER diagram of your database, rendered with Mermaid.
  • Focus mode: a table and its foreign-key neighbours, centred and highlighted.
  • Filter by table name, and toggle native types against Laravel-style labels.
  • Map-style pan and zoom, with auto-fit and a Fit button.
  • Export the diagram as PNG or SVG, or its structure as JSON, CSV, a Markdown data dictionary, DBML, or a token-trimmed llm format, from the browser or, for CI and tooling, from the command line with php artisan truss:export. Structure-only and deterministic.
  • Feed your real, live structure to a coding agent as grounding context: annotate it with business meaning, trim it with --compact, and narrow it with --focus, so the agent stops inventing columns. Structure only, never row data.
  • Schema diff: see what changed since your last migration, in a dashboard "Changes" panel and via php artisan truss:diff. Structure-only, added / removed / changed tables, columns, indexes, and foreign keys.
  • Schema doctor: review your structure for problems (missing primary keys, unindexed foreign keys, duplicate indexes, risky types) in the terminal or in CI with php artisan truss:doctor, and in a dashboard "Health" panel that flags the same problems on the diagram. Deterministic and structure-only, no AI.
  • Multiple connections: list them in config and switch between their diagrams with a toolbar picker, each scoped to its own database.
  • Light and dark "blueprint" theme, or bring your own: define custom colours and fonts from config to match your app. Config driven, CSP-safe, no build step.
  • Self-contained: Mermaid and fonts are vendored and served from the package, so it works offline and under a strict Content-Security-Policy (no CDN).
  • Cached snapshot, rebuilt automatically after migrations.

Recent Courses on Laravel Daily