Kiri Developers

KIRI DEVELOPERS

Build on Kiri

One SDK, in Go, Rust, TypeScript or Python. Write a module, your own program that Kiri runs beside your containers, or a plugin that adds something to Kiri itself.

Build a module

Your program, run by Kiri. Change two lines of a web service and Kiri runs it as WebAssembly beside your containers. It starts in about a millisecond and reaches only what kiri.yaml lists.

Quick start kiri.yamlSix calls
Build a plugin

Extend Kiri. Add a way to share, a place to deploy, a scanner, a check before a pull, or a tab, a column or a note in Kiri's window. People read its permissions before they install it.

Your first plugin kiri-plugin.tomlPlugin API

Quick start

From a web service you already have to a running module. The code follows the language you pick at the top of the page.

  1. Add the SDK to your project with your language's own tool. Kiri reads go.mod, Cargo.toml, package.json or pyproject.toml.
  2. Change two lines: the one that opens the database and the one that listens. Your handlers stay as they are.
  3. List what it may touch in kiri.yaml: its port, its database, the sites it calls, its secrets.
  4. Check, then run. kiri check says what WebAssembly can't run; kiri run builds and starts it. No Dockerfile.
// go get runkiri.com/go/kiri
db := kiri.DB()     // was: sql.Open("sqlite3", "shop.db")
kiri.Serve(nil)     // was: http.ListenAndServe(":8080", nil)
// cargo add kiri
let db = kiri::db();   // was: a pool opened from DATABASE_URL
kiri::serve(app)?;     // was: axum::serve(listener, app).await?
// npm install @kiri/sdk
const db = kiri.db();  // was: new pg.Pool({ connectionString: … })
kiri.serve(app);       // was: app.listen(8080)
# pip install kiri
db = kiri.db()         # was: sqlite3.connect("shop.db")
kiri.serve(app)        # was: app.run(port=8080)
zsh
$ kiri check .
  shop · 41 packages
  ✓ 41 packages work as WebAssembly · 0 to change
$ kiri run .
  ●  serving on :8080 · 2.1 MB · started in 1.2 ms
     http://shop.kiri.local

The full quick start, from a plain Go program to a link you can share.

Six calls, the same in every language

A module asks Kiri for everything outside its own code. Each call needs its key in kiri.yaml, and Kiri refuses whatever the file doesn't list.

kiri.Servekiri::servekiri.servekiri.serve

Kiri listens on the port and your handler answers each request.

kiri.yaml: port
kiri.DBkiri::dbkiri.dbkiri.db

A SQLite database kept by Kiri, or a connection to a real Postgres.

kiri.yaml: database
kiri.HTTPkiri::httpkiri.httpkiri.http

Outbound calls, only to the sites you list.

kiri.yaml: network
kiri.Secretkiri::secretkiri.secretkiri.secret

A secret read from the system's keychain, never from a file.

kiri.yaml: secrets
kiri.KVkiri::kvkiri.kvkiri.kv

Key-value storage that outlives restarts and rebuilds.

kiri.yaml: kv
kiri.Logkiri::logkiri.logkiri.log

Logs with levels and fields, in Kiri's window and your terminal.

kiri.yaml: always allowed

Each returns the type your code already uses where there is one, such as Go's *sql.DB. The API reference has every signature.

Every place a plugin can use

A plugin names the places it wants. Each becomes one line in the install prompt, and Kiri draws what the plugin sends there in its own look. Pick a number to read about that place.

  1. 1A note in the status bar[window] status
  2. 2Items in a row's menu, and commands[adds] actions, commands
  3. 3A tab, and a line at the top of a page[window] tabs, facts
  4. 4A page under the Plugins heading[window] page
  5. 5A section of its own, with its settings button[window] section
  6. 6A choice in Share with, Deploy to or Scan with[adds] share, deploy, scan
  7. 7A column of badges in a list[window] columns
  8. 8Notices, and system notifications[window] notices, notifications
  9. 9Fields in Settings[[settings]]
  10. 10Checks before pull, build and run[adds] checks: no place of their own

Examples

Worked plugins and a module, from setup to the code and the permissions behind them.

Publish to the marketplace

Four commands take a plugin from your folder to everyone who uses Kiri: dev, check, test and publish.

Open source, under Apache 2.0

The SDK is open source under the Apache License 2.0, the same licence as Kiri's engine. Modules use WASI interfaces and are stored as OCI artifacts, so the code inside isn't tied to Kiri, and any registry that holds images holds modules.

Apache-2.0WASIOCI artifacts