Laravel-like developer experience
Use UserResource.make(user) and UserResource.collection(users) for clean,
familiar response shaping.
ResourcesJS brings the Laravel API Resource experience to Node.js while staying framework-agnostic and TypeScript-first.
Instead of shaping API responses inside controllers, create reusable Resource classes that own output formatting, nested serialization, runtime validation, metadata, and OpenAPI schema generation.
Laravel-like developer experience
Use UserResource.make(user) and UserResource.collection(users) for clean,
familiar response shaping.
Framework agnostic
Return plain serializable objects from Express, Fastify, Hono, NestJS, Elysia, AdonisJS, or any other HTTP framework.
TypeScript-first
Infer output types with InferResource, including schema outputs and
conditional optional fields.
Validation and documentation
Use static Zod schemas for runtime validation and OpenAPI schema generation.
npm install @amrachraf6690/resourcesjs zodimport { Resource } from "@amrachraf6690/resourcesjs";
class UserResource extends Resource<User> { toArray() { return { id: this.resource.id, name: this.resource.name, email: this.resource.email, }; }}
return UserResource.make(user);{ "data": { "id": 1, "name": "John", "email": "john@example.com" }}