Laravel Truss: Live Interactive Database ER Diagrams | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Laravel Truss: Live Interactive Database ER Diagrams in the Browser

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

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

 Laravel Truss renders your database schema as a live, zoomable ER diagram in the browser. It adds focus mode, schema diffing, a schema doctor, multi-connection support, and multi-format exports — all without touching row data.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 9 Aug 2026 · Updated 11 Aug 2026 · 3 min read

ShareCopy linkCopied

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

  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)

 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)

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [Database](https://www.msaied.com/public/articles?search=Database)
- [ER Diagram](https://www.msaied.com/public/articles?search=ER%20Diagram)
- [Schema](https://www.msaied.com/public/articles?search=Schema)
- [Developer Tools](https://www.msaied.com/public/articles?search=Developer%20Tools)

 Frequently asked questions 
---------------------------

  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.

   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.

   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.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articlePostgreSQL JSONB in Laravel: Indexing, Querying, and Casting Without the Bloat](https://www.msaied.com/public/articles/postgresql-jsonb-in-laravel-indexing-querying-and-casting-without-the-bloat-2) [Next articleLaravel Discount: Coupon Codes, Usage Limits, and Stacking](https://www.msaied.com/public/articles/laravel-discount-coupon-codes-usage-limits-and-stacking)  

   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)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
