Skip to content

Authoring Reusable Constructs

Most teams eventually outgrow a single app.py file. The next step is not to hide everything behind abstractions immediately. It is to introduce reusable constructs where they add real clarity.

Good Candidates For Reuse

  • a network baseline used by many stacks
  • a service pattern composed of several resources
  • backend bootstrapping patterns
  • provider setup with opinionated defaults

What To Keep Explicit

Keep these visible at the app layer as long as possible:

  • environment selection
  • stack boundaries
  • backend selection
  • deployment ordering

These choices affect operations, not just code style.

A Good Reusable Construct Should

  • have a clear purpose
  • expose a small public surface
  • avoid hiding major operational behavior
  • return outputs or attributes that downstream stacks can use naturally