The secret sauce

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

2 MIN READView Markdown ↗

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#

PageThe "wait, how?" moment
From signature to clientOne import line means two different files, and your TypeScript types reach ArkTS without a schema file.
Live data without wiringA screen subscribes to a query without naming it, and updates without you saying what changed.
Teaching DevEco about Bunbun:sqlite autocompletes inside a HarmonyOS IDE that has never heard of Bun.
Deploys that keep the line openA deploy swaps the server under a live chat and nobody's screen notices.
Made for coding agentsThe 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.
Tab to navigate results · Enter to open · Esc to close