Getting Started

Welcome to Marty! This guide will help you learn how to use it. If you've never heard of Flux before I suggest you read an overview of Flux. Or if you prefer you can look at some examples:

The quickest way to start writing some code is to use our yeoman generator. First you will need to install yeoman and the marty generator

npm install -g yo generator-marty

To use the generator, create a directory and then cd into it. Next run yo marty which will create an empty marty project and install all dependencies. To start the application run npm start, you can view it in a browser at http://localhost:5000.

mkdir example && cd example
yo marty
npm start
open http://localhost:5000

Initially it only generates the basic folder structure. You can use yo marty:domain {domain name} to automatically create an action creator, store, constants, state source and component for the given domain.

If you'd prefer to do your own thing you can download the latest version from Github or you can get it from NPM or Bower

npm install --save marty
bower install --save marty

Marty is built using UMD. This means you can use it from node.js or Browserify

var Marty = require('marty');

module.exports = Marty.createStore({
  ...
})

Or require.js (Working example)

require(['marty'], function (Marty) {
  return Marty.createStore({
    ...
  })
});

Or you can access it from the window object (Working example)

window.Marty.createStore({
  ...
})