🍱 the fastest way to roll your app. MVPs in 15 minutes or less.
JavaScript CSS HTML
Latest commit 8fdf7b0 Aug 3, 2016 @martindale committed on GitHub Merge pull request #129 from overra/patch-1
Use HTTPS Google fonts

README.md

Maki

Build Status Coverage Status Community

The complete stack for building extensible apps, faster than ever. Hand-roll your application by telling Maki what your application does, and it takes care of the rest – without getting in your way if you want to customize it.

  • Write Once, Deploy Everywhere Maki enables a standard definition for applications beyond simply web apps. Because of our resource grammar, we can build desktop and native mobile applications directly – all in supplement to your web application. All with the same code.
  • Resource-Derived Infrastructure REST makes a lot of sense for APIs – we take it one step further and build the entire application around Resources as named channels, serving events and static documents alike. Even Desktop applications built with Maki use the same, familiar API!
  • Robust Plugin Ecosystem Maki is an extensible framework – and there's already a huge list of plugins to provide common (and some not so common!) functionality to your application with almost zero-configuration. For example, Maki's identity protocol allows us to support both username/password auth and cryptographic identity!

Quick Start

You'll need node.js to build a Maki application. Additionally, MongoDB and Redis are the default storage and messaging engines, so you will need to install and configure them to use the defaults, or override them if you'd like to use something different. We'll be changing this in an upcoming release – see #58 for progress!

  1. Install Maki: npm install martindale/maki
  2. Create your app, perhaps in yourapp.js:

    var Maki = require('maki');
    var myApp = new Maki();
    
    myApp.define('Widget', {
      attributes: {
        name: String
      }
    });
    
    myApp.start();
  3. Start your app: node yourapp.js – by default, accessible at http://localhost:9200

Behaviors

Maki applications allow you to construct pipelines, as follows:

// same as above
var Widget = myApp.define('Widget', { attributes: { name: String } });

Widget.pre('create', function(next, done) {
  var widget = this;
  // do something before creation...
  // call next() to continue creation, or done() to complete.  Pass done(err) to
  // abort the pipeline!  Useful for custom validation rules. :)
});

Widget.post('create', function() {
  var widget = this;
  // do something after creation!  This too is a pipeline – the tasks are
  // executed in the order they are injected.
});

Methods

All Maki resources expose these five methods, all of which follow the above pipeline:

  • query to select a list of documents,
  • get to get a single instance of a document by its identifier (ID),
  • create to create a new instance of a document,
  • update to change properties of a document, and
  • destroy to remove a document.

Plugins & Modules

Maki aims to be as lightweight as possible while still offering a base stack that implements #1. We've split out as many components as possible, and offer a list of plugins that can be used to add functionality to any Maki-powered app.

Core Modules

Name Version Build Status Coverage
maki-queue NPM Package Build Status Coverage Status
maki-mongoose-hooks NPM Package Build Status Coverage Status
maki-service-websockets NPM Package Build Status Coverage Status
maki-forms NPM Package Build Status Coverage Status

Plugins

Name Version Build Status Coverage
maki-sessions NPM Package Build Status Coverage Status
maki-passport-local NPM Package Build Status Coverage Status
maki-passport-github NPM Package Build Status Coverage Status
maki-passport-soundcloud NPM Package Build Status Coverage Status
maki-analytics NPM Package Build Status Coverage Status
maki-forms NPM Package Build Status Coverage Status
maki-types-file NPM Package Build Status Coverage Status
maki-assets NPM Package Build Status Coverage Status
maki-client NPM Package Build Status Coverage Status
maki-cms-local NPM Package Build Status Coverage Status

Documentation

For our documentation, see the docs/ subfolder.

Recommended Deployment

I use pm2 (npm install pm2 -g) to manage node apps in production, and I strongly recommend you do, too. It's got awesome features like log management, process clustering, and automatic startup scripts.

For Maki by itself, pm2 start maki.js will produce the following:

> pm2 start maki.js
PM2 Process launched
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ App name β”‚ id β”‚ mode    β”‚ PID   β”‚ status β”‚ restarted β”‚ uptime β”‚      memory β”‚    watching β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ maki     β”‚ 0  β”‚ cluster β”‚ 93966 β”‚ online β”‚         0 β”‚ 0s     β”‚ 25.652 MB   β”‚ unactivated β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 Use `pm2 desc[ribe] <id>` to get more details

You can check on running processes using pm2 ls. For example, on a server with multiple running services:

> pm2 ls
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ App name   β”‚ id β”‚ mode    β”‚ PID   β”‚ status β”‚ restarted β”‚ uptime β”‚       memory β”‚    watching β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ para       β”‚ 0  β”‚ cluster β”‚ 21140 β”‚ online β”‚         0 β”‚ 14d    β”‚  69.734 MB   β”‚ unactivated β”‚
β”‚ worker     β”‚ 1  β”‚ cluster β”‚ 21142 β”‚ online β”‚         0 β”‚ 14d    β”‚  83.996 MB   β”‚ unactivated β”‚
β”‚ bot        β”‚ 2  β”‚ cluster β”‚ 21223 β”‚ online β”‚         1 β”‚ 14d    β”‚ 115.543 MB   β”‚ unactivated β”‚
β”‚ maki       β”‚ 3  β”‚ cluster β”‚ 21154 β”‚ online β”‚         0 β”‚ 14d    β”‚  92.676 MB   β”‚ unactivated β”‚
β”‚ soundtrack β”‚ 4  β”‚ cluster β”‚ 32655 β”‚ online β”‚         3 β”‚ 18h    β”‚ 324.176 MB   β”‚ unactivated β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
 Use `pm2 desc[ribe] <id>` to get more details

For production monitoring, see also pm2 monit, vtop (available via npm install vtop -g), and StrongLoop.

Use environment variables for configuration. See config/index.js for a list of configurable values.

Spirit

Please feel free to submit changes to this repo via pull requests! We're trying to keep this as general and flexible as possible, so anyone can take the project and run with it.