Glossary
The words of CAITS, in alphabetical order, each with one short definition and where to read more.
Adapter
A class of the infra layer that implements a port: it keeps the data in a file, in a database, or calls an API. A port can have several adapters: one for production, one for the tests. See Add a port.
AGENTS.md
The file at the root of each project that tells an AI coding agent the commands, where the code goes, and the rules, in 28 lines. Many agents read it on their own. See AI agents.
Application layer
The layer of the use cases: one folder for each, with its DTOs, its handler, and its test. It knows the domain, and the outside only through the ports.
Binding
A line of di.ts: which adapter the container gives for a port, such as bind(MessageRepository).to(FileMessageRepository). test.di.ts holds the bindings of the tests.
Bounded context
The usual name of a context: one part of the business, with its own words and its own rules.
Clean Architecture
A way to organize the code in layers, where the dependencies point to the business: the domain knows nothing of the database or of the views. CAITS uses four layers: domain, application, infra, presentation. See How CAITS works.
Command
A use case that changes something, such as adding a message. Its folder is in application/command/.
Context
A folder that holds one part of the business, such as messages, with its four layers and its di.ts. A context never imports another context, except the backend context shared. See Add a context.
Context map
The file src/backend/context-map.ts: it turns an event of a backend context into DTOs of other contexts. Apart from the context shared, it is the only link between the backend contexts. See Connect two contexts.
Contract
The tests of a port, written once, in <Port>.contract.ts, next to the port. Each adapter of the port runs them, so all the adapters behave the same.
Controller
A class of the backend presentation: it turns an HTTP request into an Input DTO, and the answer of the use case into the response. It extends Controller.
Coverage
The share of the code that the unit tests run. CAITS requires 100%: every statement, branch, function and line. The coverage shows what the tests run, not what they check: the mutation tests show that.
Domain layer
The layer of the business: the entities, the value objects, the errors, the events, and the ports. It imports nothing outside itself, except three small types of CAITS: Result, Token, and DomainEvent.
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, such as a message with its id. It keeps the rules of the business: Message.create refuses an empty text.
Event
A fact that a part of the app publishes. In the frontend, the views and the handlers publish events, and the store reduces them into the state. In the backend, a handler publishes the events of its domain, and the context map may turn them into DTOs of other contexts.
Event bus
The way of the events: the publishers give them, and the store or the context map gets them. CAITS builds it.
Fake
An adapter for the tests, such as InMemoryMessageRepository: it keeps the data in memory, and passes the same contract as the real adapter.
Frontend (of a context)
What a view gets with frontendOf($global, "<context>"): the event bus and the store of its context.
Handler
The class that does a use case. Its execute gets the Input DTO; its constructor names the ports that it needs, and CAITS gives them.
Harness
The six checks that npm run check runs at once: the types, the lint, the architecture rules, the unit tests with their coverage, the mutation tests, and the end-to-end tests. They keep each layer in its place, and each test honest.
Infra layer
The layer of the adapters: the code that talks to the outside, such as files, databases and HTTP APIs.
Kernel
The code of CAITS that runs your contexts: the container, the message buses, the event buses, and the stores. Your project imports it as @ingenioz-it/caits/….
Loader
A function next to a view, such as loadMessageBoard.ts: it gives the first data of the view. The view calls it when it loads: it asks the store for the data, and waits for the answer. On the server, the first HTML of the page thus holds the data.
Message bus
The way of the DTOs: it gives each Input DTO to the handler of its use case. CAITS finds the handlers by the names of their files.
Mutant
A small change that the mutation tests make in the code, such as > into >=. A test that fails kills the mutant; a mutant that survives shows code that no test checks. See Test each layer.
Mutation score
The share of the mutants that the tests kill. CAITS requires 100%.
Port
An interface of the domain: what the business needs from the outside, such as MessageRepository. A token with the same name lets the container find its adapter. See Add a port.
Presentation layer
The layer that talks to the user or to the client: the controllers in the backend; the store and the views in the frontend.
Presenter
A function next to a view, such as presentMessageBoard.ts: it turns the state of the store into what the view shows, as plain data. The view follows the store through it.
Query
A use case that only reads, such as listing the messages. Its folder is in application/query/.
Side
The backend or the frontend: src/backend/ or src/frontend/. Each side holds its contexts. The two sides never import each other: they talk only through the HTTP API. See How CAITS works.
Store
The state of a frontend context. It reduces each event into a new state, and sends the DTO that an event asks for. It is the only part of the frontend that sends DTOs.
TDD
Test Driven Development: write a test that fails, then the code that makes it pass, then improve the code. The guides of CAITS follow it, and npm run tdd runs the tests of what you change, at each save.
Token
The name of a port for the container: export const MessageRepository = new Token<MessageRepository>(), next to the interface.
Use case
One thing that the app does, such as adding a message: a command or a query, with its DTOs, its handler and its test. See Add a use case.
Value object
An object of the domain without an identity, equal to another when their values are equal, such as an amount of money.
View
A Marko component of a frontend context. It shows the state of the store, and publishes events. It never sends a DTO itself.