Your friendly mock server

Downloads in past


1.3.310 years ago12 years agoMinified + gzip package size for mock-server in KB


Mock Server
Your friendly mock server
Node server that easily allows for development and testing of SPA application running against production services.


  • Remote Service Proxy
  • Local file override of remote proxy
  • Mock data sources
  • CORS remapping
  • Cookie remapping
  • Browser live reload

Server Mode

Server mode allows for setup of simple testing servers that eases the testing process for features that are currently under development.
  • Automated rebuild from github pushes
  • Branch selection
  • Heroku support
  • Campfire notifications


  1. In the root of the SPA application create mock-server.json. See example.
  2. (Optional) Define package.json with build dependencies (lumbar, grunt)
  3. Deploy to heroku
1. git clone 2. heroku create 3. Setup git repo heroku config:add MOCK_REPO=repoAddress

Private Repository Access

mock-server can be configured to access private git repositories through the GIT_SSH, MOCK_KEY, and MOCK_PUB environment variables.
$ heroku config:add \
    GIT_SSH="/app/" \
    MOCK_KEY="`cat ~/.ssh/id_rsa`" \
    MOCK_PUB="`cat ~/.ssh/`"

Automatic Rebuild

Github automatic updates are achieved through github push receive hooks combined with a githubpub publisher.
  1. Setup a githubpub instance or use the public one
  2. Add a webhook to the git repository. This
should be `http://$server/githubpub/$group`
  1. Add PUBNUB variables to mock-server instance

$ heroku config:add \
    PUBNUB_CHANNEL=channelName \

Public Pubnub Instance

A public gitpubnub instance is available at with. This is public so conflict may occur between channel names and push events sent through this service may be read by anyone reading this document. This is not recommended for private project use.
Example web hook: Subscribe Key: sub-c-1c0b5d78-eb3e-11e1-9de3-61dd1d151c11


mock-server uses the same config as the Campfire heroku addon. If enabled mock-server will utilize the same config as the addon. Otherwise the following environment variables need to be configured.
$ heroku config:add \

In either case these mock-server specific vars need to be set:
  • INSTANCE_NAME : Name reported in campfire notifications. This can be any value but is generally
set to the heroku server name.
  • CAMPFIRE_QUIET : Define to decrease the number of campfire notifications from the instance

Using other build systems

Mock-server comes with support for node build systems out of the box but any build system may be used if binaries are available. For more information on how to include additional binaries in the package, see the Heroku build pack documentation. Note that mock-server requires the node build pack so running additional build packs on the sytem will require the use of the multi build pack.


An example project has been setup here.
Bitdeli Badge