Downloads · 30 days
0
Shaurya2020/laravel-to-node
laravel-to-node is a machine learning model from Shaurya2020. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Convert any Laravel framework site into a standalone Node.js (Express + EJS) app with all routes captured — admin + frontend API.
Downloads · 30 days
0
Access
Public
Updated Aug 22, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.js34.5 KB · 69%
From the Hugging Face model README
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]
| 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.
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/
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.
helmet — secure HTTP headersexpress-rate-limit — 240 req/min/IPAuthorization: Bearer <token> → req.user.env with fresh JWT_SECRET + DB configbash 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.
@if, @foreach, @csrf) become static EJS stubs.Schema::create tables are emitted; Schema::table
alterations are listed as comments in migrations.sql.MIT