Skip to content

Configuration

All behaviour lives in config/truss.php. Publish it with:

Terminal window
php artisan vendor:publish --tag=truss-config

Every key has a sensible default and, where relevant, an env() override.

Reference

KeyEnvDefaultPurpose
route_prefixTRUSS_ROUTE_PREFIXtrussURL prefix for the page and the JSON / asset routes
enabledTRUSS_ENABLEDlocal onlyGlobal on/off switch. Off means the routes 404
middleware['web']Auth-context middleware so the gate can see the user
authorization.allowed_emailsTRUSS_ALLOWED_EMAILS[]Emails the default gate admits in non-local (comma-separated)
cache.ttlTRUSS_CACHE_TTL3600Seconds a schema snapshot is cached
connections[]Which DB connections are visualizable (defaults to the app’s default)
excluded_tablesframework tablesTables filtered out server-side, never sent to the browser
diagram.type_labelsTRUSS_TYPE_LABELSnativeDefault column-type labels: native or laravel
diagram.themeTRUSS_DIAGRAM_THEMEdefaultMermaid base theme
diagram.mermaid_urlTRUSS_MERMAID_URLnullWhere to load Mermaid from. Null self-hosts (no CDN)
diagram.min_zoomTRUSS_MIN_ZOOM0.7Readable floor for auto-fit. The Fit button ignores it
focus.default_depthTRUSS_FOCUS_DEPTH1Foreign-key neighbour depth when focusing a table
large_schema.warn_aboveTRUSS_LARGE_SCHEMA_WARN_ABOVE60Table count above which a “large schema” hint is shown

Notes on individual keys

enabled and middleware

These, together with the viewTruss gate, control access. See the Authorization guide.

connections

Leave empty to use the application’s default connection. To visualize specific connections, list them:

'connections' => [
'mysql' => [],
'reporting' => ['excluded_tables' => ['legacy_import']],
],

Only listed connections are visualizable; a request for any other connection returns 404. Per-connection excluded_tables are merged on top of the global list.

excluded_tables

Applied server-side at serve time, so their structure never reaches the browser and toggling the list needs no rebuild. The defaults cover framework and infrastructure tables (migrations, password_reset_tokens, sessions, cache, cache_locks, jobs, job_batches, failed_jobs).

diagram.type_labels

native shows the exact database type (varchar(255), bigint unsigned), which is the source of truth. laravel shows a best-effort short label (string, integer), computed in the browser. The mode is also toggleable live in the UI; this key sets the default.

diagram.mermaid_url

Null (the default) self-hosts Mermaid from the package, so no CDN is contacted. Set a URL to load Mermaid from a CDN or your own copy instead.

diagram.min_zoom

The lowest zoom the automatic fit will use, so a large schema stays legible and you pan around it rather than being dumped into an unreadable overview. The Fit button ignores this floor.

Content-Security-Policy

Truss serves its JavaScript, CSS, a vendored copy of Mermaid, and the IBM Plex Mono font from a gated route inside the package. No CDN is used by default. Under a strict CSP, the following cover Truss’s own assets:

script-src 'self';
style-src 'self' 'unsafe-inline';
font-src 'self';

style-src needs 'unsafe-inline' because Mermaid injects styles into the rendered SVG at runtime. To load Mermaid from a CDN instead, set TRUSS_MERMAID_URL and adjust script-src accordingly.