PHPackages                             necro304/crud-inertia-shadcn - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. necro304/crud-inertia-shadcn

ActiveLibrary[Admin Panels](/categories/admin)

necro304/crud-inertia-shadcn
============================

Laravel package for generating CRUD with Inertia.js and Shadcn UI

0.0.1(5mo ago)2282[2 PRs](https://github.com/necro304/crud-inertia-shadcn/pulls)MITVuePHP ^8.4|^8.3CI passing

Since Nov 16Pushed 4mo agoCompare

[ Source](https://github.com/necro304/crud-inertia-shadcn)[ Packagist](https://packagist.org/packages/necro304/crud-inertia-shadcn)[ Docs](https://github.com/necro304/crud-inertia-shadcn)[ GitHub Sponsors]()[ RSS](/packages/necro304-crud-inertia-shadcn/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (12)Versions (4)Used By (0)

Laravel CRUD Generator with Inertia &amp; Shadcn
================================================

[](#laravel-crud-generator-with-inertia--shadcn)

[![Latest Version on Packagist](https://camo.githubusercontent.com/32a72c3398834259ae971ff201a44f6cce7d90c940ccfb320366809f7204e8bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6563726f3330342f637275642d696e65727469612d73686164636e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/necro304/crud-inertia-shadcn)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2037362ea2a36f246d8eb631df3141bd0861ad24d0a141f0abee0c1e8f921108/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6563726f3330342f637275642d696e65727469612d73686164636e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/necro304/crud-inertia-shadcn/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/134ff3e39912b2f56e3ffa70d8b5e2af03ddf8b02ffcf2ec47d523040aa1cf90/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6e6563726f3330342f637275642d696e65727469612d73686164636e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/necro304/crud-inertia-shadcn/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5383e2f906872ad52496797eeb9fcb6122ad403cf857ee0d197694cd89355139/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6563726f3330342f637275642d696e65727469612d73686164636e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/necro304/crud-inertia-shadcn)

A powerful Laravel package that generates complete, production-ready CRUD modules with a modern tech stack: **Vue 3**, **Inertia.js**, **Shadcn-vue**, and **Tailwind CSS 4**. Generate models, controllers, form requests, API resources, Vue components, and database migrations with a single Artisan command.

Features
--------

[](#features)

✨ **Complete CRUD Generation**

- **Backend**: Models with relationships, Controllers with filtering/sorting, Form Requests with validation, API Resources
- **Frontend**: Vue 3 components with TypeScript support, Shadcn-vue UI components, Data tables with TanStack Table
- **Database**: Migrations with proper column types and indexes

🎨 **Modern UI Components**

- Built-in Shadcn-vue components (DataTable, Form, Button, Input, Badge, AlertDialog, etc.)
- Responsive design with Tailwind CSS 4
- Dark mode support
- Accessible WCAG-compliant components

🔍 **Advanced Features**

- Soft deletes support
- Model auditing with owen-it/laravel-auditing
- Advanced filtering and sorting with Spatie Query Builder
- Debounced search across multiple fields
- File upload handling with storage integration
- Laravel Wayfinder integration for type-safe routing

📦 **Best Practices**

- PSR-12 code style with Laravel Pint
- PHPStan Level 5 static analysis
- Pest PHP testing framework
- Clean architecture following Laravel conventions
- TypeScript strict mode for frontend code

Requirements
------------

[](#requirements)

- **PHP**: ^8.3 | ^8.4
- **Laravel**: ^12.0
- **Node.js**: ^20.0 (for Vue 3 and Vite)
- **Composer**: ^2.0

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require necro304/crud-inertia-shadcn
```

The package will automatically register its service provider.

### Publish Configuration (Optional)

[](#publish-configuration-optional)

```
php artisan vendor:publish --tag="crud-generator-config"
```

This will create a `config/crud-generator.php` file where you can customize:

- Default namespaces
- Directory paths
- Stub templates
- Feature toggles (soft deletes, auditing, etc.)

Basic Usage
-----------

[](#basic-usage)

Generate a complete CRUD module with a single command:

```
php artisan make:crud Product name:string description:text price:decimal:nullable stock:integer
```

This command generates:

### Backend Files

[](#backend-files)

- ✅ `app/Models/Product.php` - Eloquent model with casts, relationships, soft deletes, and auditing
- ✅ `app/Http/Controllers/ProductController.php` - RESTful controller with index, create, store, show, edit, update, destroy
- ✅ `app/Http/Requests/Product/StoreProductRequest.php` - Validation rules for creating products
- ✅ `app/Http/Requests/Product/UpdateProductRequest.php` - Validation rules for updating products
- ✅ `app/Http/Resources/ProductResource.php` - API resource for JSON transformation
- ✅ `database/migrations/xxxx_xx_xx_create_products_table.php` - Database migration

### Frontend Files (Vue 3 + Inertia.js)

[](#frontend-files-vue-3--inertiajs)

- ✅ `resources/js/pages/Products/Index.vue` - List view with DataTable, filtering, search, and pagination
- ✅ `resources/js/pages/Products/Create.vue` - Creation form
- ✅ `resources/js/pages/Products/Edit.vue` - Edit form with pre-filled data
- ✅ `resources/js/pages/Products/Show.vue` - Detail view
- ✅ `resources/js/pages/Products/components/ProductForm.vue` - Reusable form component

Command Options
---------------

[](#command-options)

### Field Syntax

[](#field-syntax)

Define fields using the format: `name:type[:modifier[:modifier]]`

**Supported Field Types:**

- `string` - VARCHAR(255)
- `text` - TEXT column
- `integer` - INTEGER column
- `decimal` - DECIMAL(8,2) column
- `boolean` - BOOLEAN column
- `date` - DATE column
- `datetime` - DATETIME column
- `timestamp` - TIMESTAMP column
- `json` - JSON column

**Supported Modifiers:**

- `nullable` - Allow NULL values
- `unique` - Add unique constraint
- `index` - Add database index

**Examples:**

```
# String field, nullable
php artisan make:crud Post title:string:nullable

# Decimal with nullable
php artisan make:crud Invoice total:decimal:nullable

# Multiple modifiers
php artisan make:crud User email:string:unique:index
```

### Command Flags

[](#command-flags)

FlagDescription`--no-soft-deletes`Disable soft deletes in the model`--no-auditing`Disable model auditing`--no-views`Skip Vue component generation`--table=custom_name`Specify a custom table name`--force`Overwrite existing files without confirmation**Examples:**

```
# Generate without soft deletes
php artisan make:crud Product name:string --no-soft-deletes

# Custom table name
php artisan make:crud UserProfile name:string --table=user_profiles

# Skip frontend generation (API only)
php artisan make:crud Category name:string --no-views

# Overwrite existing files
php artisan make:crud Product name:string --force
```

AI Assistant Guidelines
-----------------------

[](#ai-assistant-guidelines)

This package includes AI assistant guidelines to help tools like Claude Code, GitHub Copilot, or Cursor AI understand how to work with the generated code.

### Publish Guidelines

[](#publish-guidelines)

Publish the AI guidelines to your project's `.ai/guidelines/` directory:

```
php artisan crud-generator:publish-guidelines
```

This creates `.ai/guidelines/crud-inertia-shadcn.md` with:

- Complete usage documentation
- Backend and frontend code patterns
- Best practices and conventions
- Common customizations
- Troubleshooting guide

**Benefits:**

- 🤖 AI assistants understand your CRUD patterns
- 📚 Consistent code generation aligned with package conventions
- 🎯 Better suggestions for extending generated code
- 💡 Context-aware recommendations

**Options:**

```
# Overwrite existing guidelines
php artisan crud-generator:publish-guidelines --force
```

The guidelines file can be customized to match your specific project needs and coding standards.

Generated Code Patterns
-----------------------

[](#generated-code-patterns)

### Model Example

[](#model-example)

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OwenIt\Auditing\Contracts\Auditable;

class Product extends Model implements Auditable
{
    use SoftDeletes;
    use \OwenIt\Auditing\Auditable;

    protected $fillable = ['name', 'description', 'price', 'stock'];

    protected function casts(): array
    {
        return [
            'price' => 'decimal:2',
            'stock' => 'integer',
        ];
    }
}
```

### Controller Example

[](#controller-example)

```
namespace App\Http\Controllers;

use App\Models\Product;
use App\Http\Requests\Product\StoreProductRequest;
use App\Http\Resources\ProductResource;
use Spatie\QueryBuilder\QueryBuilder;
use Spatie\QueryBuilder\AllowedFilter;
use Inertia\Inertia;

class ProductController extends Controller
{
    public function index()
    {
        $products = QueryBuilder::for(Product::class)
            ->allowedFilters([
                AllowedFilter::callback('search', function ($query, $value) {
                    $query->where('name', 'like', "%{$value}%")
                          ->orWhere('description', 'like', "%{$value}%");
                }),
                AllowedFilter::partial('name'),
            ])
            ->allowedSorts(['name', 'price', 'created_at'])
            ->defaultSort('-created_at')
            ->paginate(15)
            ->withQueryString();

        return Inertia::render('Products/Index', [
            'products' => ProductResource::collection($products),
        ]);
    }

    // ... other CRUD methods
}
```

### Vue Component Example

[](#vue-component-example)

```

import { router } from '@inertiajs/vue3'
import { DataTable } from '@/components/ui/data-table'
import { useCrudColumns } from '@/composables/useCrudColumns'
import { useDebounceFn } from '@vueuse/core'

const props = defineProps()

const { columns } = useCrudColumns([
  { key: 'name', label: 'Name', sortable: true },
  { key: 'price', label: 'Price', sortable: true },
  { key: 'stock', label: 'Stock' },
])

const handleSearch = useDebounceFn((value: string) => {
  router.visit(route('products.index'), {
    data: { search: value },
    preserveState: true,
  })
}, 300)

```

Advanced Usage
--------------

[](#advanced-usage)

### Adding Relationships

[](#adding-relationships)

After generating a CRUD, you can manually add relationships to the model:

```
// app/Models/Product.php
public function category(): BelongsTo
{
    return $this->belongsTo(Category::class);
}

public function reviews(): HasMany
{
    return $this->hasMany(Review::class);
}
```

Then update the controller to eager load relationships:

```
// app/Http/Controllers/ProductController.php
$products = QueryBuilder::for(Product::class)
    ->with(['category', 'reviews']) // Eager load relationships
    ->allowedFilters([...])
    // ...
```

### File Uploads

[](#file-uploads)

For models with file upload fields (e.g., images, documents):

```
php artisan make:crud Company name:string logo:string:nullable
```

Then update the controller to handle file uploads:

```
// app/Http/Controllers/CompanyController.php
public function store(StoreCompanyRequest $request)
{
    $data = $request->validated();

    if ($request->hasFile('logo')) {
        $data['logo'] = $request->file('logo')->store('companies/logos', 'public');
    }

    Company::create($data);

    return redirect()->route('companies.index');
}
```

### Custom Validation Messages

[](#custom-validation-messages)

Edit the generated Form Request classes to add custom validation messages:

```
// app/Http/Requests/Product/StoreProductRequest.php
public function rules(): array
{
    return [
        'name' => ['required', 'string', 'max:255'],
        'price' => ['required', 'numeric', 'min:0'],
        'stock' => ['required', 'integer', 'min:0'],
    ];
}

public function messages(): array
{
    return [
        'name.required' => 'The product name is required.',
        'price.min' => 'The price must be at least 0.',
        'stock.min' => 'Stock cannot be negative.',
    ];
}
```

Frontend Stack
--------------

[](#frontend-stack)

The generated Vue components use a modern, production-ready stack:

- **Vue 3** - Composition API with `` syntax
- **TypeScript** - Strict type checking for all props and interfaces
- **Inertia.js v2** - Server-driven SPA with deferred props, prefetching, and polling
- **Shadcn-vue** - Headless, accessible UI components
- **TanStack Table v8** - Powerful data tables with sorting, filtering, pagination
- **VueUse** - Composables library (e.g., `useDebounceFn` for search)
- **Lucide Icons** - Modern, consistent icon system
- **Tailwind CSS 4** - Utility-first CSS framework
- **Laravel Wayfinder** - Type-safe route helpers for Inertia

Testing
-------

[](#testing)

Run the package tests:

```
# Run all tests
composer test

# Run tests with coverage
composer test-coverage

# Run PHPStan static analysis
composer analyse

# Fix code style issues
composer format
```

### Writing Tests for Generated Code

[](#writing-tests-for-generated-code)

Generated CRUD modules should have corresponding tests:

```
// tests/Feature/ProductControllerTest.php
use App\Models\Product;

it('can list products', function () {
    Product::factory()->count(3)->create();

    $response = $this->get(route('products.index'));

    $response->assertSuccessful();
});

it('can create a product', function () {
    $data = [
        'name' => 'Test Product',
        'price' => 99.99,
        'stock' => 10,
    ];

    $response = $this->post(route('products.store'), $data);

    $response->assertRedirect(route('products.index'));
    $this->assertDatabaseHas('products', ['name' => 'Test Product']);
});
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on recent changes.

Contributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [necro304](https://github.com/necro304)
- [All Contributors](../../contributors)

Built with inspiration from the Laravel ecosystem and modern frontend practices.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance74

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

178d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e8281b23ae3f9ba29068b5a44d1595ee64c37b98960f623a687fd1cb84bec61?d=identicon)[necro304](/maintainers/necro304)

---

Top Contributors

[![necro304](https://avatars.githubusercontent.com/u/31376673?v=4)](https://github.com/necro304 "necro304 (17 commits)")

---

Tags

laravelpackagegeneratorinertiacrudvueshadcn

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/necro304-crud-inertia-shadcn/health.svg)

```
[![Health](https://phpackages.com/badges/necro304-crud-inertia-shadcn/health.svg)](https://phpackages.com/packages/necro304-crud-inertia-shadcn)
```

###  Alternatives

[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
