The twelve-factor mindset
Modern apps follow the twelve-factor principles, the most important being:
- Config lives in the environment, never the code.
- State is stored outside the process (a database), so any instance can handle any request.
- Logs are streamed to stdout, never written to files.
An app built this way can run on many servers at once, behind a load balancer, and scale up by simply adding more identical machines. That is how apps serve millions of users.