Parse Server is an open source version of the Parse backend that can be deployed to any infrastructure that can run Node.js.
Parse Server works with the Express web application framework. It can be added to existing web applications, or run by itself.
Getting Started
April 2016 - We created a series of video screencasts, please check them out here: http://blog.parseplatform.org/learn/parse-server-video-series-april-2016/
The fastest and easiest way to get started is to run MongoDB and Parse Server locally.
Running Parse Server
Locally
$ npm install -g parse-server mongodb-runner
$ mongodb-runner start
$ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://localhost/test
Note: If installation with -g
fails due to permission problems (npm ERR! code 'EACCES'
), please refer to this link.
Inside a Docker container
$ docker build --tag parse-server .
$ docker run --name my-mongo -d mongo
$ docker run --name my-parse-server --link my-mongo:mongo -d parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --databaseURI mongodb://mongo/test
You can use any arbitrary string as your application id and master key. These will be used by your clients to authenticate with the Parse Server.
That's it! You are now running a standalone version of Parse Server on your machine.
Using a remote MongoDB? Pass the --databaseURI DATABASE_URI
parameter when starting parse-server
. Learn more about configuring Parse Server here. For a full list of available options, run parse-server --help
.
Saving your first object
Now that you're running Parse Server, it is time to save your first object. We'll use the REST API, but you can easily do the same using any of the Parse SDKs. Run the following:
curl -X POST \-H "X-Parse-Application-Id: APPLICATION_ID" \-H "Content-Type: application/json" \-d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' \http://localhost:1337/parse/classes/GameScore
You should get a response similar to this:
"objectId": "2ntvSpRGIK" "createdAt": "2016-03-11T23:51:48.050Z"
You can now retrieve this object directly (make sure to replace 2ntvSpRGIK
with the actual objectId
you received when the object was created):
$ curl -X GET \ -H "X-Parse-Application-Id: APPLICATION_ID" \ http://localhost:1337/parse/classes/GameScore/2ntvSpRGIK
// Response
Keeping tracks of individual object ids is not ideal, however. In most cases you will want to run a query over the collection, like so:
$ curl -X GET \
-H "X-Parse-Application-Id: APPLICATION_ID" \
http://localhost:1337/parse/classes/GameScore
// The response will provide all the matching objects within the `results` array:
To learn more about using saving and querying objects on Parse Server, check out the Parse documentation.
Connect your app to Parse Server
Parse provides SDKs for all the major platforms. Refer to the Parse Server guide to learn how to connect your app to Parse Server.
Running Parse Server elsewhere
Once you have a better understanding of how the project works, please refer to the Parse Server wiki for in-depth guides to deploy Parse Server to major infrastructure providers. Read on to learn more about additional ways of running Parse Server.
Parse Server Sample Application
We have provided a basic Node.js application that uses the Parse Server module on Express and can be easily deployed to various infrastructure providers:
- Heroku and mLab
- AWS and Elastic Beanstalk
- Google App Engine
- Microsoft Azure
- SashiDo
- Digital Ocean
- Pivotal Web Services
- Back4app
- Gomix
- Flynn
Parse Server + Express
You can also create an instance of Parse Server, and mount it on a new or existing Express website:
var express = ;var ParseServer = ParseServer;var app = ; var api = databaseURI: 'mongodb://localhost:27017/dev' // Connection string for your MongoDB database cloud: '/home/myApp/cloud/main.js' // Absolute path to your Cloud Code appId: 'myAppId' masterKey: 'myMasterKey' // Keep this key secret! fileKey: 'optionalFileKey' serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed; // Serve the Parse API on the /parse URL prefixapp; app;
For a full list of available options, run parse-server --help
.
Logging
Parse Server will, by default, log:
- to the console
- daily rotating files as new line delimited JSON
Logs are also be viewable in Parse Dashboard.
Want to log each request and response? Set the VERBOSE
environment variable when starting parse-server
. Usage :- VERBOSE='1' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
Want logs to be in placed in other folder? Pass the PARSE_SERVER_LOGS_FOLDER
environment variable when starting parse-server
. Usage :- PARSE_SERVER_LOGS_FOLDER='<path-to-logs-folder>' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
Want to log specific levels? Pass the logLevel
parameter when starting parse-server
. Usage :- parse-server --appId APPLICATION_ID --masterKey MASTER_KEY --logLevel LOG_LEVEL
Want new line delimited JSON error logs (for consumption by CloudWatch, Google Cloud Logging, etc.)? Pass the JSON_LOGS
environment variable when starting parse-server
. Usage :- JSON_LOGS='1' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
Documentation
The full documentation for Parse Server is available in the wiki. The Parse Server guide is a good place to get started. If you're interested in developing for Parse Server, the Development guide will help you get set up.
Configuration
Parse Server can be configured using the following options. You may pass these as parameters when running a standalone parse-server
, or by loading a configuration file in JSON format using parse-server path/to/configuration.json
. If you're using Parse Server on Express, you may also pass these to the ParseServer
object as options.
For the full list of available options, run parse-server --help
.
Basic options
appId
(required) - The application id to host with this server instance. You can use any arbitrary string. For migrated apps, this should match your hosted Parse app.masterKey
(required) - The master key to use for overriding ACL security. You can use any arbitrary string. Keep it secret! For migrated apps, this should match your hosted Parse app.databaseURI
(required) - The connection string for your database, i.e.mongodb://user:pass@host.com/dbname
. Be sure to URL encode your password if your password has special characters.port
- The default port is 1337, specify this parameter to use a different port.serverURL
- URL to your Parse Server (don't forget to specify http:// or https://). This URL will be used when making requests to Parse Server from Cloud Code.cloud
- The absolute path to your cloud codemain.js
file.push
- Configuration options for APNS and GCM push. See the Push Notifications quick start.
Client key options
The client keys used with Parse are no longer necessary with Parse Server. If you wish to still require them, perhaps to be able to refuse access to older clients, you can set the keys at initialization time. Setting any of these keys will require all requests to provide one of the configured keys.
clientKey
javascriptKey
restAPIKey
dotNetKey
Advanced options
fileKey
- For migrated apps, this is necessary to provide access to files already hosted on Parse.allowClientClassCreation
- Set to false to disable client class creation. Defaults to true.enableAnonymousUsers
- Set to false to disable anonymous users. Defaults to true.auth
- Used to configure support for 3rd party authentication.facebookAppIds
- An array of valid Facebook application IDs that users may authenticate with.mountPath
- Mount path for the server. Defaults to/parse
.filesAdapter
- The default behavior (GridStore) can be changed by creating an adapter class (seeFilesAdapter.js
).maxUploadSize
- Max file size for uploads. Defaults to 20 MB.loggerAdapter
- The default behavior/transport (File) can be changed by creating an adapter class (seeLoggerAdapter.js
).logLevel
- Set the specific level you want to log. Defaults toinfo
. The default logger uses the npm log levels as defined by the underlying winston logger. Check Winston logging levels for details on values to specify.sessionLength
- The length of time in seconds that a session should be valid for. Defaults to 31536000 seconds (1 year).maxLimit
- The maximum value supported for the limit option on queries. Defaults to unlimited.revokeSessionOnPasswordReset
- When a user changes their password, either through the reset password email or while logged in, all sessions are revoked if this is true. Set to false if you don't want to revoke sessions.accountLockout
- Lock account when a malicious user is attempting to determine an account password by trial and error.passwordPolicy
- Optional password policy rules to enforce.customPages
- A hash with urls to override email verification links, password reset links and specify frame url for masking user-facing pages. Available keys:parseFrameURL
,invalidLink
,choosePassword
,passwordResetSuccess
,verifyEmailSuccess
.middleware
- (CLI only), a module name, function that is an express middleware. When using the CLI, the express app will load it just before mounting parse-server on the mount path. This option is useful for injecting a monitoring middleware.masterKeyIps
- The array of ip addresses where masterKey usage will be restricted to only these ips. (Default to [] which means allow all ips). If you're using this feature and haveuseMasterKey: true
in cloudcode, make sure that you put your own ip in this list.readOnlyMasterKey
- A masterKey that has full read access to the data, but no write access. This key should be treated the same way as your masterKey, keeping it private.
Logging
Use the PARSE_SERVER_LOGS_FOLDER
environment variable when starting parse-server
to save your server logfiles to the specified folder.
Usage:
PARSE_SERVER_LOGS_FOLDER='<path-to-logs-folder>' parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
Email verification and password reset
Verifying user email addresses and enabling password reset via email requires an email adapter. As part of the parse-server
package we provide an adapter for sending email through Mailgun. To use it, sign up for Mailgun, and add this to your initialization code:
var server = ;
You can also use other email adapters contributed by the community such as:
- parse-server-postmark-adapter
- parse-server-sendgrid-adapter
- parse-server-mandrill-adapter
- parse-server-simple-ses-adapter
- parse-server-mailgun-adapter-template
- parse-server-sendinblue-adapter
- parse-server-mailjet-adapter
- simple-parse-smtp-adapter
- parse-server-generic-email-adapter
Using environment variables to configure Parse Server
You may configure the Parse Server using environment variables:
PORTPARSE_SERVER_APPLICATION_IDPARSE_SERVER_MASTER_KEYPARSE_SERVER_DATABASE_URIPARSE_SERVER_URLPARSE_SERVER_CLOUD_CODE_MAIN
The default port is 1337, to use a different port set the PORT environment variable:
$ PORT=8080 parse-server --appId APPLICATION_ID --masterKey MASTER_KEY
For the full list of configurable environment variables, run parse-server --help
.
Available Adapters
All official adapters are distributed as scoped pacakges on npm (@parse).
Some well maintained adapters are also available on the Parse Server Modules organization.
You can also find more adapters maintained by the community by searching on npm.
Configuring File Adapters
Parse Server allows developers to choose from several options when hosting files:
GridStoreAdapter
, which is backed by MongoDB;S3Adapter
, which is backed by Amazon S3; orGCSAdapter
, which is backed by Google Cloud Storage
GridStoreAdapter
is used by default and requires no setup, but if you're interested in using S3 or Google Cloud Storage, additional configuration information is available in the Parse Server guide.
Support
For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.
If you believe you've found an issue with Parse Server, make sure these boxes are checked before reporting an issue:
-
You've met the prerequisites.
-
You're running the latest version of Parse Server.
-
You've searched through existing issues. Chances are that your issue has been reported or resolved before.
Want to ride the bleeding edge?
The latest
branch in this repository is automatically maintained to be the last
commit to master
to pass all tests, in the same form found on npm. It is
recommend to use builds deployed npm for many reasons, but if you want to use
the latest not-yet-released version of parse-server, you can do so by depending
directly on this branch:
npm install parseplatform/parse-server.git#latest
Contributing
We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the Contributing to Parse Server guide.
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]