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.

npm install the-framework
INSTALL
IMPORT
SIG · THE-FRAMEWORK
T
the-framework
devopsjavascriptv1.1.12
harness data pending
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.

theFramework (default)
const theFramework = require('the-framework');
import theFramework from 'the-framework';
Package is CommonJS-only; no ESM exports. Use require.
theFramework.STRING
const { STRING } = require('the-framework');
import { STRING } from 'the-framework';
Destructured require works; ESM import not supported.
theFramework.get()
theFramework.get(path, params, config, handler);
get(path, params, config, handler);
Must call on theFramework object, not as standalone function.

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 issues
gotchaRoute file loading is synchronous and cached; changing route files after server start requires restart.
fix
Restart the server after adding/modifying route files.
affects: all
deprecatedThe 'disableListing' and 'disableDocs' config options are deprecated in favor of 'disableRouteListing' and 'disableRouteDocs'.
fix
Use disableRouteListing: true and disableRouteDocs: true instead.
affects: >=1.1.0
breakingBefore v1.1.0, authenticationMethod had different signature (req, token, callback).
fix
Upgrade to v1.1.0+ or use async/await signature.
affects: <1.1.0
gotchaFile uploads are saved to temporary directory; you must handle moving them yourself.
fix
Move files from params.param.path to your desired location inside the route handler.
affects: all
gotchaThrowing non-object exceptions results in 501 status code.
fix
Always throw an object with 'status' and 'message' properties for custom error codes.
affects: all
Errors
Common errors & fixes
TypeError: theFramework.startServer is not a function
Using import statement or destructuring incorrectly.
fix
Use const theFramework = require('the-framework'); and then call theFramework.startServer(...)
Error: Route file not found: /api/hello.js
apiDirectory path is relative from project root, but file doesn't exist.
fix
Ensure the apiDirectory folder exists and contains .js route files.
TypeError: Cannot read properties of undefined (reading '0')
Missing required parameter in route or misconfigured parameter array.
fix
Check that parameter array is correctly defined with 'id' and 'type' properties.
Error: Invalid value for parameter 'email'
Value does not match expected type (e.g., STRING but received number).
fix
Ensure request payload matches parameter type definitions.
Upgrade
Version history
1.1.12latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
the-framework — npm install the-framework · libregistry