jerrybroughton / kalejs

The node.js framework for developers who deliver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kale.js

The node.js framework for developers who deliver.

What is it?

Kale.js is a set of lightweight, opinionated generators for building koa-based node.js APIs with ease.

Kale.js consists of 5 Generators. One to build an app, one to build a controller, one to build a model, one to build a migration, and one to build scaffolding.

A Kale.js application:

  • Built on koa and makes heavy use of ES6 Generators.
  • Uses bookshelf.js for object Models.
  • Backed by Postgresql by default.
  • Generates models with UUIDs as the primary key by default.
  • Makes authentication simple and secure by using bookshelf-secure-password.
    • Simply add hasSecurePassword: true to your model.
  • Is a stateless, secure JSON API with helmet secure headers included by default.
  • Does not include cookies or session support by default (so no need for CSRF protection)
  • Includes environment-specific config according to the 12-factor app methodology.
  • Includes a Procfile for easy deployment.
  • Sets up Gulp with basic linting with jshint and code-style checking with jscs

Installation

npm install -g kalejs

Usage

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 ./example-app.

From the root of the new project, run ./bin/setup, then npm start and you'll have a server running.

Generators

kale.js comes equipped with a several generators to speed up development:

Model Generator

kale generate model User

This will create a new User model (referencing a users table) named user.js in the src/models directory.

This will also create an empty migration named <timestamp>_create_users.js in the src/db/migrate directory.

Controller Generator

kale generate controller users

This will create a new RESTful controller named users in the src/controllers directory.

The controller contains index, show, create, update, and destroy methods, as well as their routes.

Migration Generator

kale generate migration create_users

This will create a new migration named <timestamp>_create_users.js in src/db/migrate directory.

Scaffold Generator

kale generate scaffold User

This will run the model, migration and controller generators for a new User model.

Examples

To generate a simple Blog API, type the following:

npm install -g kalejs
kale new blog
cd blog
./bin/setup
kale generate scaffold Posts
npm start

About

The node.js framework for developers who deliver.


Languages

Language:JavaScript 96.7%Language:Shell 3.3%