Self-hosting your Moralis server

You now can self-host your moralis server

We have just published a demo and a guide, on how to do this.

:blue_book: Guide:

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

:point_down: Please post any feedback or questions down below :point_down:


I love you <3 i prefeer to maintain my server on the Moralis Cloud solution. If i switch in the future what i will have to do? thanks

The cloud code comes from parse server. You will still be able to use cloud code when you self host.

You can also watch this tutorial:


Hi, I have a couple of questions.

  1. do you have a container for the server? if no a pull request with the dockerfile will be accepted?

  2. How is the licensing and pricing with this self hosted server? in the videotutorial show that you need the moralis api key to run the server so I guess that have someting to do with licensing and pricing

I know the answer for the second question. The pricing will be only based on the api usage. Parse server is used that is open source.

we dont have a container currently, will check with the team about the plans :slight_smile:

First of All - Congratulations on the new funding round, You guys are awesome.,

We have been using Moralis to sync events and would like to use a self-hosted solution for the same.
Is it possible now?

For self-hosting your Moralis server, you can read this.

For event syncs you can use directly streams API:

Hi ,I have setted up the mongo database and ServerUrl and AppId from self hosting proccess ,but when i try to “yarn start” the react app it gives me this error

ERROR in [eslint] Failed to load config “@moralisweb3” to extend from.

1 Like

I see same error here in the video:

1 Like

XMLHttpRequest failed: "Unable to connect to the Parse API"

which was the reason i am trying to set up self hosting server.

I thought this error comes up because my moralis server is always freezed ,but now facing the same issue here ,please help


Looks like this was set in the tutorial but it’s not in the repo (9:15 of video).

XMLHttpRequest failed: “Unable to connect to the Parse API”

You’re getting this in your browser console from running the React app (parse-server-migration-react-client)? Make sure you followed the setup instructions e.g. adding the correct localhost URL (http://localhost:1337/server) to the .env file, and make sure the Parse server (parse-server-migration) is running.

1 Like

Great help @glad , my server was down basically I pressed ctrl+c and yarn start the react app which stops the server from running, so I opened a new terminal and run dev the server.thanks it fixed

1 Like

I clicked the link and this isn’t live yet? I’ve applied for waitlist but at the moment what would be the way to get event syncs while self hosting own server? Would I have to write that logic myself?

Hi all. I am running into a speed bump where I cant seem to get live queries working. I have downloaded the demo files and my index.ts for the server looks like this:

import Moralis from 'moralis';
import express from 'express';
import cors from 'cors';
import config from './config';
import {
  // parseServer,
  // parseIcoServer,
  // parseServeDemoServer,
} from './parseServer';
// import { parseDashboard } from './parseDashboard';
// @ts-ignore
import ParseServer from 'parse-server';
import http from 'http';

export const app = express();

  apiKey: config.MORALIS_API_KEY,

app.use(express.urlencoded({ extended: true }));


// app.use(`/server`, parseServer);
app.use(`/server`, parseTestServer);
// app.use(`/server`, parseIcoServer);
// app.use(`/server`, parseServeDemoServer);

// app.use(`/dashboard`, parseDashboard);

const httpServer = http.createServer(app);
httpServer.listen(config.PORT, () => {
  // eslint-disable-next-line no-console
  console.log(`Moralis Test Server is running on port ${config.PORT}.`);
// This will enable the Live Query real-time server

and i am trying to subscribe in my react-native app using this code:

  const subscribeToMessages = async () => {
    let query = new Moralis.Query("Messages");
    // console.log("",
    let subscription = await query.subscribe();
    subscription.on("create", notifyOnMessage);
    subscription.on("update", notifyOnMessage);
    // subscription.on('create', result => notifyOnMessage(result));
    return subscription;

  const notifyOnMessage = (result) => {
    // console.log("notifyOnMessage", result);
    // notifyOnType(result);

normal queries work, but live queries are not working. When i send a new chat message the new message isnt sent from the server to the app.

if i connect to the Moralis V1 server everything works fine. But if I connect to my self hosted server using the demo files, the live query doesnt seem to be working. Is anyone else having the same problem? if so how did you fix it? thanks in advance.
Iv managed to get most things working self hosted, but this is a major hurdle that i cant seem to figure out.

You should receive more info in the email on how to access streams api

forgot to add, this is the code for my parse server options:

// @ts-ignore
import { ParseServer } from 'parse-server';
const sendGridAdapter = require('parse-server-sendgrid-email-adapter');
import config from './config';
import MoralisEthAdapter from './auth/MoralisEthAdapter';

const objectIdSize = 24;
const sessionLength = 2 * 7 * 24 * 60 * 60; // 2 weeks

const defaultOptions = {
  masterKey: config.MASTER_KEY,
  javascriptKey: config.JS_KEY,
  restAPIKey: config.REST_KEY,
  cloud: config.CLOUD_PATH,
  auth: {
    moralisEth: {
      module: MoralisEthAdapter,
  emailAdapter: sendGridAdapter({
    apiKey: config.SG_KEY, // sendgrid api key
    from: config.SG_FROM_EMAIL, // from email address,
    passwordResetEmailTemplate: config.SG_PASSWORD_RESET_TEMPLATE, // sendGrid template ID
    verificationEmailTemplate: config.SG_VERIFY_EMAIL_TEMPLATE, // sendGrid template ID
  // logLevel: 'warn',
  // silent: true,
  // verbose: 1,

export const parseTestServer = new ParseServer({
  databaseURI: config.TEST_DATABASE_URI,
  serverURL: config.TEST_SERVER_URL,
  appId: config.TEST_APPLICATION_ID,
  // port: config.PORT,

could it be something to do with http vs https? just a wild guess

you don’t see any error in console/network tab? it just doesn’t work?