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
1. Hỗ trợ Constructor Arguments & Fluent Helpers cho Middleware Phân quyền
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.2. Hỗ trợ Constructor Params & Alias Arguments cho Middleware Xác thực
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.3. Khắc phục lỗi id bị undefined trên Model Instance
public 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.Have you used this product? Leave a review!
Mình từng nghe tác giả nói về cách framework này flexible như laravel, cũng từng nghe muốn một frw đủ ngon trong việc build workflow cho langchain và thân thiện với AI Agents. Nói chung thì định hướng của framework này rất hay và "mới". Chúc tác giả thành công!
Cách bạn mô tả vấn đề 'Blank Canvas Fatigue' của Node.js developers là rất thích hợp. Phần giải thích về nỗi đau chung khi chọn giữa Express, Koa hay Fastify rồi phải chắp vá hàng loạt thư viện lại với nhau sẽ resonant lắm với các lập trình viên đã trải qua. Việc kết hợp tốc độ của Fastify với trải nghiệm lập trình thanh lịch của Laravel là một hướng đi rất hợp lý. Bạn nên bổ sung thêm những ví dụ code cơ bản để người dùng lần đầu tiếp cận có thể hình dung ngay được cách sử dụng. Chẳng hạn, so sánh code tạo một model giữa Laravel và StruxJS sẽ giúp mọi người cảm nhận rõ hơn về sự tiện dụng mà framework mang lại. Ngoài ra, nếu có số liệu về hiệu năng (response time, throughput) so sánh với các framework khác thì sẽ tăng tính thuyết phục lực đáng kể. Chúc bạn phát triển StruxJS thành công.

Modern, Blazing Fast, Type-Safe TypeScript Backend Framework
Auto-translated ·No talks yet
Create the first talk
Reviews & comments