Developer onboarding
From a clean clone to a merged change. This guide assumes you can read Kotlin and TypeScript and have used Git; it does not assume you know Karyo or warehouse software. Every command runs from the repository root unless a step says otherwise.
Karyo is one Kotlin and Quarkus application, :services:karyo-app, assembled from Gradle modules,
plus two React and TypeScript front ends. The projects under services/ are libraries inside that
one application, not services you run separately. The architecture overview
is the ten-minute version of the whole.
Prerequisites
| Tool | Version | Used for |
|---|---|---|
JDK, including javac |
21 | Backend build and tests |
| Node.js and npm | 24.x (the one line declared in .nvmrc) |
Both front ends and the browser-test helpers |
| Python | 3 | The deploy script's configuration validation |
| Docker, or Podman with podman-compose | Current stable | Dev Services, the development Keycloak, the deployed stack |
| Git | 2.x | Source control |
Check the JDK before anything else. Both java -version and javac -version must report 21. A
Java runtime without a compiler fails at the very first build step, while Gradle resolves the
toolchain for buildSrc, with "does not provide the required capabilities: [JAVA_COMPILER]". If
several JDKs are installed, set JAVA_HOME to the JDK 21 and put $JAVA_HOME/bin first on PATH.
Gradle's toolchain detection also finds a JDK 21 that an IDE installed under ~/.jdks, so a newer
system JDK does not stop the build; setting JAVA_HOME keeps every run on the same JDK.
Version pins live in gradle/libs.versions.toml, the wrapper
properties and each front end's lockfile. Use the checked-in ./gradlew; do not install a separate
Gradle or upgrade dependencies to get through setup.
A local session uses ports 8080 (the application), 8180 (Keycloak), 5005 (the debugger), 5173 (the desktop console) and 5174 (the floor app). The development services use fixture credentials; never expose them on an untrusted network.
Clone and build
git clone https://github.com/voyagerforge-dev/karyo-wms.git
cd karyo-wms
./gradlew --version
./gradlew :services:karyo-app:quarkusBuild -x test
npm ci --prefix frontend/web && npm run build --prefix frontend/web
npm ci --prefix frontend/mobile && npm run build --prefix frontend/mobile
The backend output is the Quarkus fast-jar in services/karyo-app/build/quarkus-app/; each front
end builds into its own dist/. A build is not a running warehouse. Building Karyo
explains what else the build produces.
Boot a local session
A session has five parts: PostgreSQL and managed Keycloak, the application in dev mode, a reviewed local principal cutover, and the two front-end dev servers. Real OIDC traffic is fail-closed until the cutover marker and exact fixture bindings exist; the development realm users are not enrolled just because Keycloak imported them.
1. Start PostgreSQL and Keycloak
export DEV_PROJECT="karyo-dev-$(id -u)"
podman-compose -p "$DEV_PROJECT" \
-f infrastructure/docker/docker-compose.dev.yml up -d postgresql keycloak # or: docker compose -p ...
curl -f http://localhost:8180/realms/karyo/.well-known/openid-configuration
This starts the fixed-port development database and Keycloak, but not the Pact broker. Keycloak imports the development realm with its fixture accounts. Wait for discovery and PostgreSQL health. A project name keeps containers apart; it does not change ports 5432 or 8180, so one machine runs one local session at a time.
Name the project for the worktree, as karyo-dev-$(id -u) does for a single checkout. A compose
project left by a deleted worktree still mounts that worktree's realm file, and up then fails with
a bind-mount error such as getxattr .../karyo-realm.json: no such file. Run down for that
project, or choose a new name.
2. Start the application
# Rootless Podman only: point Testcontainers at your user's socket.
export DOCKER_HOST="unix:///run/user/$(id -u)/podman/podman.sock"
export TESTCONTAINERS_RYUK_DISABLED=true
systemctl --user start podman.socket # the socket unit must be active, not only the CLI usable
export QUARKUS_COMPOSE_DEVSERVICES_ENABLED=false
export QUARKUS_DATASOURCE_DEVSERVICES_ENABLED=false
export QUARKUS_DATASOURCE_JDBC_URL=jdbc:postgresql://localhost:5432/karyo
export QUARKUS_DATASOURCE_USERNAME=quarkus
export QUARKUS_DATASOURCE_PASSWORD=quarkus
./gradlew :services:karyo-app:quarkusDev
What each setting is for:
- The fixed development PostgreSQL lets the identity manifest tool inspect and update the same schema after Flyway migrates it. It is disposable fixture storage, never a production backup.
- Compose Dev Services is switched off explicitly: the compose file in the application's resources is not discovered, and the switch keeps it that way rather than leaving it to chance. See ADR 0028.
The application listens on http://localhost:8080. Check it:
curl -f http://localhost:8080/q/health/ready
curl -f http://localhost:8080/api/v1/ping
Health is not sign-in. Without Keycloak, dev mode still starts and both requests above return 200. With Keycloak but without step 3, authentication succeeds at the provider but Karyo denies the unknown binding or incomplete cutover.
3. Enroll the development principals
Export the complete runtime Keycloak directory, including assigned ids, disabled/service accounts,
attributes and effective realm roles, under the gitignored build/ directory. A realm JSON import
is not this evidence because Keycloak assigns subjects when it imports accounts. Then follow the
identity principal upgrade: preflight against
postgresql://quarkus:quarkus@localhost:5432/karyo and issuer
http://localhost:8180/realms/karyo, review every generated principal and attestation, validate the
manifest and apply it. Enrollment grants nothing, and Karyo authorizes every call from stored
grants, so then follow its
access activation
to give each development principal reviewed grants; until then every principal is refused
action-not-granted. Use only fixture evidence and keep both export and manifest out of commits.
The generated ids remain valid only while this development volume exists; after deleting it, repeat
the export and cutover.
This explicit step is intentional: development exercises the same no-inference, no-first-login boundary as production. The dedicated identity tests use their own fixtures and do not enroll this manual session for you.
4. Start the front ends
In two more terminals:
npm run dev --prefix frontend/web -- --strictPort
npm run dev --prefix frontend/mobile -- --strictPort
Open the desktop console at http://localhost:5173/ and the floor app at http://localhost:5174/m/.
Both dev servers send /api to the application on 8080 and /auth to Keycloak on 8180.
Admin > Health reads the signed-in /api/v1/admin/health route with settings.manage at the Company.
The console dev server does not proxy management paths; use the internal application port for probes.
--strictPort refuses to fall back silently to another port, which would break the sign-in
redirects.
5. Sign in
The development realm carries these fixture users. They exist only in the development realm; the production realm has no human users at all. The realm roles grant nothing in Karyo (ADR 0048); the access manifest uses them only to propose the actions of each reviewed grant, and what a user may do is the grants applied in step 3.
| Username | Password | Realm role | Principal kind | Goods owner |
|---|---|---|---|---|
admin |
admin |
ADMIN |
OPS | 0, the Company layer |
manager |
manager |
MANAGER, integration-admin |
OPS | 1 |
operator |
operator |
OPERATOR |
OPS | 1 |
viewer |
viewer |
VIEWER |
OPS | 1 |
tenant2-operator |
operator |
OPERATOR |
BUSINESS_UNIT_USER | 2 |
Signing in as admin lands on Operations Control, with the warehouse widget fixed at the top and
the default optional widgets below it. An empty warehouse is normal: the warehouse widget's
Occupancy and Slot utilization read Not reported, and each KPI widget reads Not reported with
a note such as No counted lines in range until you create master data, which the implementer
guide walks through with synthetic data. With
KARYO_DEMO=on, generate the demo warehouse through the backend API (the console has no
sample-data UI - it was removed; see the desktop-console guide):
curl -X POST -H "Authorization: Bearer $TOKEN" http://localhost:8080/api/v1/demo/seed
curl -X POST -H "Authorization: Bearer $TOKEN" http://localhost:8080/api/v1/demo/reset
The seed needs demo.manage
(services/demo-service/karyo-demo/src/main/kotlin/com/karyo/demo/api/v1/DemoResource.kt, DemoResource.seed), which
the Manager and Administrator standard profiles hold. It creates Lumen Home Goods (LUMEN) with
Riverside DC (RIVERSIDE) and Hillcrest DC (HILLCREST), plus Cobalt Outdoor (COBALT) with Eastport DC
(EASTPORT). Riverside gets the full profile; the other sites get about a third of its stock and orders.
The dev profile's ACME and Globex fixture units (from V1201_1) remain separate.
Use a Company manager to explore the tree, a Lumen manager for its two sites, or a Riverside operator
for floor work. A Cobalt viewer sees Eastport's stock, receipts, orders, tasks, pick orders and shipments without write controls.
The standard viewer holds fulfillment.read but not fulfillment.write, so it can open a pick order or a shipment and cannot pick, pack or ship.
tree in the seed response and status lists the actual Business Unit and Facility ids.
A demo installation is disposable: reset clears every Business Unit's operational data.
With KARYO_DEMO off the endpoints 404.
Known defect, local only. Through the Vite dev servers the Keycloak sign-in page renders without
its styles and its "Show password" button does nothing. The dev servers route /api and /auth
but not the /resources/ path Keycloak loads its assets from; the deployed stack's nginx does. The
form itself works.
6. Stop
Stop the application and both dev servers with Ctrl-C. Then stop the development PostgreSQL and Keycloak:
podman-compose -p "$DEV_PROJECT" -f infrastructure/docker/docker-compose.dev.yml down
The Gradle daemon is shared by every session on the machine. To end a stuck quarkusDev, signal
only your own gradlew client, and the dev JVM if it lingers; never run ./gradlew --stop. Select
processes by a pattern the command line itself does not contain, such as pgrep -f 'quarkus[D]ev',
because pkill -f quarkusDev run from a command that spells that word also kills its own shell.
Drive the session in a browser
A change to what a person sees is verified through the real sign-in, not by reading the code. Drive
the dev servers from a script that imports @playwright/test from tests/e2e/node_modules (run
npm ci there once), and sign in as keycloakLogin does in tests/e2e/fixtures/auth.ts: fill
#username and #password, click #kc-login. Use a browser profile of your own: Keycloak's cookies
belong to the host, not the port, so a shared browser can carry another session's localhost login.
Then:
- Do not edit sources while a pass runs. A hot reload of the Vite server, or of
quarkusDevon the next request, makes requests fail for a while, and the failures are not the change's. After a Kotlin edit, send one request, wait for the reload to finish, and run the pass again. - The console keeps query results fresh for 30 seconds (
frontend/web/src/App.tsx,QueryClientstaleTime). After a server-side change, wait longer than that before an in-app navigation will refetch. - To see a loading or error state, answer the list request with
page.route(delay it, or fulfil it with a problem response), leave the page in-app, and open it again with a query string the cache has not seen. The remount shows the skeleton or the error although the hook keeps its previous data. - To see which rows a request reads, set
QUARKUS_HIBERNATE_ORM_LOG_SQL=trueforquarkusDev. TheWHEREclause per request shows which predicate applies; filter the log by table name, because the outbox poller writes to it too. - Seed the demo warehouse through
POST /api/v1/demo/seedas described above. A fresh seed gives different throughput and alert figures each time, so say which seed a figure came from. The detectors need a few minutes after a seed before the demo alerts appear.
Test and debug
Use a fresh terminal for tests, without the dev-mode datasource settings above. Keep DOCKER_HOST
and TESTCONTAINERS_RYUK_DISABLED if you use rootless Podman.
# A pure JVM test: no application boot, no containers.
./gradlew :services:karyo-app:test --tests 'com.karyo.common.PatchableTest'
# A test that boots the application against a Dev Services PostgreSQL.
./gradlew :services:karyo-app:test --tests 'com.karyo.inventory.api.v1.HealthResourceTest'
# Front-end unit tests and lint.
(cd frontend/web && npx vitest run && npm run lint)
(cd frontend/mobile && npx vitest run && npm run lint)
The test profile gives each test JVM a random HTTP port and its own Dev Services PostgreSQL, never kept for reuse, so suites in parallel worktrees can run at once.
The full backend suite is
./gradlew test. The application's test worker has a 2 GB heap and stays near 2.4 GB resident, and up to about 4 GB in the worst case: a 2 GB heap, up to about 1.5 GB of Metaspace, the code cache and native memory (services/karyo-app/build.gradle.kts,tasks.withType<Test>, maxHeapSize); budget for it. Then run./gradlew detekt, which checks against a committed baseline../gradlew teststops at the first failing module unless you add--continue. Count the results from*/build/test-results/test/*.xml, not from the console tail. The test task is cached (org.gradle.caching=true), so a green task may beFROM-CACHE; add--rerunfor a fresh execution.A Dev Services PostgreSQL that outlives your run may belong to another session's suite. Check its
io.quarkus.devservice.launch-modelabel before removing it, and leave a container you did not start.Read executed, failed and skipped counts, not the exit status. One failed application boot can skip most of the backend suite. Reports land in
services/karyo-app/build/reports/tests/test/index.html.The four Pact tests are skipped. The Pact provider tests run only against a broker named with
-Dpact.broker.url, and are otherwise reported as skipped, with that reason. The nightlytestjob is where they run, and itspact-verifyjob reports the result (contract testing).The nine realm classes are skipped too. Each starts a real Keycloak, so
testskips it with the reason and./gradlew :services:karyo-app:realmTestruns it. Run that task when you change a realm, a realm script or the identity code (realm tests).A rootless-Podman run can fail with
Broken pipe. The user socket is answered by a socket-activatedpodman system servicewith Podman's defaultservice_timeoutof 5 seconds, which closes a keep-alive connection idle for 10 seconds and exits soon after its last connection closes. Testcontainers reuses pooled connections without checking them and does not retry a container create. So a class that starts its containers after a quiet stretch can fail atinitializationErrorwithjava.io.IOException: Broken pipe, and pass on rerun. On your own machine, turn the timeout off once in~/.config/containers/containers.conf(create the file if it does not exist, and add the key to an existing[engine]table rather than a second one):[engine] service_timeout = 0Then, when no test run is active, run
systemctl --user stop podman.service, so that the next request starts the service with the new setting. It then stays up until you stop it or log out. On a machine whose Podman you do not own, give the run a service of its own, as the nightly suite does (the delivery pipeline;scripts/ci-podman-api.sh). Put its directory on a short path, because a Unix socket address holds 107 bytes and the scratch directories of most tools are longer:mkdir -p "/run/user/$(id -u)/karyo-test" && export RUNNER_TEMP="/run/user/$(id -u)/karyo-test" ./scripts/ci-podman-api.sh start export DOCKER_HOST="unix://$RUNNER_TEMP/podman-api/podman.sock" TESTCONTAINERS_RYUK_DISABLED=true ./gradlew test ./scripts/ci-podman-api.sh stopBackend integration tests live in
services/karyo-app/src/test/kotlin, not beside each module, because they exercise the assembled application.config/test-runner-contracts.jsonowns which runner discovers which files. Testing describes the whole tree.The browser suites under
tests/e2e/need a deployed stack, not this dev session. Start withscripts/run-e2e.sh --helpand deploying.
Debugging. Dev mode listens for a JVM debugger on localhost:5005; attach your IDE there,
with the Gradle JVM set to JDK 21. Save a Kotlin change and make another request to see live reload.
In the browser, the network panel separates an API failure from a sign-in redirect or a stale floor
app bundle.
Find your way around the code
settings.gradle.kts is the module graph and
services/karyo-app/build.gradle.kts is what the
running application assembles. Start there to answer whether something is compiled, on the running
classpath, or not part of this repository at all.
| Concern | Where it lives |
|---|---|
| The application: configuration, every Flyway migration, integration tests | services/karyo-app/ |
| Stock and unit loads, products, locations, goods owners, users, settings | inventory, product, layout, auth |
| Receiving and delivery orders; transport orders; picking, packing and shipping | orders, tasks, fulfillment |
| Counts, replenishment, the work inbox | stocktaking, replenishment, work |
| Webhooks, reporting, the document archive, the demo data engine | integration hub, reporting, documents, demo |
| The contracts the engine modules implement | the -api modules of monitoring, forecasting, slotting, simulation, crossdock, wave and streaming; see the engine boundaries |
| Shared foundations | libs/: common, events, security, license, documents, sequence |
| Desktop console and floor app | frontend/web/src, frontend/mobile/src |
Trace a feature in both directions
From a screen: route and component, then the front end's API call, then the REST resource and its declared action, then the service transaction, then repositories, SPIs and events, then the migrations. Then read the tests and the document that states the behaviour. From a backend defect, walk the same route backwards to find the operator action that triggers it.
rg -n 'StockSelectionFilter|StockSelectionService' services libs
rg -n 'stock-units' frontend/web/src frontend/mobile/src services
| Question | Code | Behaviour and tests |
|---|---|---|
| Why was this stock selected? | StockSelectionService, inventory screens |
Allocation and reservation, inventory service tests |
| Why will this order not release? | OrderService, order screens |
Allocation and reservation, order tests |
| Why will this floor move not start? | TaskService, floor menu |
Putaway and location finding, task tests |
| Why does one goods owner see another's records? | security library and each resource's scope call | Identity and tenancy, FacilityScopesTest, CrossOwnerWriteTest, realm tests |
When the code, a document and a decision record disagree, the code is what runs. Say so in an issue rather than quietly picking one; a document that loses to the code is a documentation defect worth filing.
Make your first change
CONTRIBUTING.md owns the route; in short:
- Pick or open an issue, and branch from
main(feature/,fix/,refactor/ordocs/). - For a defect, reproduce it through the real user or API journey first, then write a test that fails for the right reason.
- Read the architecture guide before touching a module boundary, a migration, identity or configuration.
- Update the document that owns the behaviour you changed, in the same pull request.
- Run the checks CONTRIBUTING lists, read the counts, and open the pull request against
mainwith the template filled in honestly.
Troubleshooting
| Symptom | Next check |
|---|---|
JAVA_COMPILER capability error, or no javac |
JAVA_HOME and both Java versions; a runtime is not enough |
| Container runtime missing | Your socket and DOCKER_HOST; on a shared machine, ask its owner rather than reconfiguring their daemon |
"Previous attempts to find a Docker environment failed", though podman ps works |
The user's podman.socket unit is inactive: systemctl --user start podman.socket, then call any endpoint to retry the deferred Dev Services start |
| Debugger port 5005 already in use | Another session holds it: add -Ddebug=false to the quarkusDev command |
up fails on a karyo-realm.json bind mount |
A compose project from a deleted worktree: down it, or choose a new project name |
A class fails at initializationError with Broken pipe, green on rerun |
Rootless Podman's API idle timeout: set service_timeout = 0 (see Test and debug) |
| Healthy backend, sign-in unavailable | Check Keycloak discovery, then confirm the local manifest created the exact runtime subjects and cutover marker |
| Sign-in page without styles | The known local defect above; the form still works |
| Address already in use, or a wrong redirect | The five fixed ports, and --strictPort on both dev servers |
| Many skipped backend tests | Find the first application boot failure before reading anything downstream |
| A setting appears to be ignored | A database row can override an environment variable: see the runtime configuration store |
| 401, 403, or a goods owner's data missing | Exact binding, local principal state and affiliation, the narrowing token claims, then the grants of the endpoint's declared action (action-not-granted): see identity and tenancy |
| Flyway checksum mismatch | An applied migration was edited: restore its bytes and add a new migration instead |
Related
- Architecture guide - the invariants a change must not break
- Implementer guide - configuring a warehouse, and extending Karyo
- Maintaining this repository - keeping code and documents true
- Testing - what each test runner proves