ndx-server
raw JSON → 0.18.1 verified Fri May 01 auth: no javascript
A lightweight, modular server framework built on Express and Alasql, providing a schemaless SQL database that treats JavaScript objects as first-class citizens. Version 0.18.1 is the latest stable release, with no regular update cadence. It eliminates the need for a dedicated database server, persists to S3 with minimal reads/writes, and uses sessionless tokens that survive server restarts. Key differentiators include auto-loading of modules from startup, services, and controllers folders, built-in authentication and token generation, and a plugin ecosystem for auth, sockets, and database backups. Designed for rapid prototyping and small-to-medium scale applications, it also supports scaling via ndx-sync.
Common errors
error Error: Cannot find module 'alasql' ↓
cause Alasql is a peer dependency not installed automatically.
fix
Run
npm install alasql alongside ndx-server. error TypeError: ndx.config is not a function ↓
cause Using the module incorrectly, e.g., importing as a named export.
fix
Use
const ndx = require('ndx-server'); and chain methods on the returned object. Warnings
breaking Auto-loading of modules from /startup, /services, and /controllers folders may cause unexpected behavior if those directories exist with unintended files. ↓
fix Ensure no stray files are placed in these directories, or disable auto-loading via config.
gotcha ndx-server uses Alasql which is not suitable for concurrent write-heavy production workloads. ↓
fix Consider using a proper database server or use ndx-sync for scaling but be aware of limitations.
Install
npm install ndx-server yarn add ndx-server pnpm add ndx-server Imports
- default (ndx) wrong
const { ndx } = require('ndx-server');correctimport ndx from 'ndx-server'; - default (ndx) wrong
const NdxServer = require('ndx-server').default;correctconst ndx = require('ndx-server');
Quickstart
const ndx = require('ndx-server')
.config({
database: 'myapp',
tables: ['users', 'tasks'],
port: 3000
})
.controller(function(ndx) {
ndx.app.get('/api/hello', function(req, res) {
res.json({ message: 'Hello from ndx-server!' });
});
})
.start();
console.log('Server running on port 3000');