A guide to help you setup your own self-hosted server. This will give you the same functionalities as a Moralis server, but you are in full control.
Full Video Tutorial - hosting, integrating, migrating
If you are stuck
We want to help you to self host and are available in this forum thread if you have any questions. Don't hesitate to ask!
Migrating from the Moralis hosted server to a self-hosted server has several benefits:
- You are in completely in full control of your backend
- Complete in control of your data and databases
- You can finetune the hosting, resulting in saving costs
- You can include any custom code, plugins, and packages in your server-code (and cloud code)
- A better developer experience, as you can run the server locally during development
Self hosting a parse-server
You can integrate Moralis within any backend that you want. In this guide we will guide you to setup a parse-server. This is also used to setup the hosted Moralis servers. By setting up your own parse-server you can:
- Easily migrate from a Moralis hosted server to a self-hosted server
- Keep your cloud-code
- Keep your frontend the same (as this setup will allow you to use the moralis-v1 and react-moralis packages)
This guide will help you setting up your own parse-server, running it locally, and deploying it to production.
Moralis is continuously improving, and not all functionalities are available yet for a self-hosted server. Below is a list of the supported features. The remaining features are in development and will soon be supported as well:
- Authentication with an EVM chain
- Authentication with a Solana chain (coming soon)
- Make requests to the EvmApi (Web3Api) via the server that implements rate-limiting
- Make requests to the SolApi via the server that implements rate-limiting
- Sync real-time and historical on-chain data to the database
Plugins(deprecated, see below)
Authentication in this self-hosted server is using the Moralis Auth Api. This flow looks a bit different and requires some changes in the front-end (see Connect to your client).
EvmApi (WebApi) and SolApi with rate-limiting
Calling endpoints to the apis, are the same as before.
Moralis.Web3Api.<method> will make a request to a cloud-function that handles rate-limiting. Then this cloud function will make the call to the api and return the data.
These cloud functions are automatically generated (described in Configure your server
Sync on-chain data to the database
All Moralis plugins on the hosted Moralis servers are wrappers for external APIs. These could easily be replaced by yourself on this server. All you need is the endpoint/sdk of the plugin provider, and make requests via their api-keys (this is safe now as you have full control over your backend). See the documentation of these plugins for more information.
- Run parse-server locally
- Configure your server
- Migrate your data
- Connect to your client
- Deploy to production