CommonJS Express middleware/handler utility library published to npm.
npm run build— esbuild bundlesindex.jsintodist/bundle.js(packages: "external", minified).dist/is gitignored, so rebuild after editingsrc/orindex.js;main: "dist/bundle.js".npm test— stub no-op (echo ... && exit 0). There are no real tests; verify by building and manually exercising handlers.npm run docs— generates API docs from JSDoc (jsdoc-to-mdx, config.json) intodocs/docs/api; pages likegetting-started.md/installation.mdare hand-written. Thedocs/tree is a separate Docusaurus project (npm ci && npm run buildthere).npm run dev— just runsnode index.js(loads every handler, exports them, exits). No server to run.
- Single entry point:
index.jsre-exports every handler. Any new handler must be added toindex.jsexports. - One handler per file at
src/<name>.handler.js(e.g.src/async.handler.js), CommonJS named exports. Some files export several helpers (log.handler.js:transports,initLogger,streamHandler,logHandler;password.handler.js:hashHandler,passwordHandler). Every export must be re-exported fromindex.js. Double quotes, 2-space indent, arrow functions, terminal semicolons. - Every export needs a JSDoc block (
@function,@param,@example) — it is the source for generated docs. - No linter, formatter, or type checker is configured; match existing style manually.
- DB/queue connection handlers are real, async connection initializers (
initRedis,initPostgres,initMongo,initQueue), each taking aconfigobject and returning a Promise. Don't run them casually — they connect live and reject/throw on missing config or failed connect (they no longer callprocess.exit).postgresHandler/mongoHandlerlegacy names are gone;initMongoreturned Value differs (mongoose connection). - All deps (
mongoose,redis,pg,bcrypt,socket.io, etc.) are regulardependenciesand stay external in the bundle; the npm CLI handles install. authenticationHandler/tokenHandlerusejsonwebtoken(JWT_SECRET-style env config);redis.handlerrequires aurlin config.- Docs site is published via GitHub Pages on push to
master(.github/workflows/deploy.yml); npm publish runs on release creation (.github/workflows/npm-publish.yml, needsNPM_TOKEN). Default branch ismaster.