Laravel Truss: Live Interactive Database ER Diagrams | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com) [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles  ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://www.msaied.com) [ Projects ](https://www.msaied.com/projects) [ Articles ](https://www.msaied.com/articles) [ Certificates ](https://www.msaied.com/certificates) [ Contact ](https://www.msaied.com#contact-section) 

  [ home ](https://www.msaied.com)    [ articles ](https://www.msaied.com/articles)    Laravel Truss: Live Interactive Database ER Diagrams in the Browser        On this page       1. [  What Is Laravel Truss? ](#what-is-laravel-truss)
2. [  Interactive ER Diagram Dashboard ](#interactive-er-diagram-dashboard)
3. [  Multi-Connection Support ](#multi-connection-support)
4. [  Schema Diffing and Migration Tracking ](#schema-diffing-and-migration-tracking)
5. [  Schema Doctor Diagnostics ](#schema-doctor-diagnostics)
6. [  Command-Line Exports ](#command-line-exports)
7. [  Key Takeaways ](#key-takeaways)

  ![Laravel Truss: Live Interactive Database ER Diagrams in the Browser](https://cdn.msaied.com/535/ebe431c90e00cd4c8eeb10aafd42aebe.png)

 [  Laravel ](https://www.msaied.com/articles?category=laravel) [  Composer Pacakge ](https://www.msaied.com/articles?category=composer-pacakge)  #Laravel   #Database   #ER Diagram   #Schema   #Developer Tools  

 Laravel Truss: Live Interactive Database ER Diagrams in the Browser 
=====================================================================

     9 Aug 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   What Is Laravel Truss?  ](#what-is-laravel-truss)
2. [  02   Interactive ER Diagram Dashboard  ](#interactive-er-diagram-dashboard)
3. [  03   Multi-Connection Support  ](#multi-connection-support)
4. [  04   Schema Diffing and Migration Tracking  ](#schema-diffing-and-migration-tracking)
5. [  05   Schema Doctor Diagnostics  ](#schema-doctor-diagnostics)
6. [  06   Command-Line Exports  ](#command-line-exports)
7. [  07   Key Takeaways  ](#key-takeaways)

 What Is Laravel Truss?
----------------------

[Laravel Truss](https://github.com/albertoarena/laravel-truss) is a package by Alberto Arena that renders your database structure as a live, interactive entity-relationship diagram you can open at `/truss` in the browser. It reads schema metadata only — tables, columns, keys, and indexes — and never touches row data, so there is no risk of exposing sensitive records.

The package requires **PHP 8.3+** and **Laravel 12+**. Install it as a dev dependency for local use:

```bash
composer require albertoarena/laravel-truss --dev

```

By default the `/truss` route is active only in the `local` environment. Install it without `--dev` and configure an authorisation gate to expose it in staging or production.

---

Interactive ER Diagram Dashboard
--------------------------------

Visiting `/truss` opens a map-style canvas you can pan and zoom. Click any table to enter **Focus Mode**, which centres that table alongside its foreign-key neighbours and dims everything else. A Depth control widens the visible ring one hop at a time, so you can trace relationships without losing context.

Additional controls let you:

- Filter tables by name.
- Toggle between native SQL types and Laravel-style column labels.
- Switch between light and dark blueprint themes.

### Multi-Connection Support

If your application uses more than one database, list each connection in `config/truss.php`:

```php
// config/truss.php
'connections' => [
    'pgsql'     => [],
    'analytics' => ['excluded_tables' => ['page_views', 'raw_events']],
],

```

A toolbar picker appears when two or more connections are configured. Switching connections re-renders the schema and persists the selection in the URL so you can bookmark or share a specific view.

Because fonts and Mermaid assets ship with the package, the dashboard works **offline** and under strict **Content Security Policy** rules without fetching anything from a CDN.

---

Schema Diffing and Migration Tracking
-------------------------------------

Truss caches a structural snapshot after migrations run and compares the live database against it. The diff surfaces in a **Changes** panel in the dashboard and via Artisan:

```bash
php artisan truss:diff

```

The diff covers added or dropped tables, column type changes, index adjustments, and foreign key updates.

---

Schema Doctor Diagnostics
-------------------------

The **Schema Doctor** runs deterministic checks against your structure and flags:

- Tables with no primary key.
- Foreign key columns without an index.
- Duplicate or redundant index definitions.
- Risky data type choices.

Results appear in the dashboard's **Health** panel and can be piped into a CI pipeline:

```bash
php artisan truss:doctor

```

---

Command-Line Exports
--------------------

Truss can export the full schema structure from the terminal in multiple formats:

```bash
php artisan truss:export --format=dbml --output=docs/schema.dbml

```

Supported formats: **DBML, JSON, CSV, Mermaid, and Markdown** data dictionary. Output is deterministic — the same schema always produces the same bytes regardless of the order the database reports its tables. That makes the `--check` flag useful in CI: it regenerates the export, compares it against the committed file, and exits non-zero when they differ.

The browser dashboard also lets you export the visual diagram as **PNG or SVG**, and individual tables as JSON, CSV, or Markdown.

---

Key Takeaways
-------------

- Live, zoomable ER diagrams rendered with vendored Mermaid assets — no external GUI needed.
- Focus Mode isolates a table and its foreign-key neighbours with a configurable depth.
- Schema diffing tracks structural changes since the last migration snapshot.
- Schema Doctor catches missing primary keys, unindexed foreign keys, duplicate indexes, and risky column types.
- Multi-connection support with per-connection table exclusions.
- Fully offline and CSP-safe; no CDN requests.
- Deterministic CLI exports enable schema drift detection in CI.

---

Source: [Laravel News — Laravel Truss: Live Interactive Database ER Diagrams](https://laravel-news.com/laravel-truss-database-er-diagrams)

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Flaravel-truss-live-interactive-database-er-diagrams-in-the-browser&text=Laravel+Truss%3A+Live+Interactive+Database+ER+Diagrams+in+the+Browser) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fwww.msaied.com%2Farticles%2Flaravel-truss-live-interactive-database-er-diagrams-in-the-browser) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Does Laravel Truss read actual row data from the database?        No. Laravel Truss reads schema metadata only — tables, columns, keys, and indexes. It never queries row data, so no sensitive records are exposed. 

      Q02  Can I use Laravel Truss with multiple database connections?        Yes. List each connection in config/truss.php and a toolbar picker appears in the dashboard. Each connection is introspected independently, and you can exclude specific tables per connection. 

      Q03  How can I use the schema export in a CI pipeline?        Run `php artisan truss:export --format=dbml --check` to regenerate the export and compare it against a committed file. The command exits non-zero when the schema has changed without the file being updated, failing the build. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://www.msaied.com/articles) 

 [ ![Laravel AI SDK v0.10: 4 New Features Explained](https://cdn.msaied.com/540/e74363f048913d3782bc16a7292215db.png) Laravel AI SDK AI Agents Filesystem Tools 

### Laravel AI SDK v0.10: 4 New Features Explained

Laravel AI SDK v0.10 ships with filesystem tools for agents, human tool approval, and more. This walkthrough c...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 12 Aug 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/laravel-ai-sdk-v010-4-new-features-explained) [ ![NightOwl: Laravel Monitoring With Flat Pricing and Your Own PostgreSQL Storage](https://cdn.msaied.com/538/60582948c0339b19e872f4f3c03171f2.png) Laravel Monitoring PostgreSQL 

### NightOwl: Laravel Monitoring With Flat Pricing and Your Own PostgreSQL Storage

NightOwl redirects Laravel Nightwatch telemetry into a PostgreSQL database you own, replacing per-event billin...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 11 Aug 2026     3 min read  

  Read    

 ](https://www.msaied.com/articles/nightowl-laravel-monitoring-with-flat-pricing-and-your-own-postgresql-storage) [ ![Mock PHP Classes in Tests With the Double Library](https://cdn.msaied.com/537/be45e68dffd72aa9bd833c2f409fcb07.png) testing mocking phpunit 

### Mock PHP Classes in Tests With the Double Library

Double is a PHP 8.3 test double library by Jason McCreary that replaces mocks, spies, and partials with a sing...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 11 Aug 2026     4 min read  

  Read    

 ](https://www.msaied.com/articles/mock-php-classes-in-tests-with-the-double-library) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://www.msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://www.msaied.com)
- [Projects](https://www.msaied.com/projects)
- [Articles](https://www.msaied.com/articles)
- [Certificates](https://www.msaied.com/certificates)
- [Contact](https://www.msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
