ndx-framework
ndx-framework is a full-stack JavaScript application framework built on established technologies like Express.js for the backend and AngularJS (version 1) for the frontend. Designed for stability, scalability, and rapid development, it promotes modularity and utilizes an opinionated stack including CoffeeScript, Pug (formerly Jade), and Stylus for code legibility and conciseness. A key differentiator is its built-in `ndxdb`, an in-memory SQL/NoSQL database that treats JavaScript objects as first-class citizens and can persist data to S3. The framework emphasizes a small footprint, suitable for constrained environments like Heroku, and includes features for SSL, token-based authentication, and OAuth2. It integrates with Grunt for development workflows and Yeoman for scaffolding. The current stable version, 0.2.27, indicates it is a pre-1.0 release, suggesting a potentially slow or ceased development cadence, especially given its reliance on older web technologies.
Common errors
-
Error: Cannot find module 'coffeescript'
cause The CoffeeScript compiler, required to run or build the application, is not installed or not accessible in the current environment.fixInstall CoffeeScript globally or ensure it's a project dependency: `npm install -g coffeescript`. -
'grunt' is not recognized as an internal or external command, operable program or batch file.
cause The Grunt CLI (command-line interface) is not installed globally on the system, which is necessary to run development and build tasks.fixInstall the Grunt CLI globally: `npm install -g grunt-cli`. -
Error: listen EADDRINUSE :::3000
cause Another process is already occupying the default port (3000) that ndx-framework attempts to use.fixStop the conflicting process, or specify a different port using the `PORT` environment variable (e.g., `PORT=4000 grunt`). -
ReferenceError: ndx is not defined
cause Attempting to access the `ndx` object before it has been properly initialized or made available within the current scope by the framework.fixEnsure your code executes within the framework's lifecycle or, if external, explicitly `const ndx = require('ndx-framework');` and reference the variable. -
Error: [$injector:unpr] Unknown provider: SomeServiceProvider
cause An AngularJS (Angular 1) service or dependency specified in the frontend application could not be located or injected by the AngularJS injector.fixVerify that `SomeService` (or the missing provider) is correctly defined and registered as an AngularJS module, and that all its own dependencies are met.
Warnings
- breaking The framework relies heavily on severely outdated and unmaintained technologies such as AngularJS 1, CoffeeScript, and Grunt. These dependencies are incompatible with modern Node.js versions and pose significant security risks and operational challenges.
- gotcha ndx-framework uses non-standard languages (CoffeeScript, Pug, Stylus) that require specific build tooling and introduce a learning curve. Modern JavaScript development typically uses plain JavaScript/TypeScript, HTML, and CSS/Sass.
- gotcha The built-in `ndxdb` database is primarily in-memory. For persistent data storage, it explicitly requires configuration for S3, which introduces external cloud dependency and specific setup.
- gotcha The framework's primary interaction model is through its command-line interface (`ndx-framework`) and `grunt` tasks. Direct `node app.js` execution or standard Node.js module loading might bypass critical initialization steps.
- gotcha Security-related environment variables like `SESSION_SECRET` are critical for encryption and session management. Failing to set a strong, unique secret exposes the application to security vulnerabilities.
Install
-
npm install ndx-framework -
yarn add ndx-framework -
pnpm add ndx-framework
Imports
- ndx
import ndx from 'ndx-framework';
const ndx = require('ndx-framework'); - serverConfig
import { config } from 'ndx-server';const serverConfig = require('ndx-server').config; - App
const app = ndx.createApp();
Quickstart
npm install -g ndx-framework ndx-framework --init ndx-framework --create --appname=myNdxApp cd myNdxApp grunt # Access your app at http://localhost:3000 # To build for production: # grunt build