YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

laravel-to-node

Convert any Laravel framework site into a standalone Node.js (Express + EJS) app with all routes captured β€” admin + frontend API.

Single command:

node convert.js <laravel-path> [out-path]

What it converts

Laravel Node.js
routes/web.php, routes/api.php routes/web.js, routes/api.js
Route::get/post/put/patch/delete/match/any router.<verb>(path, handler)
Route::resource('x', Ctrl::class) 7 CRUD routes (index/create/store/show/edit/update/destroy)
Route::apiResource('x', Ctrl::class) 5 CRUD routes (index/store/show/update/destroy)
Route::middleware('m')->prefix('p')->group(...) nested group with middleware + prefix
Controller@action / [Ctrl::class, 'action'] controllers/<Ctrl>.js shim exporting the action
Eloquent model (app/Models/*.php) Sequelize model (models/<Model>.js) β€” table + fillable
Blade view (resources/views/**/*.blade.php) EJS stub (views/**/*.ejs)
Laravel middleware (app/Http/Middleware/*.php) Express middleware shim (middleware/index.js)
Migration Schema::create migrations.sql + prisma/schema.prisma

Each captured route preserves: HTTP method, path, controller@action, middleware chain, route name, params.

Output structure

out/
  app.js              # Express: helmet, rate-limit, JWT shim, routers
  package.json
  .env                # fresh JWT_SECRET
  .env.example
  README.md
  routes/
    index.js
    web.js            # every web.php route
    api.js            # every api.php route
  controllers/        # shim per Laravel controller@action
  models/             # Sequelize models
  views/              # EJS stubs from Blade
  middleware/
    index.js          # middleware shims + common aliases (auth, guest, ...)
  migrations.sql
  prisma/schema.prisma
  public/

Run the output

cd out
npm install
npm start
# β†’ http://localhost:3000
curl http://localhost:3000/__health

Controller shims return a structured JSON envelope so every route is live and observable immediately:

{
  "ok": true,
  "controller": "UserController",
  "action": "index",
  "params": {},
  "body": {},
  "query": {},
  "user": null
}

Replace shim bodies with real business logic.

Market-ready defaults

  • helmet β€” secure HTTP headers
  • express-rate-limit β€” 240 req/min/IP
  • JWT auth shim β€” Authorization: Bearer <token> β†’ req.user
  • .env with fresh JWT_SECRET + DB config
  • Error handler returning JSON

Verify

bash verify.sh

Builds a 3-file fake Laravel app, runs node convert.js, starts the generated node out/app.js, curls GET /users and GET /api/users, asserts both 200.

Limitations

  • PHP is regex-parsed, not AST-parsed. Complex Closures, dynamic groups, and macros may need manual fixups.
  • Blade directives (@if, @foreach, @csrf) become static EJS stubs.
  • Eloquent relations/scopes/accessors are TODO comments β€” models get table + fillable only.
  • Auth: JWT shim only; Sanctum/Passport need manual porting.
  • Queue/Job/Event/Listener/Notification classes are out of scope.
  • Migrations: only Schema::create tables are emitted; Schema::table alterations are listed as comments in migrations.sql.

Repo

License

MIT

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support