Back to blog

Ports & Adapters in Practice

architecturepatternsplatform

There are architectural decisions after which you realize: I've been doing this inefficiently the whole time.

KB Labs was only four months old, but by that point I'd already understood something important. Sometimes a platform stalls not because something is broken inside it, but because it's standing on the wrong foundation.

I had bits and pieces of Ports & Adapters before, but only in the plugin system. The platform itself lived by its own rules — separate dependencies, separate conventions. Every time something needed to connect, it took a fair amount of glue to make things fit.

Plugins were on a highway. The platform was on a dirt road.

At some point I decided: enough. We're moving everything to Ports & Adapters.

What this even means

Think of your home router.

A port is the socket. It's always the same — a standard-shaped hole.

An adapter is the cable. It connects your port to whatever you need: the internet, a VPN, a different provider, Starlink — anything.

Change the adapter — the behavior changes. But the port itself stays intact.

Same idea in a system:

  • Want to log to Loki? One adapter.
  • Want Grafana Cloud? Another adapter.
  • Want plain files? A third one.
  • Want a custom analytics service? Go ahead.

The platform doesn't even blink. Same interface, same rules, same foundation.

Adapter changes → capabilities grow → core stays untouched.

That's the moment when a system starts feeling... right.

What changed after the migration

Yes, there are slightly more abstractions. But in return I got:

  • A single standard for everything — plugins and platform alike
  • Infinite extension points
  • New adapters in five minutes
  • Zero fear of "breaking the core"
  • Clean boundaries between layers

Adding a new service went from "an evening of refactoring" to plugging in a cable.

The takeaway

Good architecture is like good wiring in a house. If the outlets are done right, you can plug in anything — a kettle, a lamp, a server, a space station.

Ports & Adapters gave KB Labs exactly that feeling. The system finally sits on rails, not on crutches. And now it's strange to remember how it was before.