{"id":49201,"library":"rest-query","title":"Rest Query","description":"Rest Query is a REST API framework for Node.js (version 0.79.8) focused on querying and manipulating documents via RESTful endpoints. It features hooks for document lifecycle events (beforeCreate, afterCreate, etc.), app lifecycle hooks (init, shutdown), and a powerful query system. Currently in early alpha, it requires Node.js >=22.16.0. Key differentiators include its hook mechanism that allows modifying or interrupting flow, and its focus on document-oriented operations. The framework is actively maintained with noticeable development activity.","status":"active","version":"0.79.8","language":"javascript","source_language":"en","source_url":"https://github.com/cronvel/rest-query","tags":["javascript","rest","query","restful","api","app","router","web","framework"],"install":[{"cmd":"npm install rest-query","lang":"bash","label":"npm"},{"cmd":"yarn add rest-query","lang":"bash","label":"yarn"},{"cmd":"pnpm add rest-query","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core dependency for HTTP server","package":"express","optional":false},{"reason":"Default database driver for document storage","package":"mongodb","optional":false}],"imports":[{"note":"Package is ESM-only; default export is not available.","wrong":"const createApp = require('rest-query')","symbol":"createApp","correct":"import { createApp } from 'rest-query'"},{"note":"HookContext is a TypeScript type, not a value.","wrong":"import { HookContext } from 'rest-query'","symbol":"HookContext","correct":"import type { HookContext } from 'rest-query'"},{"note":"CommonJS require() will not work. Use ESM imports.","wrong":"const Schema = require('rest-query').Schema","symbol":"Schema","correct":"import { Schema } from 'rest-query'"}],"quickstart":{"code":"import { createApp } from 'rest-query';\nimport { MongoClient } from 'mongodb';\n\nconst mongoClient = new MongoClient('mongodb://localhost:27017');\nawait mongoClient.connect();\n\nconst app = createApp({\n  database: mongoClient.db('test'),\n  schema: {\n    collections: {\n      users: {\n        hooks: {\n          beforeCreate: async (context) => {\n            context.hook.incomingDocument.createdAt = new Date();\n          }\n        }\n      }\n    }\n  }\n});\n\napp.listen(3000, () => console.log('Rest Query server running on port 3000'));","lang":"typescript","description":"Shows how to create a Rest Query app with MongoDB, define a collection, and add a hook for document creation."},"warnings":[{"fix":"Ensure all hook functions are async or return a Promise.","message":"Hooks are async and must return a Promise; the main flow waits for resolution.","severity":"gotcha","affected_versions":"<1.0"},{"fix":"Use array syntax for multiple hooks: hooks: { beforeCreate: [hook1, hook2] }","message":"Only one hook can be registered per event by default; arrays of hooks are supported but called serially.","severity":"gotcha","affected_versions":"<0.80"},{"fix":"No action needed; naming remains the same.","message":"The 'collections' schema key is deprecated in favor of 'collections' (same name) — no change, but documentation is outdated.","severity":"deprecated","affected_versions":"<0.79"},{"fix":"Update Node.js to >=22.16.0.","message":"Minimal Node.js version changed from 16 to 22.16.0 in recent versions.","severity":"breaking","affected_versions":">=0.78"}],"env_vars":null,"search_vec":"'0.79.8':13 '22.16.0':50 'activ':74,79 'aftercr':31 'allow':58 'alpha':46 'api':8,84 'app':33,85 'beforecr':30 'current':43 'develop':78 'differenti':52 'document':19,27,68 'document-ori':67 'earli':45 'endpoint':22 'etc':32 'event':29 'featur':24 'flow':62 'focus':14,65 'framework':9,72,88 'hook':25,35,55 'includ':53 'init':36 'interrupt':61 'javascript':80 'key':51 'lifecycl':28,34 'maintain':75 'manipul':18 'mechan':56 'modifi':59 'node.js':11,49 'notic':77 'oper':70 'orient':69 'power':40 'queri':2,4,16,41,82 'requir':48 'rest':1,3,7,21,81,83 'router':86 'shutdown':37 'system':42 'version':12 'via':20 'web':87","created_at":"2026-06-07T17:00:34.596475+00:00","updated_at":"2026-06-07T17:00:34.596475+00:00","problems":[{"fix":"Migrate your project to ESM (add 'type': 'module' to package.json) or use dynamic import().","cause":"Using require() to import an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/node_modules/rest-query/index.js from /path/to/your-file.js not supported."},{"fix":"Use named import: import { createApp } from 'rest-query'","cause":"Trying to use default import syntax when the package exports named exports only.","error":"TypeError: createApp is not a function"},{"fix":"Update Node.js to version 22.16.0 or later.","cause":"Running an outdated Node.js version.","error":"Node.js version 22.16.0 is required. Current version: 16.14.0."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/cronvel/rest-query#readme","github":"https://github.com/cronvel/rest-query","docs":null,"changelog":null,"pypi":null,"npm":"rest-query","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}