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!
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!
- Install Maki:
npm install martindale/maki
- Create your app, perhaps in
yourapp.js
:
var Maki = require('maki');
var myApp = new Maki();
myApp.define('Widget', {
attributes: {
name: String
}
});
myApp.start();
- Start your app:
node yourapp.js
– by default, accessible at http://localhost:9200
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.
});
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.
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.
Name | Version | Build Status | Coverage |
---|---|---|---|
maki-queue | |||
maki-mongoose-hooks | |||
maki-service-websockets | |||
maki-forms |
Name | Version | Build Status | Coverage |
---|---|---|---|
maki-sessions | |||
maki-passport-local | |||
maki-passport-github | |||
maki-passport-soundcloud | |||
maki-analytics | |||
maki-forms | |||
maki-types-file | |||
maki-assets | |||
maki-client | |||
maki-cms-local |
For our documentation, see the docs/
subfolder.
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.
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.