node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



An HTML5 crafting API.


View this example.

It loads up most (not all) of the Minecraft recipes and items. The textures are completely themeable using existing Minecraft texture packs too.

// create a crafter 
var crafter = require('craft')();
// add a recipe for a torch 
  have: [
  give: ['torch', 4],
// craft your item 
var item = crafter.craft([
console.log('You get ' + item.give[1] + '' + item.give[0] + '!');
// item is now a normalized recipe 

Minecraft-like Recipe Format

If you specify more than one argument to crafter.recipe() it will assume you're entering a recipe in a Minecraft-like format:

// turn a box of dirt into 2 diamonds 
crafter.recipe(['diamond', 2], [
  'D D',
], ['D', 'dirt', 2]);
  • The first argument is what the recipe will give and how much.
  • The second argument is a map of the recipe.
  • The following arguments indicate what each of the characters within the map are equivalent to and how much are required.

Popular Mod Recipe Format

crafter.recipe() also accepts a shorthand popular mod format. Enter as strings, a single recipe per line:

  // recipe for a ladder 
  'shaped ( log+null+log / log+log+log / log+null+log ) > ( ladder,16 )',
  // planks 
  'shaped stick+stick ; stick+stick > planks',

web user interface

Also included is a web user interface.

var webui = require('craft/webui')({
  container: document.getElementById('crafting')

View the example for a more in depth example.



Returns a new craft instance.

crafter.recipe(data[, ...])

Add a new recipe to the crafter.

crafter.craft([when], have)

Input have into the crafter and it will search for a matching recipe then return the matching recipe.


Returns a crafting web UI instance. Specify a container option that contains your crafting grids.

Events: pickup and drop

Events emitted as an item is picked up and dropped:

webui.on('pickup', function(itemSlot, quantityPickedUp) {});
webui.on('drop', function(itemSlot, quantityDropped) {});


With npm do:

npm install craft

Use browserify to require('craft').

release history

  • 0.1.0 - initial release


Copyright (c) 2013 Kyle Robinson Young
Licensed under the MIT license.

Minecraft is property of Mojang AB