One server or dedicated services
One codebase and build, run as one server or as dedicated services; how parts talk across services, and what proves the two shapes agree.
The backend is one codebase and one build. A deployment runs it either as one server, every part in one process, or as dedicated services, each running its part and asking the others over the network (ADR-0050). The parts' code is the same in both: what changes is which application starts. Each part is meant to be one service, and the parts stand in layers (see the module map).
The applications
Every folder of product/apps is a runnable application, built from
product/assembly: every part, the platform, the shared settings, the
start-up checks and the migration entry point.
| Application | Runs |
|---|---|
server | every part, in one process |
referential | the referential, with the station's rules |
departures | traffic (planning, allocation, seats) and ticketing (with the coach choice) |
cycle | the coach cycle |
billing | billing |
siv | passenger information |
supervision | supervision, and the screens' live stream |
identity | accounts |
Each part turns on through one switch, <part>.config.<Name>Module; an
application imports the switches of the parts it runs, and nothing else scans
a part's package. A build check holds every part to exactly one dedicated
service.
How parts talk across services
- Questions between parts stay Java calls to an
apiinterface, asked only of a part in a lower layer. Where the answering part runs elsewhere, the switchboard puts a stand-in in its place, and the call travels over HTTP in the application's JSON dialect; a refusal arrives as the exception the local call would have thrown, and a service that cannot be reached is an answer,platform.module_unreachable, never a hang. - Events already travel through Kafka with a consumer group per part, so nothing changes for them. They may flow either way between layers.
- Identity. A service signs in to the others as the deployment's service
(OAuth 2.0 client credentials, realm role
smartgare-service); the person a call is made for travels beside it, so a part that checks the person's rights again checks theirs. The internal endpoints answer nothing else, and the gateway never forwards them. - Locks. A question that holds something for its caller until the caller's
transaction ends is marked
@HeldForCaller; its caller and the part that answers it always run in the same application. That is why traffic and ticketing still run in one service. - The coach's path. The cycle service asks the referential (master data and rules) first, always, and decides on their last answer, at most 15 minutes old, only when they cannot be reached.
- Screens. A service hears the events of the parts it does not run from Kafka and puts their notices on its live stream, so a screen connected to it hears every part.
One database
Every service uses the same PostgreSQL database, and each part still reaches
only its own tables. The build's migrations run once per release, before the
services start (server-start.sh migrate); a service only checks that the
database is at its build's level, and refuses to start otherwise.
What proves the two shapes agree
The station-day journeys run on the server (HappyPathJourneysIT) and on the
dedicated services behind one address (SplitJourneysIT), with the same features
and settings; both pass. DedicatedServicesIT starts each service with only its
own parts. The pipeline's journeys job runs all three on every push, and both
must be green before a release goes to a station.
Status
Built and tested in the backend. Since 14 November 2026 staging runs the eight
dedicated services on one database, behind an internal API gateway with no public
address; the browser apps reach the API only through their own servers (frontend
ADR-0006). The team's GitLab environment still runs the server, so both shapes stay
in use. How to deploy them, the settings each takes and the API gateway's routes
are in the backend's docs/deployments/dedicated-services.md.