Laravel ReverseKit: Generate Your Entire Laravel Backend From a JSON Structure

Published: (December 12, 2025 at 10:54 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Laravel ReverseKit: Generate Your Entire Laravel Backend From a JSON Structure

I just released a new Laravel package called Laravel ReverseKit that helps you build an entire Laravel backend from a single JSON structure — no AI required.

Instead of writing models, controllers, migrations, policies, tests, and resources manually, you define the output (JSON) once, and ReverseKit generates the full backend for you.
GitHub repository

🚀 What Laravel ReverseKit Does

Laravel ReverseKit takes a JSON structure and generates:

  • Models with $fillable, $casts, and relationships
  • Migrations with inferred column types
  • API Controllers with CRUD methods
  • API Resources mirroring your JSON output
  • Form Requests for validation
  • Policies with ownership checks
  • Model Factories and Seeders
  • Feature Tests for your endpoints
  • API routes registered via Route::apiResource()

🔧 How It Works

Create a JSON file describing your expected API response (or provide a JSON string) and run:

php artisan reverse:generate path/to/your.json

Additional sources you can use:

  • Live API URLs (--from-url)
  • OpenAPI/Swagger specs (--from-openapi)
  • Postman collections (--from-postman)
  • Existing database tables (--from-database)
  • Interactive CLI mode (reverse:interactive)

The command generates all backend files based on the JSON structure you define — models, controllers, migrations, policies, and more.

📦 Quick Example

Input JSON

{
  "user": {
    "id": 1,
    "name": "John Doe",
    "email": "john@test.com",
    "posts": [
      { "id": 1, "title": "First Post", "body": "Content", "published": true }
    ]
  }
}

Generated Files

app/Models/User.php
app/Models/Post.php
app/Http/Controllers/UserController.php
app/Http/Controllers/PostController.php
app/Http/Resources/UserResource.php
app/Http/Resources/PostResource.php
app/Policies/UserPolicy.php
app/Policies/PostPolicy.php
database/migrations/xxxx_create_users_table.php
database/migrations/xxxx_create_posts_table.php
tests/Feature/UserTest.php
tests/Feature/PostTest.php
routes/api.php

📍 Resources

  • GitHub:
  • Packagist:

🛠 Why This Helps

Writing all the boilerplate for a new backend — models, migrations, relationships, policies, tests — takes a lot of time and repetitive typing. ReverseKit lets you focus on your domain logic and lets the tool scaffold the rest based on the output you care about.

Back to Blog

Related posts

Read more »