Search by

makermind / erd4dev

makermindclub

Livewire ER diagram editor, relational conversion and SQL export for Laravel.

Package info

github.com/makermindclub/erd4dev

pkg:composer/makermind/erd4dev

Statistics

Installs: 41

Dependents: 0

Suggesters: 0

Stars: 5

Open Issues: 0

v0.3.0 2026-11-21 15:10 UTC

This package is auto-updated.

Last update: 2026-11-21 15:12:42 UTC


README

ERD4Dev — database modeling for Laravel

ERD4Dev

Packagist: makermind/erd4dev Total Downloads PHP Laravel Livewire License: MIT

Visual database modeling for Laravel, built with Livewire and WireFlow. Design entity-relationship diagrams, convert them into relational models, and export SQL or Laravel Shift Blueprint drafts directly from your application.

ERD4Dev is an open-source Composer package maintained by Makermind and developed in the erd4dev repository.

Installation · Access control · Modeling and importing · Blueprint drafts

Features

  • Design ER diagrams and generate linked relational models.
  • Import and export diagram JSON, import SQL, or read the current database connection schema metadata.
  • Edit tables, columns, keys and relationships on a visual canvas.
  • Export SQL, diagram images and drafts for Laravel Shift Blueprint.

Requirements

Dependency Version
PHP 8.3+
Laravel 12+
Livewire 4.3+

Composer package: makermind/erd4dev. PHP namespace: Makermind\Erd4dev.

Installation

Install from Packagist in your Laravel application. ERD4Dev uses WireFlow exactly at its published version 0.2.4-alpha:

composer require --dev makermind/erd4dev getartisanflow/wireflow:0.2.4-alpha

Tagged releases are published automatically after tests pass on main. Composer selects the latest compatible release. To follow unreleased development code instead, use makermind/erd4dev:dev-main.

The WireFlow argument explicitly allows its alpha release in the consuming application. Replace any existing ^0.1.2@alpha requirement in the application; it conflicts with 0.2.4-alpha.

