# Codebase / System Architecture Styles

> Every principle in this category is listed as a record.

Page: Ontology · Principles
Canonical: https://banes-lab.com/ontology#architecture-category-codebase-system-architecture-styles

Listed in [Ontology · Principles](https://banes-lab.com/api/pages/ontology/principles.md), after [Security / Privacy / Compliance / Governance](https://banes-lab.com/ontology/principles/architecture-category-security-privacy-compliance-governance.md) and before [Coordination Surfaces](https://banes-lab.com/ontology/principles/architecture-category-coordination-surfaces.md).

Every principle in this category is listed as a record. Each record carries its kind, its severity, the scopes it applies at and the layer it lives in, then the edge relations that join it to other records, the records that point back at it, the contracts that answer to it and the tensions it takes part in. The descriptors say how it is violated, detected, measured, repaired and enforced. Where the record carries one, an exemplar shows the shape before and after the principle is applied.

Relations diagram

The relations inside this category.

```mermaid
flowchart LR
n_ports_and_adapters_architecture["Ports and Adapters Architecture"]
n_hexagonal_architecture["Hexagonal Architecture"]
n_clean_architecture["Clean Architecture"]
n_layered_architecture["Layered Architecture"]
n_component_based_architecture["Component-Based Architecture"]
n_package_by_feature["Package by Feature"]
n_microservices["Microservices"]
n_monolith_architecture["Monolith Architecture"]
n_pipes_and_filters["Pipes and Filters"]
n_service_oriented_architecture["Service-Oriented Architecture"]
n_space_based_architecture["Space-Based Architecture"]
n_hexagonal_architecture --> n_clean_architecture
```

### Ports and Adapters Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: application, service, component
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of placing every external dependency behind a port the application owns, implemented by an adapter outside it.

Requires
[Ports](https://banes-lab.com/records/lexicon/ports.md), [Adapters](https://banes-lab.com/records/lexicon/adapters.md), [Dependency Inversion Principle (DIP)](https://banes-lab.com/records/architecture/dependency-inversion.md)

Reinforces
[Replaceability](https://banes-lab.com/records/architecture/replaceability.md), [Testability](https://banes-lab.com/records/architecture/testability.md)

Enables
[Infrastructure Independence](https://banes-lab.com/records/lexicon/infrastructure-independence.md)

In tension with
[Boilerplate](https://banes-lab.com/records/lexicon/boilerplate.md)

Conflicts with
[Framework Leakage](https://banes-lab.com/records/architecture/framework-leakage.md)

Tensions
[Ports and Adapters Architecture / Boilerplate](https://banes-lab.com/records/tension/boilerplate-ports-and-adapters-architecture.md)

Violated by
domain/application importing infrastructure

Detected by
inward/outward dependency violations

Measured by
adapter coverage, boundary purity

Refactored by
Introduce Port, Extract Adapter

Enforced by
layer dependency rules

Before

```typescript
class FooService {
save(foo: Foo) { return sql.query("insert into foo values (?)", foo); }
}
```

After

```typescript
interface SaveFooPort { save(foo: Foo): Promise<void>; }
class FooService {
constructor(private readonly port: SaveFooPort) {}
save(foo: Foo) { return this.port.save(foo); }
}
class SqlFooAdapter implements SaveFooPort { save(foo: Foo) { return sqlFooStore.save(foo); } }
```

How it is checked

Checked by
layer dependency rules

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Ports](https://banes-lab.com/records/lexicon/ports.md), [Adapters](https://banes-lab.com/records/lexicon/adapters.md), [Dependency Inversion Principle (DIP)](https://banes-lab.com/records/architecture/dependency-inversion.md), [Replaceability](https://banes-lab.com/records/architecture/replaceability.md), [Testability](https://banes-lab.com/records/architecture/testability.md), [Infrastructure Independence](https://banes-lab.com/records/lexicon/infrastructure-independence.md)

Shape it refuses
[Framework Leakage](https://banes-lab.com/records/architecture/framework-leakage.md), [Framework Leakage](https://banes-lab.com/records/architecture/framework-leakage.md)

### Hexagonal Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: application, service
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of keeping a domain core free of framework and data types, with every input and output reached through ports.

Requires
[Ports and Adapters](https://banes-lab.com/records/lexicon/ports-and-adapters.md), [Domain Core](https://banes-lab.com/records/lexicon/domain-core.md)

Reinforces
[Clean Architecture](https://banes-lab.com/records/architecture/clean-architecture.md), [Testability](https://banes-lab.com/records/architecture/testability.md)

Enables
[External System Isolation](https://banes-lab.com/records/lexicon/external-system-isolation.md)

In tension with
[Initial Complexity](https://banes-lab.com/records/lexicon/initial-complexity.md)

Conflicts with
[Framework-Centric Core](https://banes-lab.com/records/lexicon/framework-centric-core.md)

Tensions
[Hexagonal Architecture / Initial Complexity](https://banes-lab.com/records/tension/hexagonal-architecture-initial-complexity.md)

Distinct from
[Clean Architecture](https://banes-lab.com/records/architecture/clean-architecture.md): Hexagonal architecture isolates the core behind ports, while clean architecture arranges concentric layers whose dependencies point inward.

Violated by
framework/data types in core

Detected by
dependency direction violations

Measured by
core purity score

Refactored by
Move Framework Outward, Add Ports

Enforced by
architecture tests

Before

```typescript
app.post("/foo", async request => sqlFooStore.save(await request.json()));
```

After

```typescript
class CreateFooUseCase {
constructor(private readonly foos: FooRepository, private readonly events: EventPublisher) {}
execute(input: CreateFoo) { return createFooCore(input, this.foos, this.events); }
}
httpAdapter.bind("POST", "/foo", input => useCase.execute(input));
```

How it is checked

Checked by
architecture tests

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Ports and Adapters](https://banes-lab.com/records/lexicon/ports-and-adapters.md), [Domain Core](https://banes-lab.com/records/lexicon/domain-core.md), [Clean Architecture](https://banes-lab.com/records/architecture/clean-architecture.md), [Testability](https://banes-lab.com/records/architecture/testability.md), [External System Isolation](https://banes-lab.com/records/lexicon/external-system-isolation.md)

Shape it refuses
[Framework-Centric Core](https://banes-lab.com/records/lexicon/framework-centric-core.md)

### Clean Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: application, system
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of concentric layers in which source dependencies point only inward, towards the use cases and entities.

Requires
[Dependency Rule](https://banes-lab.com/records/lexicon/dependency-rule.md), [Use Cases](https://banes-lab.com/records/lexicon/use-cases.md), [Boundaries](https://banes-lab.com/records/lexicon/boundaries.md)

Reinforces
[Dependency Inversion Principle (DIP)](https://banes-lab.com/records/architecture/dependency-inversion.md), [Testability](https://banes-lab.com/records/architecture/testability.md)

Enables
[Framework Independence](https://banes-lab.com/records/lexicon/framework-independence.md)

In tension with
[Boilerplate](https://banes-lab.com/records/lexicon/boilerplate.md)

Conflicts with
[Layer Leakage](https://banes-lab.com/records/lexicon/layer-leakage.md)

Referenced by
[Dependency Inversion Principle (DIP)](https://banes-lab.com/records/architecture/dependency-inversion.md), [Hexagonal Architecture](https://banes-lab.com/records/architecture/hexagonal-architecture.md)

Tensions
[Clean Architecture / Boilerplate](https://banes-lab.com/records/tension/boilerplate-clean-architecture.md)

Violated by
outer layers imported by inner layers

Detected by
dependency rule violations

Measured by
inward dependency compliance

Refactored by
Move Logic Inward, Extract Interface, Add Adapter

Enforced by
dependency graph rules

Before

```typescript
class FooController {
async create(request: Request) { return orm.foo.create(await request.json()); }
}
```

After

```typescript
interface CreateFooGateway { save(foo: Foo): Promise<void>; }
class CreateFooInteractor {
constructor(private readonly gateway: CreateFooGateway) {}
execute(input: CreateFooInput) { return this.gateway.save(Foo.create(input)); }
}
class FooController { constructor(private readonly useCase: CreateFooInteractor) {} }
```

How it is checked

Checked by
dependency graph rules

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Dependency Rule](https://banes-lab.com/records/lexicon/dependency-rule.md), [Use Cases](https://banes-lab.com/records/lexicon/use-cases.md), [Boundaries](https://banes-lab.com/records/lexicon/boundaries.md), [Dependency Inversion Principle (DIP)](https://banes-lab.com/records/architecture/dependency-inversion.md), [Testability](https://banes-lab.com/records/architecture/testability.md), [Framework Independence](https://banes-lab.com/records/lexicon/framework-independence.md)

Shape it refuses
[Layer Leakage](https://banes-lab.com/records/lexicon/layer-leakage.md)

### Layered Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- Scope: application, system
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of stacking presentation, application and persistence layers, each calling only the layer below it.

Requires
[Layer Separation](https://banes-lab.com/records/lexicon/layer-separation.md)

Reinforces
[Separation of Concerns](https://banes-lab.com/records/architecture/separation-of-concerns.md)

Enables
[Structured Code Organization](https://banes-lab.com/records/lexicon/structured-code-organization.md)

In tension with
[Anemic Layers](https://banes-lab.com/records/lexicon/anemic-layers.md)

Conflicts with
[Layer Skipping](https://banes-lab.com/records/lexicon/layer-skipping.md)

Referenced by
[Separation of Concerns](https://banes-lab.com/records/architecture/separation-of-concerns.md)

Tensions
[Layered Architecture / Anemic Layers](https://banes-lab.com/records/tension/anemic-layers-layered-architecture.md)

Violated by
presentation accessing persistence directly

Detected by
forbidden layer imports

Measured by
layer violation count

Refactored by
Move Logic, Introduce Service/Repository Boundary

Enforced by
layer rules

Before

```typescript
function createFoo(request: Request) {
return sql.query("insert into foo values (?)", JSON.parse(request.body));
}
```

After

```typescript
class FooController { constructor(private readonly service: FooService) {} }
class FooService { constructor(private readonly repository: FooRepository) {} }
class SqlFooRepository implements FooRepository { save(foo: Foo) { return fooTable.insert(foo); } }
```

How it is checked

Checked by
layer rules

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Layer Separation](https://banes-lab.com/records/lexicon/layer-separation.md), [Separation of Concerns](https://banes-lab.com/records/architecture/separation-of-concerns.md), [Structured Code Organization](https://banes-lab.com/records/lexicon/structured-code-organization.md)

Shape it refuses
[Layer Skipping](https://banes-lab.com/records/lexicon/layer-skipping.md)

### Component-Based Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: component, system
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of building a system from components that declare what they export and what they require.

Requires
[Component Boundaries](https://banes-lab.com/records/lexicon/component-boundaries.md), [Contracts](https://banes-lab.com/records/lexicon/contracts.md)

Reinforces
[Modularity](https://banes-lab.com/records/architecture/modularity.md), [Composability](https://banes-lab.com/records/architecture/composability.md)

Enables
[Reuse](https://banes-lab.com/records/lexicon/reuse.md), [Replaceability](https://banes-lab.com/records/architecture/replaceability.md)

In tension with
[Integration Overhead](https://banes-lab.com/records/lexicon/integration-overhead.md)

Conflicts with
[Big Ball of Mud](https://banes-lab.com/records/architecture/big-ball-of-mud.md)

Tensions
[Component-Based Architecture / Integration Overhead](https://banes-lab.com/records/tension/component-based-architecture-integration-overhead.md)

Violated by
component internals accessed externally

Detected by
boundary import violations

Measured by
component cohesion/coupling

Refactored by
Extract Component, Define Contract

Enforced by
component ownership rules

Before

```typescript
const app = {
createFoo,
createBar,
renderFoo,
saveBar,
publishBaz,
};
```

After

```typescript
const fooComponent = defineComponent({
name: "foo",
exports: { createFoo, FooView },
requires: { FooStore, EventBus },
});
```

How it is checked

Checked by
component ownership rules

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Component Boundaries](https://banes-lab.com/records/lexicon/component-boundaries.md), [Contracts](https://banes-lab.com/records/lexicon/contracts.md), [Modularity](https://banes-lab.com/records/architecture/modularity.md), [Composability](https://banes-lab.com/records/architecture/composability.md), [Reuse](https://banes-lab.com/records/lexicon/reuse.md), [Replaceability](https://banes-lab.com/records/architecture/replaceability.md)

Shape it refuses
[Big Ball of Mud](https://banes-lab.com/records/architecture/big-ball-of-mud.md)

### Package by Feature

- Kind: [principle](https://banes-lab.com/records/kind/principle.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: package, module
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A design rule that code is grouped by the feature it serves, so one change stays inside one package.

Requires
[Feature Cohesion](https://banes-lab.com/records/lexicon/feature-cohesion.md)

Reinforces
[Modularity](https://banes-lab.com/records/architecture/modularity.md), [Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md)

Enables
[Locality of Change](https://banes-lab.com/records/lexicon/locality-of-change.md)

In tension with
[Shared Technical Concerns](https://banes-lab.com/records/lexicon/shared-technical-concerns.md)

Conflicts with
[Package by Technical Layer Only](https://banes-lab.com/records/lexicon/package-by-technical-layer-only.md)

Tensions
[Package by Feature / Shared Technical Concerns](https://banes-lab.com/records/tension/package-by-feature-shared-technical-concerns.md)

Violated by
feature logic scattered across technical folders

Detected by
change sets spanning many layer packages

Measured by
change locality

Refactored by
Repackage by Feature, Move Classes

Enforced by
package conventions

Before

```typescript
src/controllers/foo.ts
src/controllers/bar.ts
src/services/foo.ts
src/services/bar.ts
src/repositories/foo.ts
src/repositories/bar.ts
```

After

```typescript
src/foo/controller.ts
src/foo/service.ts
src/foo/repository.ts
src/bar/controller.ts
src/bar/service.ts
src/bar/repository.ts
```

How it is checked

Checked by
package conventions

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Feature Cohesion](https://banes-lab.com/records/lexicon/feature-cohesion.md), [Modularity](https://banes-lab.com/records/architecture/modularity.md), [Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md), [Locality of Change](https://banes-lab.com/records/lexicon/locality-of-change.md)

Shape it refuses
[Package by Technical Layer Only](https://banes-lab.com/records/lexicon/package-by-technical-layer-only.md)

### Microservices

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- Scope: system, service, deployment
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of splitting a system into services that each own their data and deploy independently.

Requires
[Autonomy](https://banes-lab.com/records/architecture/autonomy.md), [Independent Deployment](https://banes-lab.com/records/lexicon/independent-deployment.md)

Reinforces
[Scalability](https://banes-lab.com/records/architecture/scalability.md), [Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md)

Enables
[Decentralized Ownership](https://banes-lab.com/records/lexicon/decentralized-ownership.md)

In tension with
[Operational Complexity](https://banes-lab.com/records/lexicon/operational-complexity.md), [Consistency](https://banes-lab.com/records/architecture/consistency.md)

Conflicts with
[Distributed Monolith](https://banes-lab.com/records/architecture/distributed-monolith.md)

Referenced by
[Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md), [Decentralization](https://banes-lab.com/records/architecture/decentralization.md), [Autonomy](https://banes-lab.com/records/architecture/autonomy.md)

Tensions
[Microservices / Operational Complexity](https://banes-lab.com/records/tension/microservices-operational-complexity.md), [Microservices / Consistency](https://banes-lab.com/records/tension/consistency-microservices.md)

Violated by
shared databases, synchronous service chains

Detected by
deployment coupling, cross-service transactions

Measured by
deploy independence, coupling metrics

Refactored by
Split Service, [Own Data](https://banes-lab.com/records/lexicon/own-data.md), Add Events

Enforced by
service ownership, API contracts

Before

```typescript
class SharedApplication {
createFoo(foo: Foo) { return sharedDb.insert("foo", foo); }
createBar(bar: Bar) { return sharedDb.insert("bar", bar); }
}
```

After

```typescript
class FooService {
constructor(private readonly fooStore: FooStore, private readonly outbox: Outbox) {}
create(foo: Foo) { return transact(() => [this.fooStore.save(foo), this.outbox.append(fooCreated(foo))]); }
}
class BarService { constructor(private readonly barStore: BarStore) {} }
```

How it is checked

Checked by
service ownership, API contracts

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Autonomy](https://banes-lab.com/records/architecture/autonomy.md), [Independent Deployment](https://banes-lab.com/records/lexicon/independent-deployment.md), [Scalability](https://banes-lab.com/records/architecture/scalability.md), [Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md), [Decentralized Ownership](https://banes-lab.com/records/lexicon/decentralized-ownership.md)

Shape it refuses
[Distributed Monolith](https://banes-lab.com/records/architecture/distributed-monolith.md)

### Monolith Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- Scope: application, deployment
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of deploying a system as one unit, with its modules kept apart by internal boundaries.

Requires
[Unified Deployment Boundary](https://banes-lab.com/records/lexicon/unified-deployment-boundary.md)

Reinforces
[Operational Simplicity](https://banes-lab.com/records/lexicon/operational-simplicity.md)

Enables
[Transactional Simplicity](https://banes-lab.com/records/lexicon/transactional-simplicity.md)

In tension with
[Team Autonomy](https://banes-lab.com/records/lexicon/team-autonomy.md), [Independent Scaling](https://banes-lab.com/records/lexicon/independent-scaling.md)

Conflicts with
[Unbounded Big Ball of Mud](https://banes-lab.com/records/lexicon/unbounded-big-ball-of-mud.md)

Tensions
[Monolith Architecture / Team Autonomy](https://banes-lab.com/records/tension/monolith-architecture-team-autonomy.md), [Monolith Architecture / Independent Scaling](https://banes-lab.com/records/tension/independent-scaling-monolith-architecture.md)

Violated by
unclear internal boundaries

Detected by
cyclic packages, high global coupling

Measured by
module boundary health

Refactored by
Modularize Internally, Add Boundaries

Enforced by
modular monolith rules

Before

```typescript
await http.post("foo-service", foo);
await http.post("bar-service", bar);
await http.post("baz-service", baz);
```

After

```typescript
class ModularMonolith {
constructor(readonly foo: FooModule, readonly bar: BarModule, readonly baz: BazModule) {}
}
await app.foo.create(foo);
await app.bar.create(bar);
```

How it is checked

Checked by
modular monolith rules

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Unified Deployment Boundary](https://banes-lab.com/records/lexicon/unified-deployment-boundary.md), [Operational Simplicity](https://banes-lab.com/records/lexicon/operational-simplicity.md), [Transactional Simplicity](https://banes-lab.com/records/lexicon/transactional-simplicity.md)

Shape it refuses
[Unbounded Big Ball of Mud](https://banes-lab.com/records/lexicon/unbounded-big-ball-of-mud.md)

### Pipes and Filters

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- Scope: application, data processing, composition
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of processing data through independent stages that share one input and output interface.

Requires
[Uniform Stage Interface](https://banes-lab.com/records/lexicon/uniform-stage-interface.md)

Reinforces
[Single Responsibility Principle (SRP)](https://banes-lab.com/records/architecture/single-responsibility.md), [Composability](https://banes-lab.com/records/architecture/composability.md)

Enables
[Reorderable Stages](https://banes-lab.com/records/lexicon/reorderable-stages.md), [Independent Stage Testing](https://banes-lab.com/records/lexicon/independent-stage-testing.md)

In tension with
[End-to-End Traceability](https://banes-lab.com/records/lexicon/end-to-end-traceability.md)

Conflicts with
[Monolithic Transform Function](https://banes-lab.com/records/lexicon/monolithic-transform-function.md)

Tensions
[Pipes and Filters / End-to-End Traceability](https://banes-lab.com/records/tension/end-to-end-traceability-pipes-and-filters.md)

Violated by
one function performing every transform step inline

Detected by
long sequential transform bodies

Measured by
transform-step count per function

Refactored by
Extract Filters, Connect via Pipeline

Enforced by
[design review](https://banes-lab.com/records/architecture/design-review.md)

Before

```typescript
function processFoo(raw: string) {
const parsed = parseFoo(raw);
const cleaned = cleanFoo(parsed);
return enrichFoo(cleaned);
}
```

After

```typescript
const filters: FooFilter[] = [parseFoo, cleanFoo, enrichFoo];
const fooPipeline = connect(filters);
fooPipeline.run(raw);
```

How it is checked

Checked by
design review

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Uniform Stage Interface](https://banes-lab.com/records/lexicon/uniform-stage-interface.md), [Single Responsibility Principle (SRP)](https://banes-lab.com/records/architecture/single-responsibility.md), [Composability](https://banes-lab.com/records/architecture/composability.md), [Reorderable Stages](https://banes-lab.com/records/lexicon/reorderable-stages.md), [Independent Stage Testing](https://banes-lab.com/records/lexicon/independent-stage-testing.md)

Shape it refuses
[Monolithic Transform Function](https://banes-lab.com/records/lexicon/monolithic-transform-function.md)

### Service-Oriented Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- Scope: application, service, integration
- Aliases: SOA
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of exposing each business capability as a service governed by a published contract.

Requires
[Service Contract](https://banes-lab.com/records/architecture/service-contract.md)

Reinforces
[Autonomy](https://banes-lab.com/records/architecture/autonomy.md), [Low Coupling](https://banes-lab.com/records/architecture/low-coupling.md)

Enables
[Contract-Governed Service Reuse](https://banes-lab.com/records/lexicon/contract-governed-service-reuse.md)

In tension with
[Operational Overhead](https://banes-lab.com/records/lexicon/operational-overhead.md)

Conflicts with
[Shared Monolithic Application](https://banes-lab.com/records/lexicon/shared-monolithic-application.md)

Tensions
[Service-Oriented Architecture / Operational Overhead](https://banes-lab.com/records/tension/operational-overhead-service-oriented-architecture.md)

Violated by
capabilities bundled in one application object

Detected by
unrelated operations sharing one class/module

Measured by
capability cohesion per module

Refactored by
Expose Capabilities as Contracted Services

Enforced by
[architecture review](https://banes-lab.com/records/architecture/architecture-review.md)

Before

```typescript
class Application {
createFoo() {}
createBar() {}
createBaz() {}
}
```

After

```typescript
const fooService = registerService("FooService", { create: createFoo }, { contract: FooServiceContract });
serviceBus.expose(fooService);
```

How it is checked

Checked by
architecture review

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Service Contract](https://banes-lab.com/records/architecture/service-contract.md), [Autonomy](https://banes-lab.com/records/architecture/autonomy.md), [Low Coupling](https://banes-lab.com/records/architecture/low-coupling.md), [Contract-Governed Service Reuse](https://banes-lab.com/records/lexicon/contract-governed-service-reuse.md)

Shape it refuses
[Shared Monolithic Application](https://banes-lab.com/records/lexicon/shared-monolithic-application.md)

### Space-Based Architecture

- Kind: [style](https://banes-lab.com/records/kind/style.md)
- Category: [Codebase / System Architecture Styles](https://banes-lab.com/ontology/principles/architecture-category-codebase-system-architecture-styles.md)
- Severity: [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- Scope: application, scalability, distributed state
- Layer: [Structural Core](https://banes-lab.com/records/layer/structural-core.md)

Details

Definition
A convention of holding working state in a replicated in-memory space, so no central database limits scaling.

Requires
[Replicated In-Memory State](https://banes-lab.com/records/lexicon/replicated-in-memory-state.md)

Reinforces
[Horizontal Scaling](https://banes-lab.com/records/architecture/horizontal-scaling.md), [Elasticity](https://banes-lab.com/records/architecture/elasticity.md)

Enables
[Database-Bottleneck Removal](https://banes-lab.com/records/lexicon/database-bottleneck-removal.md)

In tension with
[Consistency](https://banes-lab.com/records/architecture/consistency.md)

Conflicts with
[Central Database Bottleneck](https://banes-lab.com/records/lexicon/central-database-bottleneck.md)

Tensions
[Space-Based Architecture / Consistency](https://banes-lab.com/records/tension/consistency-space-based-architecture.md)

Violated by
all reads/writes funneled through one central database

Detected by
single datastore as the scaling limit

Measured by
central-datastore contention rate

Refactored by
Adopt a Replicated Data Space

Enforced by
[architecture review](https://banes-lab.com/records/architecture/architecture-review.md)

Before

```typescript
const foo = await centralDatabase.find(id);
```

After

```typescript
const foo = await fooSpace.read(id);
fooSpace.on("write", replicateToPeers);
```

How it is checked

Checked by
architecture review

Population
Every import, package and service boundary the style's dependency rules range over

Freshness
A verdict stands until an import, a package boundary or a deployment unit changes

Refusal
The layer or dependency rule fails the build on an edge the style forbids

Observation
The import graph and the deployment topology, read from source and configuration

Evidence
None, because the catalog states this check as a class, so a watched run belongs to each system that adopts it

Authoritative side
The style's declared dependency rules, which every import and deployment edge conforms to

Depends on
[Replicated In-Memory State](https://banes-lab.com/records/lexicon/replicated-in-memory-state.md), [Horizontal Scaling](https://banes-lab.com/records/architecture/horizontal-scaling.md), [Elasticity](https://banes-lab.com/records/architecture/elasticity.md), [Database-Bottleneck Removal](https://banes-lab.com/records/lexicon/database-bottleneck-removal.md)

Shape it refuses
[Central Database Bottleneck](https://banes-lab.com/records/lexicon/central-database-bottleneck.md)

## Links to

- [style](https://banes-lab.com/records/kind/style.md)
- [recommended](https://banes-lab.com/records/vocabulary/severity-recommended.md)
- [Structural Core](https://banes-lab.com/records/layer/structural-core.md)
- [Ports](https://banes-lab.com/records/lexicon/ports.md)
- [Adapters](https://banes-lab.com/records/lexicon/adapters.md)
- [Dependency Inversion Principle](https://banes-lab.com/records/architecture/dependency-inversion.md)
- [Replaceability](https://banes-lab.com/records/architecture/replaceability.md)
- [Testability](https://banes-lab.com/records/architecture/testability.md)
- [Infrastructure Independence](https://banes-lab.com/records/lexicon/infrastructure-independence.md)
- [Boilerplate](https://banes-lab.com/records/lexicon/boilerplate.md)
- [Framework Leakage](https://banes-lab.com/records/architecture/framework-leakage.md)
- [Ports and Adapters Architecture / Boilerplate](https://banes-lab.com/records/tension/boilerplate-ports-and-adapters-architecture.md)
- [Ports and Adapters](https://banes-lab.com/records/lexicon/ports-and-adapters.md)
- [Domain Core](https://banes-lab.com/records/lexicon/domain-core.md)
- [Clean Architecture](https://banes-lab.com/records/architecture/clean-architecture.md)
- [External System Isolation](https://banes-lab.com/records/lexicon/external-system-isolation.md)
- [Initial Complexity](https://banes-lab.com/records/lexicon/initial-complexity.md)
- [Framework-Centric Core](https://banes-lab.com/records/lexicon/framework-centric-core.md)
- [Hexagonal Architecture / Initial Complexity](https://banes-lab.com/records/tension/hexagonal-architecture-initial-complexity.md)
- [Dependency Rule](https://banes-lab.com/records/lexicon/dependency-rule.md)
- [Use Cases](https://banes-lab.com/records/lexicon/use-cases.md)
- [Boundaries](https://banes-lab.com/records/lexicon/boundaries.md)
- [Framework Independence](https://banes-lab.com/records/lexicon/framework-independence.md)
- [Layer Leakage](https://banes-lab.com/records/lexicon/layer-leakage.md)
- [Hexagonal Architecture](https://banes-lab.com/records/architecture/hexagonal-architecture.md)
- [Clean Architecture / Boilerplate](https://banes-lab.com/records/tension/boilerplate-clean-architecture.md)
- [contextual](https://banes-lab.com/records/vocabulary/severity-contextual.md)
- [Layer Separation](https://banes-lab.com/records/lexicon/layer-separation.md)
- [Separation of Concerns](https://banes-lab.com/records/architecture/separation-of-concerns.md)
- [Structured Code Organization](https://banes-lab.com/records/lexicon/structured-code-organization.md)
- [Anemic Layers](https://banes-lab.com/records/lexicon/anemic-layers.md)
- [Layer Skipping](https://banes-lab.com/records/lexicon/layer-skipping.md)
- [Layered Architecture / Anemic Layers](https://banes-lab.com/records/tension/anemic-layers-layered-architecture.md)
- [Component Boundaries](https://banes-lab.com/records/lexicon/component-boundaries.md)
- [Contracts](https://banes-lab.com/records/lexicon/contracts.md)
- [Modularity](https://banes-lab.com/records/architecture/modularity.md)
- [Composability](https://banes-lab.com/records/architecture/composability.md)
- [Reuse](https://banes-lab.com/records/lexicon/reuse.md)
- [Integration Overhead](https://banes-lab.com/records/lexicon/integration-overhead.md)
- [Big Ball of Mud](https://banes-lab.com/records/architecture/big-ball-of-mud.md)
- [Component-Based Architecture / Integration Overhead](https://banes-lab.com/records/tension/component-based-architecture-integration-overhead.md)
- [principle](https://banes-lab.com/records/kind/principle.md)
- [Feature Cohesion](https://banes-lab.com/records/lexicon/feature-cohesion.md)
- [Bounded Context](https://banes-lab.com/records/architecture/bounded-context.md)
- [Locality of Change](https://banes-lab.com/records/lexicon/locality-of-change.md)
- [Shared Technical Concerns](https://banes-lab.com/records/lexicon/shared-technical-concerns.md)
- [Package by Technical Layer Only](https://banes-lab.com/records/lexicon/package-by-technical-layer-only.md)
- [Package by Feature / Shared Technical Concerns](https://banes-lab.com/records/tension/package-by-feature-shared-technical-concerns.md)
- [Autonomy](https://banes-lab.com/records/architecture/autonomy.md)
- [Independent Deployment](https://banes-lab.com/records/lexicon/independent-deployment.md)
- [Scalability](https://banes-lab.com/records/architecture/scalability.md)
- [Decentralized Ownership](https://banes-lab.com/records/lexicon/decentralized-ownership.md)
- [Operational Complexity](https://banes-lab.com/records/lexicon/operational-complexity.md)
- [Consistency](https://banes-lab.com/records/architecture/consistency.md)
- [Distributed Monolith](https://banes-lab.com/records/architecture/distributed-monolith.md)
- [Decentralization](https://banes-lab.com/records/architecture/decentralization.md)
- [Microservices / Operational Complexity](https://banes-lab.com/records/tension/microservices-operational-complexity.md)
- [Microservices / Consistency](https://banes-lab.com/records/tension/consistency-microservices.md)
- [Own Data](https://banes-lab.com/records/lexicon/own-data.md)
- [Unified Deployment Boundary](https://banes-lab.com/records/lexicon/unified-deployment-boundary.md)
- [Operational Simplicity](https://banes-lab.com/records/lexicon/operational-simplicity.md)
- [Transactional Simplicity](https://banes-lab.com/records/lexicon/transactional-simplicity.md)
- [Team Autonomy](https://banes-lab.com/records/lexicon/team-autonomy.md)
- [Independent Scaling](https://banes-lab.com/records/lexicon/independent-scaling.md)
- [Unbounded Big Ball of Mud](https://banes-lab.com/records/lexicon/unbounded-big-ball-of-mud.md)
- [Monolith Architecture / Team Autonomy](https://banes-lab.com/records/tension/monolith-architecture-team-autonomy.md)
- [Monolith Architecture / Independent Scaling](https://banes-lab.com/records/tension/independent-scaling-monolith-architecture.md)
- [Uniform Stage Interface](https://banes-lab.com/records/lexicon/uniform-stage-interface.md)
- [Single Responsibility Principle](https://banes-lab.com/records/architecture/single-responsibility.md)
- [Reorderable Stages](https://banes-lab.com/records/lexicon/reorderable-stages.md)
- [Independent Stage Testing](https://banes-lab.com/records/lexicon/independent-stage-testing.md)
- [End-to-End Traceability](https://banes-lab.com/records/lexicon/end-to-end-traceability.md)
- [Monolithic Transform Function](https://banes-lab.com/records/lexicon/monolithic-transform-function.md)
- [Pipes and Filters / End-to-End Traceability](https://banes-lab.com/records/tension/end-to-end-traceability-pipes-and-filters.md)
- [Design Review](https://banes-lab.com/records/architecture/design-review.md)
- [Service Contract](https://banes-lab.com/records/architecture/service-contract.md)
- [Low Coupling](https://banes-lab.com/records/architecture/low-coupling.md)
- [Contract-Governed Service Reuse](https://banes-lab.com/records/lexicon/contract-governed-service-reuse.md)
- [Operational Overhead](https://banes-lab.com/records/lexicon/operational-overhead.md)
- [Shared Monolithic Application](https://banes-lab.com/records/lexicon/shared-monolithic-application.md)
- [Service-Oriented Architecture / Operational Overhead](https://banes-lab.com/records/tension/operational-overhead-service-oriented-architecture.md)
- [Architecture Review](https://banes-lab.com/records/architecture/architecture-review.md)
- [Replicated In-Memory State](https://banes-lab.com/records/lexicon/replicated-in-memory-state.md)
- [Horizontal Scaling](https://banes-lab.com/records/architecture/horizontal-scaling.md)
- [Elasticity](https://banes-lab.com/records/architecture/elasticity.md)
- [Database-Bottleneck Removal](https://banes-lab.com/records/lexicon/database-bottleneck-removal.md)
- [Central Database Bottleneck](https://banes-lab.com/records/lexicon/central-database-bottleneck.md)
- [Space-Based Architecture / Consistency](https://banes-lab.com/records/tension/consistency-space-based-architecture.md)

## Linked from

- [The layer topology](https://banes-lab.com/ontology/schema/the-layer-topology.md)
- [The membership](https://banes-lab.com/ontology/schema/the-membership.md)
