v9.2.0 · Node.js 26 · TypeScript 6
Dependency injection, modules, routing and a request lifecycle built on decorators. Ship a REST API, a GraphQL endpoint or a Lambda handler from one module graph, without glue code.
npm i -g @typeix/clitypeix new project-namecd project-nametypeix start --watch @Controller({path: "/users"})
export class UsersController {
@Inject() private users: UserService;
@GET("/<id>")
findById(@PathParam("id") id: string) {
return this.users.find(id);
}
} @RootModule({
shared_providers: [],
imports: [UsersModule],
controllers: [UsersController]
})
export class ApplicationModule {} @Resolver(() => User)
export class UsersResolver {
@Inject() private users: UserService;
@Query(() => [User])
list(): Promise<User[]> {
return this.users.list();
}
} import {createServer} from "http";
import {pipeServer} from "@typeix/resty";
async function bootstrap() {
const server = createServer();
await pipeServer(server, ApplicationModule);
server.listen(3000);
}
bootstrap(); What you get
Hierarchical injectors, constructor and property injection, and request-scoped controllers.
MODImports and exports build a graph at boot. A module only sees what it deliberately exports.
RESTController and GET decorators map onto the router: param captures, regex segments and per-route error handlers.
GQLSchema built from decorators, resolvers resolved through DI, with query limits and error masking.
APIThe document is generated from the routes the router registered, so it cannot drift from your API.
SECOne guard chain over every route, with declarative rules parsed at boot. Password login, tokens and JWT included.
WSWebSocket and Socket.IO controllers share the injector. The Lambda adapter reuses the app between invocations.
Lifecycle
Root and feature module decorators describe which controllers and providers belong together.
One async call resolves the injector, attaches the router and registers every route.
pipeSwagger, pipeGraphQL and pipeWebSocket reuse the same graph on the same server.
Packages
Live preview
A complete resty application on StackBlitz. Edit the controller and watch the route change.
Fourteen packages, one mental model. Start with a single controller.