Meet ArkAPI

A HarmonyOS app and its backend in one project.

2 MIN READView Markdown ↗
↗ Building with an agent? Start with the project guide.

ArkAPI lets you build a HarmonyOS feature from end to end in one project. You write the backend as TypeScript functions in a *.api.ts file next to the ArkTS screen. The screen imports those functions and calls them. bunx arkapi deploy puts the backend online.

A function is your API#

TypeScript
// greeting.api.ts: runs on the server
export function greet(name: string): string {
  return `Hello, ${name}`
}
TypeScript
// Greeting.ets: runs on the device
import { greet } from './greeting.api'

async function hello(): Promise<void> {
  const message: string = await greet('Ada')
}

ArkAPI reads the function signature and generates greeting.api.ets, a typed client for the screen. There is no URL, request body or JSON parsing to write. If you change the backend signature and forget the screen, the app does not compile.

What is included#

  • Typed calls: functions, interfaces and errors carry through to ArkTS. The server checks every argument.
  • Live data: a screen that shows a query updates by itself when another device changes the data.
  • Storage: SQLite and file uploads, kept across deploys.
  • HTTP routes and jobs: webhooks for other services, and work that runs every hour or every night.
  • Hosting: one-command deploys, a dashboard with traffic, errors, logs and data, environment variables and rollback.

Pick your path#

What you need#

A HarmonyOS project, Bun and DevEco Studio. The hosted service is a development service; check the limits before you depend on it.

Tab to navigate results · Enter to open · Esc to close