Command line interface for Mantra

I thought it would be nice to have a CLI for Mantra and made one. It’s sort of Rails-flavored.

Here is the github repo. You can install it directly from npm.

You can do things like:

mantra generate component core:posts
mantra generate publication users
mantra generate method comments


$ mantra generate action core:users
  create  ./client/modules/core/actions/users.js
  update  ./client/modules/core/actions/index.js

Feedback welcomed.


Marked it and would have a try soon.


This is exactly, what I had in my mind.
Let’s make this official :slight_smile:


I just got started with Mantra the other day and was looking for something like this.

Nice work @sungwoncho :slight_smile:

1 Like

It is now an official CLI. Moved the repo to mantrajs org. Collaborations are encouraged.


UPDATE: SOLVED. It was just a casing error. Collections.planets => Collections.Planets.

@sungwoncho, thanks very much for this great mantra tool.

I am using it for the first time and have a question.

I’ve started a new app with mantra-CLI using these commands:

mantra create planetsapp
mantra generate publication planets 
mantra g collection planets -s collection2
mantra g module planets
mantra g container planets:list_planets

The following works correctly in /client/modules/planets/containers/list_planets.js:

export const composer = ({context}, onData) => {
  onData(null, {});

I have created a collection for this app called ‘planets’ using MongoBooster, and have imported data into it. I would like to access the contents of this collection from the container ‘list_planets.js’.

Here is my composer code, based on code found in mantra-sample-blog-app-master/client/modules/comments/containers/comment_list.js

export const composer = ({context, clearErrors, planetID}, onData) => {
  const {Meteor, Collections} = context();
  if (Meteor.subscribe('planets', planetID).ready()) {
    const options = {
      sort: {createdAt: -1}
    const comments = Collections.planets.find({planetID}, options).fetch();
    onData(null, {planetID});
  } else {

This code is giving me the following error:

Exception from Tracker recompute function:
TypeError: Cannot read property ‘find’ of undefined

How can I correct this? Thanks very much in advance for any info.

I don’t know what MongoBooster is, but I have a hunch that you are not exporting planets collection from /lib/collections.js. Hence Collections.planets is undefined.

Thanks very much for the reply. It was just a casing error. Collections.planets => Collections.Planets.