CAITSGet started

Files and names

CAITS finds the parts of your app by where their files are and what they are called: you register nothing. This page lists each kind of file, where it goes, and its test. If a handler never runs, or a view finds no frontend, start here.

In a context

The paths start from the folder of a context, such as src/backend/messages/.

WhatFileIts test
The bindingsdi.ts: a list of bind(…). CAITS finds the context by this file.The integration tests
The bindings of the teststest.di.ts: they replace those of di.ts in the tests—
The shortcutpackage.json: #context/ leads to the files of the context—
A use casecommand/<use-case>/ if it changes something, query/<use-case>/ if it only reads—
A DTO<use-case>.dto.ts: the input DTO and, in the backend, the output DTO, as plain classes—
A handler<use-case>.handler.ts: one class whose execute takes the input DTO and, in the backend, returns its output DTOs, each typed with its class<use-case>.application.test.ts
A controller<use-case>.http.controller.ts, in the backend: it extends Controller<InputDto, OutputDto><use-case>.http.presentation.test.ts
An entity, a value objectdomain/entity/<Entity>.ts, domain/value-object/<ValueObject>.tsThrough the use cases; <Entity>.test.ts if needed
A domain errordomain/error/<Error>.ts: a class …Error that extends ErrorThrough the use cases
A domain eventdomain/event/<Name>.ts, in the backend: it extends DomainEventThrough the use cases
A portdomain/port/<port>/<Port>.ts: the interface and its token, under one name—
A contractdomain/port/<port>/<Port>.contract.ts: the tests of every adapter—
An adapterinfra/<port>/<adapter>-<port>.ts: it implements the interface that it imports from domain/port/<port>/<adapter>-<port>.test.ts, which runs the contract
A context mapcontext-map.ts: what the context shares, and what it hearscontext-map.test.ts

In a frontend context

A frontend context has the files above, except the controllers and the domain events, and these:

WhatFileIts test
An eventevent/<Name>.ts, with readonly type = "<context>.<event>" as const—
The events of the contextevent/<Context>Event.ts: their union—
The storepresentation/store/<context>Store.ts: { initialState, reduce, send }Through the tests of the views
The type of its frontendpresentation/<Context>Frontend.ts: its entry in Frontends, named after the folder—
A viewpresentation/view/<view>/<View>.marko, with its stylesheet, its presenter and its loader<View>.test.ts
A componentpresentation/component/<component>/Its own test, next to it

In shared and in the routes

WhatFileIts test
The bindings of sharedsrc/backend/shared/di.ts: every backend context gets them—
A shared componentsrc/frontend/shared/presentation/component/<name>/index.marko, placed by its tag—
The tags of sharedsrc/frontend/marko.json: { "tags-dir": "./shared/presentation/component" }—
A page, a layoutsrc/routes/_frontend/…/+page.marko, +layout.markotest/e2e/<name>.spec.ts
A documentsrc/routes/_frontend/…/`sitemap.xml`/+handler.ts: the GET of a viewThe test of the view
A route of the APIsrc/routes/_backend/…/+handler.ts: each method calls a controllerThe test of the controller
The integration testssrc/backend/<name>.integration.test.ts—

The test helpers

Each module also exports Vitest's functions (describe, expect, vi…), so a test imports everything from one place.

Import fromForIt gives
@ingenioz-it/caits/testing/backend/applicationa backend use casetest with app, applicationScenario
@ingenioz-it/caits/testing/backend/presentationa controllertest with app, presentationScenario
@ingenioz-it/caits/testing/backend/infraa backend adapteruseTempDirectories
@ingenioz-it/caits/testing/backend/context-mapa backend context mapContextMap, backendTest
@ingenioz-it/caits/testing/backend/integrationthe integration testsproductionBackend
@ingenioz-it/caits/testing/frontend/applicationa frontend use casetest with app, applicationScenario
@ingenioz-it/caits/testing/frontend/presentationa view or a componenttestPresentation, globalWith, mountTemplate, settle, press
@ingenioz-it/caits/testing/frontend/infraa frontend adapterVitest's functions
@ingenioz-it/caits/testing/frontend/context-mapa frontend context mapeventsFor

The shortcuts of the imports

No import goes up a folder (../), not even in a test: an import keeps working when its file moves.

ShortcutWhereIt leads to
#context/In a contextThe files of the same context
#shared/In a backend contextsrc/backend/shared/
#frontend-shared/In a frontend contextsrc/frontend/shared/
#backend/, #frontend/In the routessrc/backend/, src/frontend/
@ingenioz-it/caits/…EverywhereCAITS itself, by its package name