Shared infrastructure across applications

Monorepo architecture

TL;DR
  • Multiple apps needed the same infrastructure without blurring runtime boundaries.
  • I needed shared packages to expose server and client entry points intentionally.
  • I separated auth, logging, colour mode, SDK access, docs, and UI primitives into reusable layers.
  • The result was less repeated setup and fewer accidental server-client leaks.

Shared infrastructure is most useful when it removes repeated decisions without hiding important boundaries.

Where it started

Common setup was repeated across apps, but not every shared utility belonged in every runtime.

What needed to change

Common concerns like auth, logging, colour mode, SDK access, docs, and UI primitives live in shared packages. Each package can expose server and client entry points where the runtime boundary matters.

What I built

Applications import the shared layer instead of reimplementing setup. Server-only code stays behind server entry points, while client-safe utilities are exposed separately.

What changed

Teams can reuse infrastructure without accidentally pulling server assumptions into client code or duplicating setup in each app.

What I would watch

Shared packages need strong boundaries. If everything becomes shared, each app loses the freedom to solve its local problem cleanly.