Registry / database / quail-rest

quail-rest

JSON →
library1.1.27jsnpmunverified

Quail is a Node.js framework that generates a MongoDB REST API from models and controllers, inspired by Sails.js. Version 1.1.27 provides automatic CRUD blueprints for any model, protected by an ACL system and JWT authentication. It also includes rate limiting via express-brute and support for embedded documents. Unlike Sails, Quail uses ACL for route management instead of a separate policy system, and it enforces authentication by default, requiring explicit ACL entries to expose endpoints. The package is released as a CLI tool (quail-cli) and depends on MongoDB. However, development appears to be in maintenance mode with infrequent updates.

npm install quail-rest
INSTALL
IMPORT
SIG · QUAIL-REST
Q
quail-rest
databasejavascriptv1.1.27
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.

quail
import quail from 'quail-rest'
const quail = require('quail-rest')
The package is primarily used via CLI and generated projects, not direct import. However, if using programmatically, ESM import is supported as of v1.1.27.
Controller
import { Controller } from 'quail-rest'
import { controller } from 'quail-rest'
Controller is exported as a named class with capital C.
Model
import { Model } from 'quail-rest'
const Model = require('quail-rest').Model
CommonJS require works but ESM is preferred for modern code.

Creates a new Quail project, adds a User model and controller, configures ACL to enable CRUD, then starts the server and creates a user.

// First, install the CLI globally: npm install -g quail-cli // Then create a project: // quail create myapp // cd myapp && npm install // Create a model: quail add-model user // Create a controller: quail add-controller user // Edit config/acl.js to allow unauthenticated access: module.exports = { routes: { authenticated: {}, not_authenticated: { User: { find: true, findOne: true, create: true, update: true, destroy: true, } } } }; // Start server: npm start // Then POST to http://localhost:3000/user with body {"name":"Test"}
Debug
Known issues
deprecatedQuail CLI uses deprecated package 'express-brute' which has known issues with newer Node versions.
fix
Consider using express-rate-limit or similar actively maintained rate-limiting middleware if you fork the project.
affects: >=1.0.0
gotchaAll routes are protected by default; you must explicitly add to ACL to allow unauthenticated access.
fix
Edit config/acl.js and add your controller actions under not_authenticated or authenticated as needed.
affects: >=1.0.0
breakingIn version 1.1.0, the ACL configuration format changed from a single object to separate authenticated/not_authenticated keys.
fix
If upgrading from v1.0.x, update config/acl.js to use the new format: module.exports = { routes: { authenticated: {}, not_authenticated: {} } }.
affects: >=1.1.0 <1.1.0
gotchaThe CLI commands ('quail create', 'quail add-model') must be run from the terminal, not from within a Node script.
fix
Use the command line: quail create myapp instead of calling package functions programmatically.
affects: >=1.0.0
gotchaMongoDB must be running locally on default port 27017, or set the MONGODB_URL environment variable.
fix
Ensure mongod is running, or export MONGODB_URL='mongodb://localhost:27017/mydb'
affects: >=1.0.0
Errors
Common errors & fixes
Error: listen EADDRINUSE :::3000
Port 3000 already in use by another process.
fix
Change port in config/env/development.js or kill the process using port 3000.
MongoError: connect ECONNREFUSED 127.0.0.1:27017
MongoDB server is not running.
fix
Start MongoDB: mongod (or use mongosh).
TypeError: Cannot read property 'find' of undefined
Controller not created for the model, or model name mismatch.
fix
Run 'quail add-controller user' to create controller for User model.
Error: No model found for controller 'user'
Model does not exist or name is misspelled.
fix
Check that you created a model: quail add-model user (note: creates User model). Controller must match model name case-sensitively.
Upgrade
Version history
1.1.27latest on npm
Audit
Dependencies
mongodbrequiredRequires a running MongoDB instance for data storage and retrieval.
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
quail-rest — npm install quail-rest · libregistry