Start here. This is the direct spoken answer to practice first.
Why this question matters
Compose is useful for describing local service topology and dependencies, but it does not make a laptop identical to production. I would containerize infrastructure consistently while preserving a fast way to run and debug the API.
The Compose file names services, networks, ports, non-secret defaults, health checks, and disposable or persistent development volumes. The API uses service DNS names when it runs in Compose and localhost mappings when it runs directly on the host. depends_on can control start order, but the application still needs bounded connection retry because a started database process may not be ready.