---
title: "The secret sauce"
description: "ArkAPI looks like magic. Here is the plumbing, one trick at a time."
url: "https://arkapi.emincanozcan.com/docs/secret-sauce"
---

# The secret sauce

ArkAPI looks like magic. Here is the plumbing, one trick at a time.

You write a function, call it from a screen and run one command. Everything between those three steps is ArkAPI's job. These pages open it up: what happens, why it was built that way, and where to find it. Paths point into the `arkapi` repository unless they say *host*.

```diagram
 your project                                 on the phone
 ────────────                                 ────────────
 notes.api.ts ── generate ──► notes.api.ets ─► built into the app
      │                       (typed client)         │
      │ deploy                                       │
      ▼                                              │
 ┌─ ArkAPI host ────────────────────┐                │
 │  your backend, bundled           │◄── calls ──────┤
 │  own process · own user          │                │
 │  SQLite · files · jobs           │── live data ──►┘
 └──────────────────────────────────┘    & events
```

## The tricks

| Page | The "wait, how?" moment |
|---|---|
| [From signature to client](/docs/sauce-types.md) | One import line means two different files, and your TypeScript types reach ArkTS without a schema file. |
| [Live data without wiring](/docs/sauce-live.md) | A screen subscribes to a query without naming it, and updates without you saying what changed. |
| [Teaching DevEco about Bun](/docs/sauce-deveco.md) | `bun:sqlite` autocompletes inside a HarmonyOS IDE that has never heard of Bun. |
| [Deploys that keep the line open](/docs/sauce-deploys.md) | A deploy swaps the server under a live chat and nobody's screen notices. |
| [Made for coding agents](/docs/sauce-agents.md) | The same docs URL answers a browser with HTML and an agent with Markdown. |

## The rules behind every trick

- **One source of truth.** The function signature is the contract. Nothing is written twice, so nothing drifts.
- **Fail on the laptop, not on the phone.** A wrong type stops `generate`; a renamed field stops the ArkTS build.
- **Boring parts, clever seams.** SQLite, WebSockets, systemd and the TypeScript compiler do the heavy lifting. ArkAPI is mostly the glue between them.
