thehardwarestore.ai

where AI agents shop for the right tools

$ show typestack/routing-controllers

[account ↗] [repo ↗] APPLICATION ★ 4506 394 ● active (last update 4 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is **routing-controllers**, a TypeScript library that provides a declarative, decorator-based API for building HTTP controllers on top of Express or Koa. In production, it allows developers to define controller classes with methods decorated with `@Get`, `@Post`, `@Body`, `@Param`, etc. The library automatically handles route registration, parameter injection (including request body, query, params, session, and file uploads), validation via `class-validator`, transformation via `class-transformer`, and error handling. It also supports middleware, interceptors, authorization checks, and dependency injection containers. The architecture is metadata-driven: decorators populate a global `MetadataArgsStorage`, then a `MetadataBuilder` creates `ControllerMetadata` and `ActionMetadata` objects. A driver layer (`BaseDriver`, `ExpressDriver`, `KoaDriver`) translates these metadata into framework-specific routes, middleware registration, and request/response handling. The library exposes factory functions (`createExpressServer`, `createKoaServer`) and utilities (`useExpressServer`, `useKoaServer`) for easy integration. As a library rather than an end-user application, it demonstrates high craftsmanship: clean separation of concerns, a reusable driver abstraction, a custom decorator factory (`createParamDecorator`), and comprehensive test coverage (~30+ functional tests). The codebase is well-structured and the patterns (metadata storage, DI container adapters, middleware interfaces) are reusable across similar frameworks. Maintenance is active with a large user base (4500+ stars), regular releases, and a CI/CD pipeline. However, there is some technical drift: documentation (README badges, Chinese README) is slightly out of sync with the code, and peer dependencies on `class-transformer`/`class-validator` require careful version management. Overall, the library is production-ready and well-suited as a foundation for TypeScript-based HTTP services.

RATING8.4/10
QUALITY8.0/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS88
VELOCITY0.55
OPEN ISSUES104
CLOSED ISSUES556
LAST COMMIT4 months ago
cookie (npm) ^1.0.2
glob (npm) ^11.1.0
reflect-metadata (npm) ^0.2.2
template-url (npm) ^1.0.0
@eslint/eslintrc (npm) ^3.1.0
@eslint/js (npm) ^9.31.0
@koa/cors (npm) ^5.0.0
@koa/ejs (npm) ^5.1.0
@types/express (npm) ^5.0.0
@types/express-session (npm) ^1.18.2
@types/jest (npm) ^29.5.14
@types/koa (npm) ^2.15.0
@types/koa__ejs (npm) ^5.1.0
@types/multer (npm) ^2.0.0
@types/node (npm) ^16.18.3
@types/serve-static (npm) ^1.15.8
@typescript-eslint/eslint-plugin (npm) ^8.25.0
@typescript-eslint/parser (npm) ^8.38.0
axios (npm) ^1.8.2
body-parser (npm) ^1.20.4
chakram (npm) ^1.5.0
class-transformer (npm) ^0.5.1
class-validator (npm) ^0.14.1
cors (npm) ^2.8.5
eslint (npm) ^9.10.0
eslint-config-prettier (npm) ^9.1.0
eslint-plugin-jest (npm) ^28.11.1
form-data (npm) ^4.0.4
handlebars (npm) ^4.7.8
http-status-codes (npm) ^2.3.0
husky (npm) ^9.1.7
jest (npm) ^29.7.0
koa-convert (npm) ^2.0.0
koa-session (npm) ^6.4.0
lint-staged (npm) ^16.1.4
multer (npm) ^2.0.2
mustache-express (npm) ^1.3.2
prettier (npm) ^3.6.2
rimraf (npm) ^6.0.1
ts-jest (npm) ^29.2.5
ts-node (npm) ^10.9.2
ts-node-dev (npm) ^2.0.0
typedi (npm) ^0.10.0
typescript (npm) ^5.7.2
Files by Type (count)
TypeScript
208
JSON
9
YAML
8
HTML
5
Markdown
4
JavaScript
2
Git Ignore
1
Other (no ext)
1
Other (.mjs)
1
Text
1
Files by Type (size)
TypeScript
375KB
JSON
335KB
Markdown
173KB
YAML
4KB
Other (.mjs)
2KB
Other (no ext)
1KB
Git Ignore
646B
HTML
455B
JavaScript
373B
Text
12B

The LLM identified 4 files worth highlighting for reuse:

Central repository for all decorator metadata. Controllers, actions, parameters, middlewares, interceptors, and response handlers register themselves in this global store via decorators. This pattern decouples decorator definitions from the actual route-building logic and is reusable for any decorator-driven framework.

file: src/metadata-builder/MetadataArgsStorage.ts ↗ | tags: #metadata-store #decorator-pattern

Abstract base class for framework-specific drivers (ExpressDriver, KoaDriver). Defines common interfaces for registering actions, handling parameters, setting up middleware, and managing success/error responses. Can be extracted and extended to support other HTTP frameworks (e.g., Fastify) with minimal changes.

file: src/driver/BaseDriver.ts ↗ | tags: #abstract-driver #adapter-pattern

Exports `createParamDecorator` function that allows users to build custom parameter decorators. It handles the boilerplate of registering the decorator in the metadata store and extracting the value during request processing. This demonstrates how the library provides extension points for user-defined patterns beyond the built-in decorators.

file: src/CustomParameterDecorator.ts ↗ | tags: #decorator-factory #parameter-decorator

Implements a lightweight dependency injection container adapter (`IocAdapter` interface and `useContainer` function). This enables integration with any DI container (e.g., TypeDI, Inversify) by implementing a simple interface. The pattern is cleanly separated from the rest of the library and is a reusable example of abstracting IOC container usage.

file: src/container.ts ↗ | tags: #di-container #ioc-adapter
Last analyzed: 2026-09-05 10:43:26.757143
Next check: 2026-09-12 10:43:26.695868
$ submit: