Skip to content

tloncorp/mini-apps-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Tlon Mini Apps Examples

Example apps for the Tlon Mini Apps platform. Apps are written in AssemblyScript and compiled to WASM to run on your Urbit ship.

What are Mini Apps?

Mini apps are WASM-based applications that run inside Tlon messenger. They respond to /commands and post messages as your ship (not a bot).

User: /roll 2d6
User: [roll] 🎲 [4, 2] = 6

See the PRD for full architecture details.

Examples

App Description Complexity
poll Create polls, vote, see results Simple
dice Roll dice (2d6, d20+5, etc.) Simple
water Track daily water intake Simple
notes Quick notes with add/list/delete Simple
karma Give +1 reputation to ships Medium
remind Set reminders with timers Medium
iou Track debts and payments Medium

SDK Interface

Apps implement these exports:

// Required: Handle /appname <input>
export function onMessage(input: string): string;

// Optional: Handle scry queries
export function onQuery(path: string): string;

// Optional: Handle timer callbacks
export function onTimer(timerId: string, payload: string): string;

And can call these runtime functions:

// State persistence
declare function getState(): string;
declare function setState(json: string): void;

// Context
declare function getShip(): string;
declare function getChannel(): string;

// Randomness (real entropy from Urbit)
declare function random(): f64;
declare function randomInt(max: i32): i32;

// Timers
declare function setTimer(delayMs: i64, payload: string): string;
declare function cancelTimer(timerId: string): void;

Development

Until the runtime ships, you can develop apps locally:

# Install dependencies
npm install

# Build an app
cd apps/poll
npm run build

# Run tests (mock runtime)
npm test

Contributing

  1. Fork the repo
  2. Create your app in apps/your-app/
  3. Include a README with usage examples
  4. Submit a PR

License

MIT

About

Example Tlon Mini Apps in AssemblyScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published