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

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

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

  [ home ](https://msaied.com)    [ articles ](https://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://msaied.com/articles?category=laravel) [  Composer Pacakge ](https://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%2Fmsaied.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%2Fmsaied.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://msaied.com/articles) 

 [ ![Cursor Pagination and Lazy Collections at Scale in Laravel](https://cdn.msaied.com/536/3aab48ef4a4eaa26a3267637dc2ec8c7.png) laravel eloquent performance 

### Cursor Pagination and Lazy Collections at Scale in Laravel

Offset pagination breaks under large datasets. Learn how Laravel's cursor pagination and lazy collections let...

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

 11 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/cursor-pagination-and-lazy-collections-at-scale-in-laravel) [ ![Livewire v3.8.4 Released: Octane Memory Leak Fix and Fetch Redirect Handling](https://cdn.msaied.com/534/fdb2d91db2cb26fba0788d205b663031.png) livewire laravel octane 

### Livewire v3.8.4 Released: Octane Memory Leak Fix and Fetch Redirect Handling

Livewire v3.8.4 ships two important backports: a fix for a computed property listener memory leak under Larave...

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

 10 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/livewire-v384-released-octane-memory-leak-fix-and-fetch-redirect-handling) [ ![Laravel artisan dev: Run Server, Queue, Logs, and Vite in One Command](https://cdn.msaied.com/533/88ab98460b08aed42d6688eaa02a9620.png) Laravel Artisan Laravel 13 

### Laravel artisan dev: Run Server, Queue, Logs, and Vite in One Command

Laravel 13.16 introduced a first-party `php artisan dev` command that replaces the old Composer script, runnin...

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

 10 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-artisan-dev-run-server-queue-logs-and-vite-in-one-command) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://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://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://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)
