> ## Documentation Index
> Fetch the complete documentation index at: https://koonj-docs.appsthatmatter.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Develop Koonj locally

> Run the React console and Spring Boot API, test changes, and build deployment packages.

## Prerequisites

Use JDK 21, Maven 3.9 or later, Node.js 22.12 or later with npm, and Docker Compose v2. Run the commands from the Koonj application source root unless a step gives another directory.

## Start the local stack

Build or download and extract the [deployment ZIP](https://koonj-docs.appsthatmatter.uk/installation/docker.md#configure-the-deployment). In its `docker/` directory, copy `.env.example` to `.env`, replace the password placeholders, and keep the local Keycloak URL at `http://localhost:8180`. Allow `http://localhost:5173/*` for the `koonj-ui` client using the [Keycloak configuration steps](https://koonj-docs.appsthatmatter.uk/installation/configuration.md#configure-keycloak).

```bash theme={null}
docker compose up -d --wait postgres keycloak
```

Return to the application source root and start LocalStack.

```bash theme={null}
docker compose -f deploy/localstack-s3/docker-compose.localstack.yml up -d --wait
```

PostgreSQL listens on port 5432, Keycloak at `http://localhost:8180`, and LocalStack at `http://127.0.0.1:4566` by default. LocalStack provisions `koonj-local-archive` in `eu-west-2`. Set `KOONJ_LOCAL_BUCKET` and `KOONJ_LOCAL_REGION` before starting Compose to change them.

Build and install the shared notification model into your local Maven repository once before launching the API module. Repeat this step when you modify that module.

```bash theme={null}
mvn -pl koonj-notification-model -am install
export KOONJ_DB_URL='jdbc:postgresql://localhost:5432/koonj?reWriteBatchedInserts=true'
export KOONJ_DB_USERNAME=koonj
export KOONJ_DB_PASSWORD='<password from the packaged .env>'
export KOONJ_STORAGE_KEY_PROVIDER=local
export KOONJ_STORAGE_LOCAL_ACTIVE_KEY=dev
export KOONJ_STORAGE_LOCAL_KEYS="dev:$(openssl rand -base64 32)"
export KOONJ_STORAGE_ALLOW_INSECURE_ENDPOINTS=true
mvn -pl koonj-server spring-boot:run
```

Use the database credentials from the packaged `.env`. The example generates a wrapping key for a disposable database. Reuse the same key across restarts if you need to keep encrypted connection credentials. The server listens on port 8080 and uses `KOONJ_DDL_AUTO=update` by default.

In a second terminal, start the UI.

```bash theme={null}
cd koonj-ui
npm ci
npm run dev
```

Open `http://localhost:5173`. By default Vite proxies `/api/v1` to the API at `http://127.0.0.1:8080`. An absolute `VITE_API_BASE_URL` bypasses the proxy and requires the matching origin in `KOONJ_CORS_ALLOWED_ORIGINS`. For same-origin production builds, use `VITE_API_BASE_URL=/api/v1`.

Sign in with a development account defined in `deploy/keycloak/koonj-realm.json`, or use **Create Account** and assign a realm role in Keycloak. The default development Keycloak admin console is `http://localhost:8180/admin`. For the [quickstart](https://koonj-docs.appsthatmatter.uk/quickstart.md), register a local test directory and a **Custom S3** connection with the LocalStack endpoint, bucket, and region above. Enable **Path-style access**, select **Encrypted access keys**, and use `test` for both keys.

To stop the backing services, run `docker compose -f deploy/localstack-s3/docker-compose.localstack.yml down` from the source root and `docker compose down` from the packaged `docker/` directory.

## Find the code

| Module | Responsibility |
| - | - |
| `koonj-server` | Spring Boot API, storage connectors, catalog, job execution, authorization, and notification outbox. |
| `koonj-ui` | React and TypeScript console, Vite dev server, Keycloak sign-in, and client API services in `src/api`. |
| `koonj-notification-model` | Shared notification entities and repositories. |
| `koonj-notification-worker` | RabbitMQ relay, delivery routing, SMTP, and webhooks. |
| `koonj-fuse` | Linux filesystem view and transparent recall client. |
| `koonj-assembly` | Deployment ZIP with the Docker Compose stack. |

Browse Swagger at `http://localhost:8080/swagger-ui/start` and retrieve OpenAPI JSON at `http://localhost:8080/v3/api-docs`. See the [API guide](https://koonj-docs.appsthatmatter.uk/api/overview.md) for authentication and project scope.

## Run tests

```bash theme={null}
mvn -pl koonj-server,koonj-notification-worker -am test
cd koonj-ui
npm test
npm run build
```

## Build the deployment ZIP

From the source root, run:

```bash theme={null}
mvn -pl koonj-assembly -am clean package
```

Find `koonj-<version>-koonj-deployment.zip` in `koonj-assembly/target/`. Pass `-Ddeployment.version=1.0.0` to override the version in the ZIP name and its top-level directory. Use the archive’s `docker/` directory for cloud deployment. It includes the executable server, worker and FUSE JARs and compiled web assets.

## How releases are built

The CI workflow runs backend tests, builds and tests the web console, and checks the Docker bundle. The CD workflow runs for numeric release tags or a manually supplied version. It builds the ZIP, attaches it and its SHA-256 checksum file to the GitHub release, and publishes version-tagged server, UI, notification worker, and FUSE images to GitHub Container Registry and Docker Hub. The packaged Compose stack builds its services locally from the ZIP.

[View CI and release workflows](https://github.com/atmenterprise/koonj/tree/main/.github/workflows)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.