How to setup a local Parse Server
The Back4app local development is a complete environment to build and test apps locally using Back4app main features like Database, Cloud Functions, Files, Authentication, and Web-Hosting. The local development is mainly composed of the open-source Parse Server, Dashboard and a Database installed on your local machine to help you get running and prototyping quickly.
Back4app local development can also be a good fit for your prototyping, development, and continuous integration workflows.
If you prefer a more detailed explanation please check the video below.
Set up the Back4app local development environment
To begin with this tutorial, you will need:
Step 1 - Connect your local machine to Back4app servers using the CLI
Follow the CLI guide and connect an existing app to your local machine or create a new one.
Command Line Interface
- The Command Line Interface (CLI) is a tool that allows you to interact with the back4app platform via a terminal or command window.
Step 2 - Install and run Parse Server
The easiest way to install Parse locally is using NPM. Run the command below on your terminal or command window.
1 npm install -g parse-server mongodb-runner
Once installed, start MongoDB, thus Parse Server can save the data on it:
1 mongodb-runner start
Go to your Back4app dashboard and copy your
MASTER_KEY under App Settings > Security & Keys. Paste the values and run the command below.
1 parse-server --appId APPLICATION_ID --clientKey CLIENT_KEY --masterKey MASTER_KEY --databaseURI mongodb://localhost/test
Now your Parse Server is up an running !
Step 3 - Installing the Dashboard
The Parse Dashboard will improve your local developing experience by adding a user friendly interface to manage your app. Run the following command to install it.
1 npm install -g parse-dashboard
Follow the same procedure that is described on the previous step, paste your app credentials and run the command below.
1 parse-dashboard --dev --appId APPLICATION_ID --masterKey MASTER_KEY --serverURL http://localhost:1337/parse --appName MY_APP
In case you face any error when opening the local dashboard, on your browser replace the following URL:
Step 4 - Changing the Server URL
The main Server URL to connect to Parse in Back4app is https://parseapi.back4app.com , but you should change it in your code to connect to your local Parse instance.
If you followed the steps above, your Parse instance is running in http://localhost:1337/parse. Check our guide Connect to Back4App if you need more details on how to connect your app to a Parse Server.