Laravel Smart Module Generator
Generate complete Laravel modules in seconds — Model, Migration, Controller, Request, Factory, Seeder, and Blade views with Tailwind UI — all from a single modern panel inside VS Code.
Features
- Auto-detects your stack — reads
composer.json and package.json to detect Laravel version, Filament, Livewire, Inertia, Vue, React, Sanctum, and Spatie Permission
- Generates a complete module from a single definition:
app/Models/Name.php — with fillable, belongsTo relationships for every foreign key
database/migrations/XXXX_create_table.php — with proper column types, unique/nullable constraints, and cascadeOnDelete on foreign keys
app/Http/Controllers/NameController.php — full CRUD resource controller
app/Http/Requests/NameRequest.php — FormRequest with typed validation rules
database/factories/NameFactory.php — with intelligent Faker field mapping
database/seeders/NameSeeder.php — seeds 10 records via factory
resources/views/names/index.blade.php — Tailwind table with search bar, pagination
resources/views/names/create.blade.php — Tailwind form with validation errors
resources/views/names/edit.blade.php — pre-filled Tailwind form with validation errors
- Route appended to
routes/web.php (duplicate-safe)
- Smart field inference —
_id suffix → foreignId + belongsTo; field names like email, nombre, telefono → correct Faker method
- Business templates — pre-built field sets for common modules:
Inventory System
Delivery Tracking
Simple CRM
Requirements
- VS Code
^1.80
- A Laravel project open as the workspace root (must contain
composer.json)
Usage
- Open a Laravel project in VS Code
- Open the Command Palette (
Ctrl+Shift+P / Cmd+Shift+P)
- Run
Laravel: Generate Smart Module
- Fill in the module name and fields (or select a business template)
- Click Generate Module
- Run
php artisan migrate in your terminal
Field Types
| Type |
Migration |
Validation |
String |
string() |
string\|max:255 |
Text |
text() |
— |
Integer |
integer() |
integer |
Date |
date() |
date |
Boolean |
boolean() |
boolean |
Foreign ID |
foreignId()->constrained()->cascadeOnDelete() |
integer\|exists:table,id |
Each field can also be marked Unique (->unique()) or Nullable (->nullable()).
Business Templates
Inventory System
Generates fields: product_id (FK), quantity, type, notes
Delivery Tracking
Generates fields: order_id (FK), status, tracking_number (unique), delivered_at (nullable date)
Simple CRM
Generates fields: cliente_id (FK), nombre, email (unique, nullable), estado, notas (text, nullable)
Project Structure
src/
├── extension.ts Entry point, registers commands
├── analyzer/
│ └── LaravelProjectAnalyzer.ts Reads composer.json + package.json
├── generator/
│ └── ModuleGenerator.ts Generates all module files
└── ui/
└── GeneratorWebview.ts Webview panel (dark-theme UI)
stubs/
├── model.stub
├── controller.stub
├── request.stub
├── factory.stub
├── seeder.stub
├── view_index.stub
├── view_create.stub
└── view_edit.stub
Generated File Example
Given this definition:
Module: Paciente
Fields:
- nombre string required
- dni string unique
- nacimiento date nullable
- seguro_id foreignId
- activo boolean
The extension generates:
app/
Models/Paciente.php
Http/Controllers/PacienteController.php
Http/Requests/PacienteRequest.php
database/
migrations/20250101120000_create_pacientes_table.php
factories/PacienteFactory.php
seeders/PacienteSeeder.php
resources/views/pacientes/
index.blade.php
create.blade.php
edit.blade.php
routes/web.php ← appended (duplicate-safe)
Development
git clone <repo>
cd laravel-smart-module-generator
npm install
npm run watch
# Press F5 in VS Code to open Extension Development Host
Packaging & Publishing
npm install -g @vscode/vsce
# Package as .vsix for local install
vsce package
# Install locally
code --install-extension laravel-smart-module-generator-0.1.0.vsix
# Publish to VS Code Marketplace (requires PAT token)
vsce publish
Before publishing:
Roadmap
| Version |
Features |
v0.1 |
Current: full CRUD with views, requests, seeders, business templates |
v0.2 |
Filament Resource generation when Filament is detected |
v0.2 |
API mode: generates API Resource + routes/api.php when Sanctum detected |
v0.3 |
Policy generation with Spatie Permission support |
v0.3 |
hasMany / belongsToMany relationship support |
v0.4 |
More business templates: Clínica, RRHH, Facturación, Inventario completo |
v1.0 |
Freemium model: premium templates, license system |
License
MIT