Add custom cloud code to Parse Server

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

There are some cases where you may want to develop your own cloud code, so as to make Parse work in a non-standard way, or make it perform a desired operation when certains conditions are met. You can find more information about this in the Parse official documentation. In order to add your custom cloud code to your Parse Server stack, please follow the steps below:

  • Stop the Parse server:

      $ sudo installdir/ stop parse
  • Create a cloud directory in installdir/apps/parse/htdocs/

      $ sudo mkdir -p installdir/apps/parse/htdocs/cloud
  • Edit the script at installdir/apps/parse/htdocs/

      $ cd installdir/apps/parse/htdocs/
      $ vim server.js
  • Edit the ParseServer variable and modify the cloud object following the example below:

      var api = new ParseServer({
        databaseURI: "mongodb://root:MONGODB_PASSWORD@",
        cloud: "./cloud/main.js",
        appId: "APP_ID",
        masterKey: "MASTER_KEY",
        fileKey: "FILE_KEY",
        serverURL: 'http://localhost:80/parse'

Remember to replace the MONGODB_PASSWORD, APP_ID, MASTER_KEY, FILE_KEY and localhost placeholders with your MongoDB administrator account password, application ID, application master key, application file key and server’s public IP address respectively.

  • Restart the Parse server:

      $ sudo installdir/ restart parse
Last modification September 4, 2018