# Step 5 · Run it on the ward

Canonical page: https://docs.ovok.com/guides/staffed-kiosk/run-it-on-the-ward

The same stack as your laptop, on servers you control: Supabase for the register, the kiosk served over HTTPS, and tablets locked to the kiosk.

## Before you begin [#before-you-begin]

- The kiosk working end to end from step 4.
- A server or cluster for Supabase, and a host for the kiosk's static files.

## Self-host Supabase [Terminal] [#self-host-supabase-terminal]

Follow Supabase's [self-hosting with Docker](https://supabase.com/docs/guides/self-hosting/docker) guide, then:

1. Apply the migration in `supabase/migrations` to the new database.
2. Put `supabase/functions/patients` in the functions volume, and set `OVOK_BASE_URL`, `OVOK_PROJECT_ID` and `PATIENT_IDENTIFIER_SYSTEM` on the functions service.
3. Turn off the gateway's Supabase token check for the function, as `verify_jwt = false` does locally: the kiosk sends an Ovok token, which the function checks itself.
4. Keep Studio and the database port off the public network.

`OVOK_BASE_URL` points at the Ovok environment your nurses sign in to. Use the sandbox until the project goes live.

## Serve the kiosk [Terminal] [#serve-the-kiosk-terminal]

~~~bash
npm run build
~~~

Serve `dist/` over HTTPS from any static host, with `VITE_SUPABASE_URL` set to your Supabase API URL at build time. The kiosk carries no secret, so a public static host is fine.

## Set up the tablets [Console] [#set-up-the-tablets-console]

- Lock each tablet to the kiosk with the platform's single-app mode (screen pinning or guided access).
- Pair a barcode scanner as a keyboard. It types the card code and presses Enter.
- Each nurse signs in at the start of the shift and taps **End shift** at the end. Closing the browser tab also ends the session.

## Protect the register [Server-side] [#protect-the-register-server-side]

The register is the only thing that turns a pseudonym back into a person.

- Back it up on the same schedule as your other clinical records. If it is lost, the readings in Ovok can no longer be tied to anyone.
- Grant access to the database and Studio to the people who administer it, and log that access.
- Keep the identifier system unchanged for the life of the project; Patients are found by system and pseudonym together.

## Verify your integration [#verify-your-integration]

1. Sign in on a tablet, scan a test card and save a reading.
2. Read the Patient in Ovok: it carries only the pseudonym.
3. Restore the register from a backup into a test database and look the card up again.

## Troubleshooting [#troubleshooting]

- **Every request answers `401`:** the gateway still checks for a Supabase token. Turn the check off for this function.
- **The kiosk cannot reach the function:** check `VITE_SUPABASE_URL` in the build and that the function is served under `/functions/v1/patients`.
- **Readings save but lookups fail:** the function cannot reach Ovok. Check `OVOK_BASE_URL` from inside the functions service.

## See also [#see-also]

- [Run a staffed measurement kiosk](/guides/staffed-kiosk)
- [Access policies](/access-policies)
- [Connect to your EHR](/guides/connect-your-ehr)
