If you've ever coded PHP with Laravel, you must have experienced the thrill when everything from Routing, ORM, Queue, to Authentication is already integrated (Batteries-Included). You just need to fire up your machine, type php artisan make:model and dive straight into coding the business logic right away.
But when the project requires asynchronous processing or needs extremely high traffic, we often have to switch to Node.js.
And that's when the "nightmare" known as "Blank Canvas Fatigue" begins.
The common pain of Node.js developers
When using Express, Koa, or Fastify, you get a completely empty framework. You'll spend weeks just to:
I'm so tired of that. I want the blazing processing speed of Node.js (specifically Fastify), but I crave the elegant and cohesive development experience (DX) of Laravel.
Since I couldn't find what I needed, I decided to create it myself.
Video tutorial series: https://www.youtube.com/playlist?list=PLfU7tl7Veh7M
CanMiddleware:
new CanMiddleware("edit-post").CanMiddleware.ability("edit-post").struxjs: can("edit-post").RoleMiddleware:
new RoleMiddleware("admin", "editor").role("admin", "editor").PermissionMiddleware:
new PermissionMiddleware("publish-post").permission("publish-post").Khả năng tương thích 100%:
toString() cho tất cả các class middleware trên trả về alias tương ứng (ví dụ: "can:edit-post"), giúp hoạt động hoàn hảo với Route.group(), withoutMiddleware(), logging và telemetry.AuthMiddleware:
new AuthMiddleware("/custom-login", "web")..middleware("auth:/custom-login,web").ApiAuthMiddleware:
new ApiAuthMiddleware("api")..middleware("api.auth:custom_guard").request.setUser(user) giúp controller và downstream handler truy cập ngay request.user mà không cần resolve lại.id bị undefined trên Model Instancepublic id?: number | string ở class cha BaseModel được khởi tạo với giá trị undefined khi chạy constructor của instance, ghi đè lên Proxy getter và prototype getter trỏ vào this.attributes["id"].Giải pháp khắc phục:
declare id: any.get, has, ownKeys, getOwnPropertyDescriptor) ưu tiên truy xuất trực tiếp this.attributes đối với các khóa định danh chính (id, _id, this.primaryKey).{ id, name } = user, gọi .toJSON(), .toObject(), hoặc truy cập user.id.No talks yet. Create the first talk
Have you used this product? Leave a review!
Reviews & comments