A minimal, highly performant middleware PSR-15 inspired function based micro framework built with as little complexity as possible, aimed primarily at those developers who want to understand all the vendors they use.
Through NPM as @chubbyts/chubbyts-framework.
npm i \
@chubbyts/chubbyts-framework-router-path-to-regexp@^3.4.0 \
@chubbyts/chubbyts-framework@^3.3.0
import { STATUS_CODES } from 'node:http';
import { createPathToRegexpMatch }
from '@chubbyts/chubbyts-framework-router-path-to-regexp/dist/path-to-regexp-router';
import type { ServerRequest } from '@chubbyts/chubbyts-undici-server/dist/server';
import { Response } from '@chubbyts/chubbyts-undici-server/dist/server';
import { createApplication } from '@chubbyts/chubbyts-framework/dist/application';
import { createErrorMiddleware }
from '@chubbyts/chubbyts-framework/dist/middleware/error-middleware';
import { createRouteMatcherMiddleware }
from '@chubbyts/chubbyts-framework/dist/middleware/route-matcher-middleware';
import { createGetRoute } from '@chubbyts/chubbyts-framework/dist/router/route';
import { createRoutesByName } from '@chubbyts/chubbyts-framework/dist/router/routes-by-name';
const app = createApplication([
createErrorMiddleware(true),
createRouteMatcherMiddleware(
createPathToRegexpMatch(
createRoutesByName([
createGetRoute({
path: '/hello/:name',
name: 'hello',
handler: async (serverRequest: ServerRequest<{name: string}>): Promise<Response> => {
return new Response(`Hello, ${serverRequest.attributes.name}`, {
status: 200,
statusText: STATUS_CODES[200],
headers: {'content-type': 'text/plain'}
});
},
}),
]),
),
),
]);
A facade around createApplication / createErrorMiddleware / createRouteMatcherMiddleware / createRoute /
createGroup: pure construction sugar, the returned handler is the very same middleware pipe as with the
explicit composition: error middleware first, app middlewares, route matcher middleware last.
import { createPathToRegexpMatch as createMatch }
from '@chubbyts/chubbyts-framework-router-path-to-regexp/dist/path-to-regexp-router';
import { createApplicationBuilder } from '@chubbyts/chubbyts-framework/dist/facade';
const application = createApplicationBuilder(createMatch, [corsMiddleware])
.get('/ping', 'ping', pingHandler)
.get('/openapi', 'openapi', openApiHandler)
.group('/api/pets', [acceptNegotiationMiddleware, apiErrorMiddleware], (pets) =>
pets
.get('', 'pet_list', petListHandler)
.post('', 'pet_create', [contentTypeNegotiationMiddleware], petCreateHandler)
.get('/:id', 'pet_read', petReadHandler)
.put('/:id', 'pet_update', [contentTypeNegotiationMiddleware], petUpdateHandler)
.delete('/:id', 'pet_delete', petDeleteHandler),
)
.build();
Running the application via the standard node http implementation.
npm i @chubbyts/chubbyts-undici-server-node@^1.0.4
Check the Usage section.
Running the application via the uWebSockets http implementation.
npm i @chubbyts/chubbyts-undici-server-uwebsockets@^1.0.2
Check the Usage section.
2026 Dominik Zogg