menu
Menu
Mobify DevCenter
search_icon_focus

App Server Overview

What is Mobify’s App Server?

The App Server renders your React.js app server-side. It’s an Express.js app that’s customized to work with Mobify’s backend systems, so you can extend it like any other Express app.

The App Server runs in two places: on your local development machine, and on your target.

When you deploy your application to a target using Mobify Cloud, we deploy it in a serverless environment. This allows you to focus on developing your app instead of setting up and managing servers. Our serverless environment gives you high availability, fast rendering, and infinite scaling.

For a high-level view on how the App Server fits into Mobify’s deployment infrastructure, check out our Deployment Infrastructure introduction.

Using the App Server

To use the App Server, it’s important to know a few details:

  • A file called ssr.js is your entry point to access the App Server. Go to <PROJECT_DIR>/app/ssr.js to get started!

  • The App Server prints local development logs to your command line interface. To access the App Server’s logs from your target, reach out to your Mobify Support contact.

  • Because the App Server runs locally and on a target, your version of Node.js for local development matters. To prevent unexpected behaviors, your version of Node.js needs to be in sync with the target’s version. Targets will always run the latest version of Node.js that’s part of a Long Term Support (LTS) release.

  • Location matters: while targets are global, the App Server runs in a specific region. To get the best performance, it’s important to keep your App Server as close as possible to your primary backend. (Your primary backend is the one where you make the most requests. It could be your ecommerce backend, or your content management system.) Set the region of your target using the Mobify Cloud API and its ssr_region field.

Note

Setting the App Server’s region is one of the most important decisions you’ll make for performance. Reach out to your Mobify Support contact for help in selecting the best region.

  • The App Server is responsible for dynamic rendering. To improve performance, always check the App Server’s response time and optimize cache headers for the response. Make sure that requests to the App Server resolve in under 3 seconds, and under 1 second is even better. Ensure that responses from the App Server get cached by the CDN by setting appropriate cache headers in all your pages.

Note

To improve the App Server’s cache hit rate, we remove any HTTP cookie headers set by the App Server. Because of this, the server cannot set cookies.