Registry / devops / the-framework

the-framework

JSON →
library1.1.12jsnpmunverified

A lightweight API building framework for NodeJS that does not depend on Express or other frameworks. Current version 1.1.12. Key features: automatic route discovery from directory, built-in parameter validation and type coercing, authentication hooks, file upload support, auto-generated API docs. It offers a minimalistic alternative to Express-based frameworks like Restify or Fastify, focusing on simplicity and zero external web dependencies.

devops
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Package is CommonJS-only; no ESM exports. Use require.

const theFramework = require('the-framework');

Destructured require works; ESM import not supported.

const { STRING } = require('the-framework');

Must call on theFramework object, not as standalone function.

theFramework.get(path, params, config, handler);

Shows how to start the server with auth and create a simple GET route with parameter validation.

const theFramework = require('the-framework'); const PORT = process.env.PORT || 3000; theFramework.startServer({ authenticationMethod: async (req, token) => { if (token && token === 'valid-token') { return { id: 1, name: 'User' }; } return null; }, apiDirectory: '/api', userTokenHeader: 'x-user-token', port: PORT }); // In /api/hello.js: theFramework.get('/hello', [ { id: 'name', type: theFramework.STRING, required: true, description: 'Your name' } ], { description: 'Says hello', authRequired: false }, async (params, user) => { return { message: 'Hello ' + params.name }; });
Debug
Known footguns
gotchaRoute file loading is synchronous and cached; changing route files after server start requires restart.
deprecatedThe 'disableListing' and 'disableDocs' config options are deprecated in favor of 'disableRouteListing' and 'disableRouteDocs'.
breakingBefore v1.1.0, authenticationMethod had different signature (req, token, callback).
gotchaFile uploads are saved to temporary directory; you must handle moving them yourself.
gotchaThrowing non-object exceptions results in 501 status code.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
3
ahrefsbot
2
bingbot
1
mj12bot
1
Resources