# Get started

> Run the sandbox with two household bills, check a bill in your browser, run the tests, and find your way into the crates and the service.

This page runs konto on your machine in a few minutes.

## Before you start

You need [Rust](https://rustup.rs) (the repository pins the toolchain), the
[`just`](https://just.systems) command runner and Git. For the browser parts, add the
`wasm32-unknown-unknown` target (`rust-toolchain.toml` installs it) and Node.js 26 or
later. Docker is only needed to run the database tests on PostgreSQL.

```sh
git clone https://github.com/hupe1980/konto
cd konto
```

## See the account screen

```sh
just portal
```

The sandbox builds the recompute module, starts kontod with an in-memory database, seals
a December and a January bill for the example household and a December fibre bill from a
second company, invites the holder, and prints an invitation link, the second company's
invitation code and a read-only token link:

```text
konto Sandbox: Stadtwerke Musterstadt (VK-1000123, Dezember und Januar) und Musterstadt Glasfaser (GF-2000777, Dezember)

  Als Kundin, mit Passkey:  http://localhost:8080/portal/#invitation=7K3M-Q2XW-…
  Dann „Konto eines weiteren Unternehmens hinzufügen“: 4HZD-…
  Als Kundenportal:         http://localhost:8080/portal/#token=token-of-portal&account=VK-1000123
```

Open the first. Press **Zugang einrichten** and confirm with your fingerprint, face or
device PIN: the browser creates a passkey for `localhost`, and you are signed in. The
account shows what is open and by when, the January bill with what changed against
December, and the Verlauf. On the bill, press **Rechnung nachrechnen**: your browser
recomputes the bill with konto's own code and answers „Stimmt auf den Cent.“ Below,
**Bezahlen** sets up a SEPA direct debit under the mandate text, **Rechnungen erhalten**
switches between e-mail and post, and **Zugang teilen** issues a code for someone you trust. Sign out and back in: one tap, no
name, no password. The second link reads kontod as an operator's backend does, with a
read-only token.

The sandbox listens on 127.0.0.1 only and runs in memory, so its passkeys and invitation
end with it. Its tokens are test tokens; never use them anywhere else.

## Check and render a bill

The `konto` command line checks, renders and compares bills without a server:

```sh
cargo install konto                    # or, inside the repository: cargo run -p konto --
konto example > rechnung.json          # a sealed household bill
konto check rechnung.json              # Stimmt auf den Cent.
konto render rechnung.json -o rechnung.pdf        # PDF/A-3b and PDF/UA-1, e-invoice inside
konto render rechnung.json -f cii > rechnung.xml  # XRechnung 3.0 (or: ubl, html)
konto diff older.json newer.json       # Was hat sich geändert?
```

Every command reads a file or `-` for stdin, so a bill from kontod checks in one line:
`curl -s … /v1/bills/R-2027-000001 | konto check -`. `konto check` exits with 0 when the
bill holds and 1 when it differs, so scripts and CI can rely on it.

The inputs are in `crates/konto-bill/tests/fixtures/household.json`: three sections
(electricity, broadband, water), five charges and two monthly advance payments. The bill
comes to 187,71 € gross, of which 27,71 € are still to pay.

## Run the checks

```sh
just ci        # the gate: format, lint, purity, boundaries, tests, time budgets, WebAssembly, Kundenportal, site, licences, docs
just test-db   # kontod on PostgreSQL in Docker
just test-idp  # customer sign-in against Keycloak in Docker
just portal-check   # the Kundenportal in Chromium against the sandbox, with axe
```

`just ci` is the gate: nothing is done until it passes.

## Where to go next

| You want to | Read |
|---|---|
| understand what konto holds and what it leaves to the sector engines | [How konto works](how-konto-works.md) |
| run kontod with your own configuration | [Run kontod](kontod.md) |
| send charges from your billing or rating system | [Deliver charges](charge-inbox.md) |
| give customers their account screen | [Kundenportal](portal.md) |
| let customers sign in with passkeys and share their account | [Customer sign-in](sign-in.md) |
| let customers grant a SEPA mandate and choose e-mail | [Payment and delivery](self-service.md) |
| use the crates in your own Rust program | [Use the Rust crates](rust.md) |
