Phones and mobile apps2 minutes to read

Where should I host the backend API for my React Native or Flutter app?

Your app ships through the App Store and Google Play, but its API and database need an always-on host with HTTPS. Here is a small, cheap setup that works.

On an always-on host with HTTPS and a database

The app itself is distributed through the App Store and Google Play. Its backend needs a server that is always on, answers over HTTPS and keeps a database. On Bothosting, run the API as a Node.js or Python HTTP app. It gets an HTTPS address and can use a custom domain such as api.example.com. Add a managed PostgreSQL, MySQL, MongoDB or Redis deployment on the same account. The API doesn’t sleep when idle, so the first request after a quiet night is as fast as any other. Connect the GitHub repository and every push redeploys the API. The Bothosting app alerts your phone if it stops unexpectedly.

A starting setup

One Relay plan (1 GB, 50% CPU, 5 GB, 2 slots)
DeploymentProfileRAMCPUStorage
App APIHTTP app or API (Express, Fastify) or Python web app (FastAPI, Flask)512 MB25%4 GB
DatabasePostgreSQL512 MB25%1 GB

Relay: $2.25/month for 1 GB RAM, 50% CPU, 5 GB storage and 2 deployments. For a prototype, the free Spark plan runs the API alone, and the API can keep its data in a SQLite file on the deployment’s disk. SQLite or PostgreSQL.

Make the API reachable

Bind the server to 0.0.0.0 on the port in SERVER_PORT. The platform accepts HTTPS and forwards each request to that port.

server.mjs
import express from 'express';
const app = express();
app.use(express.json());

app.get('/v1/health', (_req, res) => res.json({ ok: true }));

app.listen(Number(process.env.SERVER_PORT), '0.0.0.0');

Put the API’s base URL in the app’s config, and keep database passwords and third-party keys in the deployment’s Variables. Version your routes, for example /v1/. Older app builds stay installed on phones for months, so an old route has to keep working after you ship a new one. Deploying an Express API and FastAPI with Uvicorn.

What you build yourself

Bothosting runs your code. It isn’t a backend-as-a-service like Firebase or Supabase, so it has no client SDK, built-in user sign-in or realtime sync. You write those routes in your API. Push notifications are sent by your API through Apple’s APNs or Firebase Cloud Messaging, using credentials you store in Variables. If you want a database that the app talks to directly with security rules, a backend-as-a-service is designed for that. If you want your own API in a language you already know, a host like this is simpler and cheaper.