SandHouse
Articles and contents

Help / Spaces

Custom apps

A custom app space gives a board a small app of its own: a scoreboard, a poll, a reading tracker, a game. It's one HTML file, written by someone on the board or by an AI assistant, and it can keep data that everyone on the board shares.

Write one

Open the space and pick Start from the example or Start from nothing, or Edit app later. Write the whole app in one HTML file of up to 512 KB, with its styles and scripts inside it. Scripts from CDNs and requests to other sites work. Ctrl/⌘ S saves.

Only roles with Manage spaces can change the app. Everyone else sees it and uses it.

Keeping data

The app runs in a sealed-off frame: it can't see your account or the rest of SandHouse. It gets a sandhouse object to keep data with, shared by everyone on the board. Every call returns a promise:

CallDoes
sandhouse.get(key)The value kept under key, or null.
sandhouse.set(key, value)Keeps any JSON value under key.
sandhouse.delete(key)Removes it.
sandhouse.list(prefix)Every entry whose key starts with prefix: { key, value, updatedAt, updatedBy }, sorted by key.
sandhouse.me()Who's using it: { id, username, canEdit }.
sandhouse.board(){ id, name }
sandhouse.onChange(callback)Calls back with every entry when anyone changes something.

Saving needs the Edit content permission, so set and delete fail for viewers. Show them a message when that happens. Keep one record per key, like vote:<person>, rather than one big value, so two people's changes don't overwrite each other.

Limits: keys up to 200 characters, values up to 64 KB, and 2,000 keys or 4 MB for each app.

With an AI assistant

The easiest way to write an app is to ask an assistant: "make our board's app a reading tracker where everyone logs the chapters they've finished". It knows the sandhouse object and the limits above. See Connect an AI assistant.