Skip to content

Rapid Box

A quick start truffle box to host REST APIs interacting with Smart Contracts.

Key features

Rapid Box allows your to focus on development of your Smart Contracts and exposing them through an API service, without spending time bridging Contract ABIs into your Express project.

  • The box takes care of auto-loading Truffle Contract definitions into the Contracts helper.
  • The Contracts helper also exposes the web3 object for RPC operations like getAccounts.
  • Server start accepts RPC endpoint as a parameter making it easy to switch between environments.


Exposing an endpoint to get value from SimpleStorage.

// Contracts helper
const Contracts = require('./app/contracts.js');

// Get storage contract value
app.get('/storage', function (req, res) {
    Contracts.SimpleStorage.deployed().then(function (instance) { (value) {
                value: value


To unbox to your workspace.

truffle unbox hexeight/rapid-box


Continue to use truffle as usual ;)

  Compile contracts: truffle compile
  Migrate contracts: truffle migrate
  Test contracts:    truffle test
  Run server:        npm start -- --rpc <RPC endpoint>


To run the API service, the RPC endpoint parameter is required. This allows switching RPC endpoints during development.

For example:

# Note that npm start requires the extra -- to different between npm arguments and your script arguments.
npm start -- --rpc http://localhost:8545
node server.js --rpc http://localhost:8545


Feel free to send in pull-requests and raise issues with any feedback.