App Cities
Your app, online
Data

Running a database alongside your app: what to prepare

Plan database connections, persistent storage, initialization and recovery before deploying an app with real data.

App Cities · 2 min · Updated

Your database holds the data your app needs. It might store notes, orders or user profiles. Starting its container is only one step. You also need a password, a volume for its files and a way to restore a backup. Its RAM and disk use count toward your pod's limits.

The steps

  1. Use the database service name in the backend connection string. Do not use localhost unless both processes genuinely run in the same container.
  2. Keep credentials in the secret-entry flow and use a database account limited to the application's needs. Do not publish the database port just to make setup easier.
  3. Mount a named volume at the path required by the database image. Create a test record and check that it survives a normal service restart.
  4. Plan schema migrations and a tested backup. Check the restore procedure before importing data that you cannot afford to lose.

A common question

Can I use an external database instead?

Your app can be designed around an external service, subject to connectivity and platform rules. Budget that service separately and secure its credentials.

Ready to try your project?

Prepare your project, check the prices and choose how you want to deploy.

Keep learning