Academy

Vertical Slice Architecture

Cut the code by feature. Everything a feature needs lives together, and slices leave each other alone.

OrdersUsersPaymentsSharedOrderControllerOrderServiceOrderRepoUserControllerUserServiceUserRepoPayControllerPayServicePayRepoShared kernel

Play a scenario

The request still goes endpoint, logic, storage. But the whole trip happens inside one slice, in one folder.

Or test a dependency

Click a component in the diagram, then a second one. You will see whether that import is allowed in this architecture, and why.

An arrow means "depends on" (imports).

Take the same components and turn the cut by ninety degrees. Instead of grouping all controllers together, group everything that belongs to orders together: its endpoint, its logic, its data access.

The one rule

A slice may use its own code and the shared kernel. It never reaches into another slice.

What it buys you

  • A feature change stays in one place
  • Slices can be built, tested, and deleted independently
  • Several people or agents can work in parallel without stepping on each other

What it costs

  • Some duplication between slices is accepted on purpose
  • Technical changes (new database, new framework) touch every slice
  • The shared kernel needs discipline or it becomes a dumping ground

When to pick it

Feature-driven products, larger teams, and codebases where most changes are 'add or change a feature' rather than 'replace a technology'.

Keeping it that way

A diagram like the one above only holds as long as nobody adds the one import that breaks it. TangleGuard reads your real code, shows it as this kind of graph, and checks every dependency against the rule you drew: while you or your agent write, and again before a pull request merges.

Architecture Verification

Protect your codebase now

Two minutes to set up: the CLI, the hook for your agent, and the GitHub Action for every pull request. It runs locally, so your code never leaves your machine.