Governing Principle · IEP

<a id="main-heading"></a>

# The Independent Evolution Principle.

> Things that can evolve independently should be owned, represented, and contracted independently. Things that change together live together.

Two shapes looking identical today does not mean they share an owner, a lifecycle, or a reason to change. **Similarity is not ownership.** Align the shape of your dependency graph with the shape of change so every edit stops as close as possible to the place that owns it.

[Try the blast-radius flow](https://dadsframework.dev/independent-evolution.html#simulator) [How frameworks break IEP](https://dadsframework.dev/independent-evolution.html#framework-traps) [The 7 review tests](https://dadsframework.dev/independent-evolution.html#seven-tests)

Interactive flow proof

## Click a change. Watch the blast wave hit the boundary.

A boundary earns its existence by absorbing change. Pick a realistic edit below and trace the arrows: in a coupled codebase, one change ripples through every consumer; under Independent Evolution, the boundary wall stops it cold.

### Shared because they looked alike

No wall · blast cascades

Storage invoices table column renamed Vendor Stripe SDK untouched Shared DTO / Barrel shared/invoice.ts row leaked Client Web app type breaks Client Mobile app older app breaks Domain Shipping reads raw row

Blast radius 5 / 6 modules

CI runs 480 tests

Outcome Mobile breaks

Because the database table is shared as the API DTO, renaming one internal column cascades through every client and sibling domain.

### Independent Evolution (Dads)

Boundary wall stops change

STOPPED AT STORE Storage invoices table column renamed Capability Payments port untouched Boundary billing/store.ts mapped once Wire contract billing/contract contract frozen Clients Web & Mobile untouched Domain Shipping port unchanged

Blast radius 1 / 6 modules

CI runs 3 tests (99% skipped)

Outcome Zero client impact

The persistence boundary absorbs the rename inside billing/store.ts. The hand-written wire contract never moves, so clients and shipping stay untouched.

Mildly petty, technically true

## How popular frameworks bake coupling right into the happy path.

Most frameworks optimize for the 5-minute demo by collapsing independent owners into a single shortcut. It feels fast on day one — then turns every schema change, second client, or vendor swap into a repo-wide tax. Pick a stack to see the trap:

<a id="fw-title"></a>

### Next.js (Server Actions & RSC)

Breaks: Wire ↔ Clients & Persistence ↔ Wire

What Next.js nudges you into

```
// app/invoices/page.tsx (Server Component)
import { db } from "@/lib/db";
import { InvoiceCard } from "./invoice-card";

export default async function Page() {
  // DB row handed straight to UI props — zero wire contract
  const rows = await db.select().from(invoicesTable);
  return <InvoiceCard invoices={rows} />;
}

// app/invoices/actions.ts ("use server")
export async function renameInvoice(id: string, title: string) {
  // Tied to Next's RPC transport; unreachable from mobile or webhooks
}
```

Server Components and 'use server' actions erase the wire boundary completely. Your SQL columns become React props, and mutations live behind a Next-only RPC protocol. The day you add an iOS app, public API, or partner webhook, you have to build a real backend boundary from scratch.

What Dads enforces instead

```
// domains/billing/contract/wire.ts (owned wire boundary)
export const invoiceResponse = z.strictObject({
  id: invoiceId,
  amountMinor: z.number().int(),
});

// apps/web uses typed callApi() — same contract as iOS & webhooks.
// apps/customer exposes OpenAPI 3.1 + compile-time access checks.
```

Web is just one client of an explicit Zod wire contract. Your React UI, mobile app, and external integrations share the exact same typed contract without leaking a single Postgres column.

| Framework / Pattern | Shortcut it pushes | Boundary broken | Day-2 tax |
| --- | --- | --- | --- |
| Next.js | Server Components passing DB rows as props + `"use server"` RPC | Wire ↔ Clients · Persistence ↔ Wire | No real HTTP contract when mobile, webhooks, or a second API arrives. |
| NestJS | Decorated Entity/DTO classes + global DI / `forwardRef()` | Domain ↔ Domain · Persistence ↔ Wire | One class owns SQL + OpenAPI + DTO; DI hides cross-domain coupling until boot. |
| Laravel / Rails | ActiveRecord god-models (`$hidden`, scopes, lazy views) | Persistence ↔ Domain ↔ Wire ↔ UI | Table changes leak into controllers, JSON responses, and templates everywhere. |
| tRPC | Sharing server `typeof appRouter` with inferred ORM returns | Wire ↔ Independently Deployed Clients | Internal refactors break clients in lockstep; non-TS clients get no contract. |
| ORM-derived DTOs | `createSelectSchema(table)` / raw Prisma payload types | Similarity ≠ Ownership | Every new DB column risks leaking on the wire; renames break older clients. |

Both halves of the rule

## Wall off real boundaries. Delete fake abstractions.

IEP cuts in both directions. Putting a boundary between independent owners prevents cascading rewrites. Removing unearned layers inside a single owner prevents enterprise ceremony. Every seam must name the real change it absorbs — if you cannot name one, delete it.

### Meaningful boundaries (wall it off)

Different owners or deploy lifecycles. Explicit contract required.

*   **Wire (API ↔ every client)** Hand-written Zod schemas owned by the wire contract, never derived from database tables.
*   **Domain ↔ domain** A consumer-owned port (a narrow TypeScript type wired in `assembly/`) or domain event — never an internal import.
*   **Persistence ↔ wire** A database row never becomes a public DTO. Rename columns freely without breaking clients.
*   **Application code ↔ swappable vendor** One owned chokepoint (`Authorization`, clock, queue, object storage, email, identity).
*   **Application ↔ framework / package** Public package exports only. Deep imports are blocked mechanically in CI.

### Not boundaries (keep it together)

One owner, always changes together. No port, no extra file, no fake layer.

*   **A route, its handler, and its access declaration** Keep them together in one route definition. Separating a route from its permission check hides bugs.
*   **Row/insert types and their table definition** Derive internal row types straight from the Drizzle table schema. Only the wire boundary is hand-written.
*   **A feature page and its data loader** One UI feature owns both. Adding a generic repository layer between them absorbs zero real change.
*   **An SDK facade and its only implementation** Do not invent a `FooServiceInterface` + `FooServiceImpl` when only one implementation exists.

**One deliberate test seam:** An operation may reach its own domain's store through a narrow reader/writer contract so pure unit tests can swap in an in-memory fake. That is a test seam, not an architectural boundary — it never re-implements PostgreSQL locks or constraints, and nothing else inside one owner gets a fake.

In actual code

## Three boundary decisions, side by side.

1\. Persistence vs. Wire: never derive public API shapes from DB tables Boundary required

Coupled: DB schema leaks onto the wire

```
// Renaming a column breaks mobile & web clients
export const invoiceDto = createSelectSchema(invoicesTable);

// Also silently exposes internal columns like
// internal_cost_cents or stripe_customer_id.
```

One schema serves two owners (Postgres storage and external HTTP clients) with different lifecycles.

IEP: hand-written wire contract + explicit mapper

```
// domains/billing/contract/wire.ts (wire owner)
export const invoiceResponse = z.strictObject({
  id: invoiceId,
  amountMinor: z.number().int(),
  currency: z.string(),
});
```

Postgres columns can be renamed, split, or indexed inside `billing/server/` while the wire stays frozen.

2\. Domain vs. Domain: consumer-owned port instead of private imports Boundary required

Coupled: Shipping reaches into Billing internals

```
// domains/shipping/server/routes.ts
import { invoicesTable } from "../../billing/server/tables.js";
// Every Billing migration now dirties Shipping's tests.
```

Shipping depends on how Billing happens to store rows today rather than the fact it actually needs.

IEP: narrow consumer port bound in assembly/

```
// domains/shipping/server/ports.ts
export type OrderPaymentStatus = {
  isPaid(orderId: OrderId): Promise<boolean>;
};
// Wired once in assembly/services.ts — enforced by dad check boundaries.
```

Shipping depends only on `isPaid(orderId)`. Billing can replace its entire storage engine underneath.

3\. Inside one owner: delete unearned interfaces and layers Not a boundary

Unearned indirection: 4 files for 1 owner

```
NoteValidatorInterface.ts
NoteValidatorImpl.ts
NoteMapperFactory.ts
NoteControllerAdapter.ts
// No second implementation exists. Changes hit all 4 files.
```

Abstracting inside one owner creates ceremony without absorbing any real independent change.

IEP: concrete code living together

```
// domains/notes/pure/note-rules.ts
export function normalizeTitle(raw: string): string {
  return raw.trim().replace(/\s+/g, " ");
}
// Direct import, concrete types, zero ceremony.
```

IEP outranks structural habits whenever a habit demands a seam that cannot name a real change it absorbs.

Design & PR checklist

## The 7 tests for every boundary and abstraction.

Run these seven questions during code review or architecture design. They replace taste arguments with one consistent rule.

1.  Test 01 · Change
    
    ### What stops here?
    
    Name the exact changes that must stop at this boundary. If nothing stops, the boundary is decorative.
    
2.  Test 02 · Ownership
    
    ### Who owns the meaning?
    
    Dependencies point toward whoever owns the meaning, not toward whichever file happened to exist first.
    
3.  Test 03 · Evolution
    
    ### Do these move separately?
    
    Could both sides reasonably change at different times for different reasons? If yes, separate them.
    
4.  Test 04 · Leak
    
    ### Contract or internals?
    
    Is the consumer relying on what the provider means to expose, or on how it happens to be implemented?
    
5.  Test 05 · Abstraction
    
    ### What change is absorbed?
    
    Name a real second client, vendor swap, or domain release. If you cannot name one, delete the layer.
    
6.  Test 06 · Coupling
    
    ### What else gets dirty?
    
    If this file changes, what else re-runs in CI? Run `dad-test diagnose` to measure the real blast radius.
    
7.  Test 07 · Sharing
    
    ### Same owner or same shape?
    
    Are we sharing a type because both concepts truly evolve together, or merely because they look alike today?
    

The payoff

## Why Dads enforces IEP mechanically.

An architectural principle is unfinished until ordinary tools enforce it. Every major tool in Dads is a direct consequence of the Independent Evolution Principle.

### Enforced domain walls

`dad check boundaries` and `dad doctor --gate` stop cross-domain imports, vendor leaks, and unsafe shortcuts before code review — whether a human or an AI agent wrote the PR.

[Multi-API & CI gates →](https://dadsframework.dev/docs/boundaries-and-apis)

### Replaceable authorization

Every permission check runs behind one app-owned `Authorization` capability proved in 27 Lean 4 theorems — swap PostgreSQL, SQLite, or SpiceDB at one seam without touching a single route.

[Access benchmarks & proofs →](https://dadsframework.dev/docs/access-benchmarks)

### 90–99% faster selective CI

When your dependency graph matches real ownership, `dad-test` mathematically proves which tests a diff can reach (36 Lean 4 theorems) — and `dad-test diagnose` exposes every leak.

[Testing benchmarks & proofs →](https://dadsframework.dev/docs/testing-benchmarks)

## Keep reading

[Where Does Code Go?One-page placement map](https://dadsframework.dev/docs/where-code-goes) [Selective Testing & TIA (dad-test)Blast radius in CI](https://dadsframework.dev/docs/selective-testing) [Benchmarks & Formal Proofs63 Lean 4 theorems](https://dadsframework.dev/docs/benchmarks-and-proof) [Full Guiding Principles essaydocs/principles.md](https://github.com/brytoncooper/dads-framework/blob/main/docs/principles.md)

Canonical page: <https://dadsframework.dev/independent-evolution.html>
