What changes when it leaves your machine

Four things, and every one of them causes a first-deploy problem:

It has to keep running. On your computer you start it and watch it. On a server it must
start by itself and restart if it stops.

The address changes. No more localhost:3000.

The database file lives somewhere else. And on many hosts, files written by your app
disappear when it restarts. For Recall this matters — recall.db is your entire data.

Settings come from outside the code. The port, the database path, and anything secret.

The request

Prepare this project to run on a server.

Goal:
The app should start with one command and keep running, using settings
from environment variables instead of values written into the code.

Changes needed:
- The port comes from process.env.PORT, defaulting to 3000.
- The database path comes from process.env.DATABASE_PATH,
  defaulting to ./recall.db.
- Add a start script that runs the built app, not the TypeScript source.
- Add a /health page that returns OK, so the host can check it is alive.
- Write a short DEPLOY.md explaining how to run it.

Limits:
- Do not add a framework.
- Do not change any application behaviour.

Done when:
- npm run build then npm start serves the app.
- Setting PORT=4000 actually changes the port.
- npm test still passes.

The part that will bite you

Your data. On a lot of hosting, the disk is wiped on every restart. If recall.db sits
there, your cards vanish and nobody tells you.

Ask directly:

On this host, is the file at DATABASE_PATH kept when the app restarts?
If not, what are my options?

Do not skip this. Losing a week of study data is exactly the kind of quiet failure this
course keeps warning about — nothing crashes, and the app cheerfully shows you an empty
list.

Check it properly

Once it is live:

  1. Open it on your phone, on mobile data, not your home wifi.
  2. Add a card.
  3. Restart the app. Is the card still there?
  4. Review a card, close the browser, come back. Did it save?

Step 3 is the one people skip and the one that matters.

Try this before the next lesson

  1. Deploy it. Write down every problem you hit.
  2. Do the restart test. Be honest about the result.
  3. Send the link to one person and watch them use it without help.