Backend?It's just a function.

Export a TypeScript function. Call it from ArkTS, fully typed. Deploy with one command.

notes.api.ts / server
export function addNote(text: string): void {
  db.run('insert into notes (text) values (?)', [text])
}
typed client, generated · no URL, no JSON
Notes.ets / device
import { addNote } from './notes.api'

Button('Add').onClick(() => addNote(this.draft))

Less code. Fewer tokens.

The same notes app, built with ArkAPI and with a separate backend plus a hand-written client.

6.8×

less code

ArkAPI64 linesSeparate backend435 lines

5.3×

fewer AI tokens

ArkAPI685Separate backend3,657

6.5×

fewer files

ArkAPI2Separate backend13

0

networking code

ArkAPI0 linesSeparate backend116 lines

Both versions compile. Blank lines, comments and the generated client are not counted; tokens use o200k. Counted by a script you can run ↗

A feature is two files.

A backend file and the screen that calls it.

notes.api.ts / server
import { Database } from 'bun:sqlite'
import { ApiError } from 'arkapi/server'

export interface Note { id: number; text: string }

const db = new Database('app.db')
db.run(`create table if not exists notes (
  id integer primary key,
  text text
)`)

export function listNotes(): Note[] {
  return db.query<Note, []>('select * from notes').all()
}

export function addNote(text: string): number {
  if (!text.trim()) {
    throw new ApiError('BAD_REQUEST', 'Empty note')
  }
  const sql = 'insert into notes (text) values (?)'
  return Number(db.run(sql, [text]).lastInsertRowid)
}
Notes.ets / device
import { AsyncValue, LiveValue } from 'arkapi'
import { addNote, listNotes, Note } from './notes.api'

@Entry
@Component
struct Notes {
  // Updates by itself when anyone adds a note.
  @State notes: LiveValue<Note[]> = new LiveValue(listNotes)
  @State added: AsyncValue<number> = new AsyncValue()
  @State draft: string = ''

  add() {
    this.added.run(addNote(this.draft))
  }

  build() {
    Column() {
      ForEach(this.notes.data ?? [], (note: Note) => {
        Text(note.text)
      }, (note: Note) => `${note.id}`)
      TextInput({ text: $$this.draft })
      Button('Add').onClick(() => this.add())
    }
  }
}

End-to-end static typing.

Rename a field on the backend, and every screen that still reads it stops compiling.

notes.api.ts / renamed
export interface Note {
  id: number
- text: string
+ body: string
}
build / device✓ caught
Notes.ets:34:25
Property 'text' does not exist on type 'Note'.

COMPILE RESULT:FAIL

With a separate backend and a hand-written client, this build passes and every note shows up blank.

Hosting is included.

Every deploy gets traffic, errors, logs, data, secrets and rollback.

What a real app needs.

One line each.

Start in two commands.

bun add -d git+ssh://[email protected]/emincanozcan/arkapi.git
bunx arkapi init
Read the quickstart →

In active development. One machine, fixed limits, no user sign-in yet.