The node.js framework for developers who deliver on time.
What is it?
Kale.js is a set of lightweight, opinionated generators for building highly-scalable koa-based node.js APIs with ease and speed.
Kale.js consists of 6 Generators:
- one to build an app,
- one to build a controller,
- one to build a model,
- one to build a set of views,
- one to build a migration, and
- one to build scaffolding.
Overall, Kale.js builds apps that are fast, easy-to-read, and follow industry best practices.
A Kale.js application:
- Built on koa and makes heavy use of ES6 Promises.
- Uses bookshelf.js for an ORM.
- Backed by Postgresql by default.
- Includes basic single-page-app using AngularJS, installed with bower.
- Includes an asset pipeline using Broccoli with development file watching and reload.
- Sets up Gulp with basic linting with jshint and code-style checking with jscs
- Front-end stylesheets are compiled with SASS/SCSS.
- Generates models with UUIDs as the primary key by default.
- Is a stateless, secure JSON API.
- Does not include cookies or cookie-based sessions by default (so no need for CSRF protection)
- Security headers provided by helmet, and CORS.
- Includes environment-specific config according to the 12-factor app methodology.
- Includes a Procfile for easy deployment to heroku.
npm install -g kalejs
To start a new project, simply run
kale new <project_name>, for example:
kale new example-app
This will build a new kale.js app in
From the root of the new project, run
npm start and you'll have a server running.
The app structure will look like:
kale.js comes equipped with a several generators to speed up development:
kale generate model Thing
This will create a new
Thing model (referencing a
things table) named
thing.js in the
This will also create an empty migration named
<timestamp>_create_things.js in the
kale generate controller users
This will create a new RESTful controller named
users in the
The controller contains
destroy methods, as well as their routes.
kale generate view users
This will create a new set of AngularJS views under
kale generate migration create_users
This will create a new migration named
kale generate scaffold User
This will run the model, migration and controller generators for a new
To generate a simple Blog API, type the following:
npm install -g kalejs kale new blog cd blog ./bin/setup kale generate scaffold Posts kale migrate npm start