Open /erd at the address and port already used by your application (for example, http://localhost:8000/erd). The package is discovered by Laravel automatically. No additional server, restart, Vite, asset publication or installation command is needed for normal local use.

erd:install remains an optional command to publish compiled assets and the package migration. Its --migrate flag runs all pending application migrations. Outside the local environment, publish and run the migration explicitly. Existing route caches must be regenerated after installing a package; persistent application workers need to load the new code as usual.

Access through the application server

ERD4Dev has no user accounts or per-user diagram ownership. Outside the local environment, its middleware requires the host application to authorize the erd.access Laravel Gate before allowing access to the editor, including Livewire updates. This is an access check for the entire shared workspace; it does not provide user management. Local development does not require configuring this Gate.

To publish the optional package configuration:

php artisan vendor:publish --tag=erd-config

Configuration controls the domain, middleware and storage table. The /erd prefix is fixed to avoid occupying the application root or its other routes. Routes use erd. names and views use erd::. The default storage table is erd_diagrams. Diagrams form a shared workspace without per-user or tenant isolation.

Modeling and importing

JSON import automatically detects ER diagrams and relational models exported by the editor, preserving their structure and opening the appropriate board. Invalid references are rejected before creating a project. JSON files are limited to 2 MB.

Start with an ER model and generate a linked relational model, or import SQL/database metadata directly into an independent editable relational board. Structural changes to linked models belong in the ER source.

SQL is parsed as text and never executed. Database import reads schema metadata from connections configured in config/database.php. Supported Laravel native drivers (SQLite, MySQL/MariaDB, PostgreSQL and SQL Server). Only SQLite has been tested against a real database.

Snapshots contain tables, columns, primary/unique keys and foreign keys. Data, defaults, checks, views, routines, ordinary indexes, collations and referential actions are outside the diagram representation. Unsupported structures are reported. Editing a snapshot changes only the saved diagram, never the source tables or records. Diagram records themselves use the host application's configured storage database.

On imported boards, New table creates a table with an id primary key. Rename tables and columns, add/remove columns, and set PK/UNIQUE keys directly on the canvas. Column types, sizes, enums and nullability are editable in their rows. Enum values retain embedded commas, spaces, empty strings and zero values.

Relationships links FK columns, including composite and recursive references. Cardinality follows uniqueness and nullability: a unique source key produces 1:1, otherwise N:1; nullable columns allow optional references. Changes that invalidate referenced keys are rejected.

The header places the database selector on the left, model tabs in the center and actions on the right. New table and Relationships are adjacent. Smaller screens keep a single toolbar row and expose secondary actions through More. SQL, Blueprint draft and image exports are in More on all screen sizes.

In an existing relational project, choose More → Hide Laravel tables to hide or show framework tables on the board. This preference is saved with the project and also controls which tables appear in SQL and JSON exports. Database imports also offer Hide Laravel internal tables (enabled by default) to omit them before the project is created. Both controls preserve users. Blueprint drafts always omit Laravel internals, regardless of these settings or import format. users remains in SQL, JSON and Blueprint output and can be edited freely, so keep its schema synchronized with the application's authentication database.

Public ER examples include only features configurable in the current interface. Readers retain compatibility with legacy diagrams and previously generated SQL headers. Existing user-authored names and saved diagram contents are not translated automatically.

Blueprint drafts

Choose More → Generate Blueprint draft. Each click saves a new file in the consumer project's root:

blueprints/draft-{diagram-id}-{YYYYMMDD}-{HHMMSSmicroseconds}.yaml

Exclusive file creation prevents overwrites; collisions receive a suffix. Commit the blueprints/ directory to version control. Drafts contain the current saved board without credentials or database records.

The result appears in a dismissible dialog with collapsed warnings and a copyable command. Reopen it through More → Last draft without generating another file. After review:

php artisan blueprint:build blueprints/draft-42-20261103-123456123456.yaml --only=models,migrations

The Laravel Shift Blueprint dependency is included. Generating a draft only writes YAML. It does not automatically generate PHP files or run migrations. Database configuration, review and migration execution remain the user's responsibility. Drafts describe full schemas, not migration diffs against existing tables.

Actual table names are preserved in meta.table. Missing id/timestamp columns are not implicitly added. Composite PK/UNIQUE keys are represented as indexes. Composite FKs and cross-schema references retain their columns but omit constraints that Blueprint cannot faithfully represent, with explicit warnings. Composite or nonstandard primary keys require reviewing the Eloquent model.

Reserved Blueprint names, incompatible identifiers, unsupported custom types and unrepresentable enums block draft generation with an explanation; partial drafts are not saved.

Development

Run package integration tests from this repository root:

composer install
composer test

The package's development configuration accepts alpha dependencies and prefers stable versions. Consuming applications must still explicitly accept the WireFlow alpha release as shown above; dependency stability settings are not inherited.

Include the compiled dist/erd.js and dist/erd.css in releases; consumers do not need Node.js or a frontend build.

Browser demo in Docker

To run the package inside a disposable Laravel host app, with the current checkout mounted as a local Composer path dependency:

docker compose -f demo/compose.yaml up --build

Open http://localhost:8080/erd (or http://buntinho:8080/erd when running on that host). The container creates a Laravel application, uses SQLite for saved diagrams, and exposes the package's normal dashboard, Livewire update endpoint, schema editor and relational editor. Local-environment access is enabled by the package middleware. Generated Blueprint drafts are written to demo/blueprints/ on the host; the SQLite database lives in demo/storage/. Both are ignored by Git. Stop the container with Ctrl+C and remove it with docker compose -f demo/compose.yaml down.

The demo/ harness is excluded from Composer archives via .gitattributes; it does not add a web app or deployment step to the release workflow on main.

Releases

Develop changes on develop and open a pull request into main. The Test and release workflow tests Laravel 12 and 13 on pull requests and pushes to either branch. Every push to main, including a merge from develop, publishes a stable Git tag and a GitHub release only after both test jobs pass. The first tag is v0.1.0. Subsequent releases inspect commit messages since the latest stable tag: feat: or feat(scope): increments minor, a conventional commit with !: or a BREAKING CHANGE: footer increments major, and other changes increment patch. The highest increment wins. Direct pushes to main also publish a release, so use pull requests for reviewed changes.

Use conventional commit messages on develop; with squash merges, include the desired prefix in the final squash commit message. Actions → Test and release → Run workflow on main can bootstrap or retry publication. Re-running a workflow for a commit that already has a release reuses its tag instead of creating another version. Existing tags are never moved. Versions come from Git tags; do not add a version field to composer.json.

Keep the Packagist GitHub webhook enabled. For an explicit update request on each release, add repository Actions secrets PACKAGIST_USERNAME and PACKAGIST_TOKEN, using a Packagist account with maintainer access. The token is available in the Packagist account profile. Without these secrets, the workflow relies on the existing webhook and emits a warning.

After publishing, a separate job polls the public Composer metadata for the exact tag, commit and WireFlow requirement. If the release is not visible after approximately 15 minutes plus network time, that job fails with an explanation. The GitHub release remains published. Check View Log on Packagist and re-run the workflow after fixing synchronization; re-running is safe. Creating a tag does not bypass Packagist propagation or the consuming application's alpha dependency restrictions.

Support and contributions

Report bugs and request features through GitHub Issues. Include your PHP, Laravel and Livewire versions and steps to reproduce the problem. Pull requests are welcome; run the integration tests before submitting changes.

License

ERD4Dev is distributed under the MIT license. Third-party license notices are available in licenses/.

Guided relationships

Independent relational boards (SQL/JSON/database imports) offer a guided relationship editor. Choose two tables, answer how many records can relate in each direction, and choose whether the foreign key is optional. The editor shows the rule in plain language and the exact column, NULL and UNIQUE changes before saving. Existing primary/unique protection is never silently removed.

One-to-one and many-to-one rules can reuse existing columns or create columns with the referenced key’s type. Many-to-many rules create an intermediate table with two foreign keys and a composite primary key. The Blueprint preview runs the real draft generator on a temporary model; it does not save the diagram or write a draft file. Review its warnings, including Eloquent’s composite-key limitations.

Click a relationship label to inspect its rules. ER-linked boards expose the same explanations in read-only form; structural edits belong in the ER source, followed by regeneration. Diagram edits do not change the connected database.

Run the client-side planning tests with node --test tests/js/*.test.mjs, alongside composer test.

Authors

ERD4Dev was developed by the following students of the Technical Program in Informatics at the Federal Institute of Education, Science and Technology of Rio Grande do Norte (IFRN), Mossoró Campus:

  • Arthur Ambrósio Praxedes Vieira
  • Cauã Vitor Cabreira da Silva
  • Cleber Raniele Firmino da Silva Júnior

The project was developed under the coordination and supervision of Professor Giovane Montine Moreira Gurgel.