Guide LESSON · BEGINNER

What a database actually does for you

The database is the part of your app that remembers after the request ends and after the program restarts. Everything else in the app can be rebuilt from your code. The database holds the thing that cannot.

Free 3 min read Updated Jul 27, 2026

By the end you can

  • An app forgets nearly everything.
  • A database is the place the app writes things down so they survive.
  • An app is a program, and programs get restarted.
  • The restart takes the app's local state with it.

What this is about

The database is the part of your app that remembers after the request ends and after the program restarts. Everything else in the app can be rebuilt from your code. The database holds the thing that cannot.

The corollary, and the reason this is a reality check rather than a definition: "it worked when I refreshed" is not evidence that anything was saved. A refresh reaches an app that is still running, so it can answer correctly from state that will not survive the next restart.

How it actually goes

  1. 01

    An app forgets nearly everything.

    The database is the part that remembers.

  2. 02

    A database is the place the app writes things down so they survive.

    Everything else the app is holding is scratch paper for one visit.

  3. 03

    An app is a program, and programs get restarted.

    A deploy restarts it. So does a settings change, and so does the environment moving it somewhere else.

  4. 04

    The restart takes the app's local state with it.

    The rule the twelve-factor text states is the one worth teaching: never assume anything held in memory or on local disk will be there on a future request.

  5. 05

    The concrete case.

    A customer types something and hits save. If that value only lived inside the running app, the next deploy takes it away. There is no error. It is gone.

  6. 06

    Refreshing is not the test.

    The app is still running while you refresh, so it can still be holding your answer. A restart is the test.

  7. 07

    The second job.

    A database is also the one place where two people acting at the same moment has to come out right.

  8. 08

    All or nothing.

    A database can bundle several changes into one step where either every part lands or none of it does. The film teaches this shape without naming it, because the word for it belongs to the Intermediate film (catalog F21).

  9. 09

    The limit.

    This does not tell you how to shape your data, and it does not tell you which database to pick. The exact guarantees depend on the engine you end up using.

  10. 10

    The action.

    Ask the AI which parts of the app only remember while it is running, then ask what happens to each one after a restart.

  11. 11

    The recap.

    Whatever your app has not written to the database, it forgets.

WANT IT BUILT FOR YOU?

You just learned how. We do it for a living.