CAITSGet started

Glossary

The words of CAITS, from A to Z.

Adapter

A class of the infra layer that implements a port: a file, a database, an API. Production and the tests each have theirs. See Ports and adapters.

AGENTS.md

The file at the root of each project that tells an AI agent the commands, where the code goes, and the rules. See AI agents.

Application layer

The use cases: their DTOs and their handlers, plus the events in the frontend. It knows the domain, and reaches the outside only through ports.

Binding

A line of di.ts that gives a port its adapter: bind(MessageRepository).to(FileMessageRepository). test.di.ts holds those of the tests.

Bounded context

The usual name for a context.

Clean Architecture

Code in layers, where every dependency points to the business. CAITS has four: domain, application, presentation, infra. See the architecture.

Command

A use case that changes something. Its folder is in command/.

Component

A part that several views of a frontend context place, in presentation/component/<component>/. In the shared context, a Marko tag that every context places by name.

Context

A folder that holds one part of the business, such as messages, with its layers and its di.ts. It never imports another context, except the shared one. See Contexts.

Context map

The file context-map.ts: the only way for contexts to talk. share(…) turns an event of the context into events of shared; when(…) turns an event of shared into what the context reacts to. See Connect two contexts.

Contract

The tests that every adapter of a port must pass, in <Port>.contract.ts, next to the port.

Controller

A backend class that turns an HTTP request into an input DTO, and the answer into a response. It lives in the folder of its use case.

Coverage

The share of the code that the unit tests run. CAITS asks for 100%. It shows what the tests run, not what they check: the mutants do.

Domain layer

The business: entities, value objects, errors, events and ports. It imports nothing outside itself but Result, Token and DomainEvent. See The domain.

DTO

A Data Transfer Object: a plain class that carries the data of a use case. The input DTO goes to the handler; in the backend, the output DTO comes back.

Entity

An object of the domain with an identity, which holds the rules of its data: Message.create refuses an empty text.

Event

A fact that a part of the app publishes. In the frontend, the store turns events into state. Through the context maps, an event can reach other contexts.

Event bus

What carries the events. Each frontend context has its own; between contexts, the shared bus.

Fake

An adapter for the tests, such as InMemoryMessageRepository. It passes the same contract as the real one.

Frontend (of a context)

What a view gets with frontendOf($global, "<context>"): the events of its context, and its store.

Handler

The class that does a use case. Its execute takes the input DTO: CAITS finds the use case by the type of its parameter. Its constructor names the ports it needs.

Harness

Every check that a change must pass: the six of npm run check. See The harness.

Infra layer

The adapters: the code that talks to files, databases and APIs.

Kernel

The part of CAITS that runs your contexts: the container, the buses, the context maps and the stores.

Loader

A function next to a view, which asks for the data of its first HTML, on the server.

Message bus

What takes each input DTO to the handler of its use case.

Mutant

A small change that the mutation tests make in the code, such as > into >=. A test must fail: the mutant is killed. If none fails, it survived. See A mutant survived.

Mutation score

The share of the mutants that the tests kill. CAITS asks for 100%.

Port

An interface of the domain, for what the business needs from outside, with a token of the same name. See Ports and adapters.

Presentation layer

The way in: the controllers in the backend; the views, the components and the store in the frontend.

Presenter

A function next to a view, which turns the state of the store into what the view shows.

Query

A use case that only reads. Its folder is in query/.

Route

A file of src/routes/: a page places views, a handler calls a controller. No logic, no test. See Pages and routes.

Shared bus

The bus of the events of shared, on each side: the only way from one context to another.

Shared context

The context shared of a side, which every context of the side may import, with #shared/ or #frontend-shared/. It hears no other context.

Side

The backend or the frontend. The two sides talk only through the HTTP API.

Store

The state of a frontend context. It turns each event into the new state, and is the only part of the frontend that sends DTOs.

TDD

Test-Driven Development: a test that fails, then the code that makes it pass. npm run tdd runs the tests of what you change.

Token

The name of a port for the container: export const MessageRepository = new Token<MessageRepository>().

Use case

One thing that the app does, in one folder: a command or a query. See A backend use case.

Value object

An object of the domain without an identity: it equals another with the same values.

Vertical slice

A feature kept in one place, from its endpoint to its handler: in CAITS, a use case and its folder.

View

A Marko template of a frontend context, which a page places. It shows the store, and publishes events.