InfrastructureLesson 4 of 47 min

Environments, and why they differ

Local, preview, production: three copies of your app that are never quite identical.

An environment is a complete running copy of your app with its own configuration and, usually, its own data. Most teams run at least three, and understanding what differs between them explains a large fraction of confusing bugs.

  • Local: on your machine, fake data, everything visible, nobody else affected.
  • Preview: a temporary deployment per change, so a proposal can be clicked before it is accepted.
  • Production: real users, real data, real consequences.

The configuration that differs between environments is held in environment variables, values supplied from outside your code. That is why the same build can point at a test database in preview and the real one in production without changing a line.

What to remember

  • An environment is a full copy with its own config and data.
  • Preview deployments make changes reviewable and exercise the deploy path.
  • The dataset is the difference between environments that hurts most.

Terms in this lesson

Show field notes toggles a search param the loader reads. With it off, the slow promise is never created, so nothing streams.