ASTRODOCK Docs astrodock.ai GitHub ↗

Resources

Artifacts

An artifact is a small web app: HTML, CSS and JavaScript files, plus a manifest that declares its data and who may do what. Astrodock serves it at its own address, signs people in, and enforces the manifest. The page never handles passwords, sessions or permissions.

Use an artifact for dashboards, to-do lists, trackers, sign-up sheets, simple message boards and similar tools. For anything that needs its own server code, build an app instead.

For Agents

The same reference as plain markdown, for an agent to fetch: artifacts.md. A running instance also serves its own copy, with its own domain filled in: npx @astrodock/cli artifacts guide.

Where Artifacts Run

HostedSelf-Hosted
Addresshttps://<id>.adock.app/ https://<id>.artifacts.<base domain>/ by default, or the domain set in Settings → Artifacts → Artifacts Domain
Where You Manage ThemThe Artifacts section at cloud.astrodock.ai The Artifacts section of your dashboard
Agent Keyastrodock artifacts login --email … A key from your dashboard (see below)
LimitsYour plan's limits, plus the defaults below The operator's limits only

Each artifact is served from its own origin, so its sign-in session and cookies are its own.

Getting Started on the Hosted Service

  1. The Agent Starts the Sign-In

    From the folder that holds the artifact's files, the agent runs:

    npx @astrodock/cli artifacts login --email person@example.com

    It prints a link and a check code, and opens the link in the browser (--no-browser only prints it). --name sets the name the key is listed under.

  2. The Person Presses Send Code

    The link opens a page at https://cloud.astrodock.ai/connect/… with the email already filled in (Change edits it). Nothing is emailed until the person presses Send Code. They type the 6-digit code from the email. That creates the account, or signs in to it if it exists. If the address already runs a server on Astrodock Cloud, the page asks the person to sign in to approve instead.

  3. The Agent Gets Its Key

    The CLI saves ASTRODOCK_URL and ASTRODOCK_TOKEN to .env.astrodock and adds that file to .gitignore. The key reaches artifacts only, nothing about apps.

  4. Make the Artifact

    npx @astrodock/cli artifacts create "Team Tasks" --dir ./site --manifest manifest.json

    It prints the artifact's id and address. The person sees it in the Artifacts section at cloud.astrodock.ai.

Getting Started Self-Hosted

Every Astrodock instance runs artifacts. Open Artifacts in the dashboard and press New Artifact, or let an agent use the CLI with a key that has the artifacts permissions:

  • astrodock login, with Every App chosen when you approve. The one-app key does not cover artifacts.
  • A key made in Access Keys with the Agent, Artifacts preset (artifacts only) or the Operator preset.

Artifacts are served on <id>.artifacts.<base domain>, which needs a wildcard DNS record for *.artifacts.<base domain> pointing at the server. To use a domain of its own, set Settings → Artifacts → Artifacts Domain (or ASTRODOCK_ARTIFACTS_DOMAIN, which wins when set). That domain needs a wildcard DNS record pointing at the server and belongs on the Public Suffix List.

Files

The entry file is index.html unless you set entryFile. A path with no file extension serves the entry file, so client-side routing works. Uploading a file with the same name replaces it.

The Manifest

The manifest is JSON. It declares the roles, the data, the rules for each operation, and the built-in actions. An empty manifest is valid: the default roles and no data.

{
  "roles": ["owner", "manager", "staff", "viewer"],
  "collections": {
    "tasks": {
      "read": "viewer",
      "create": "staff",
      "update": ["manager", "author", { "field": "assignee", "is": "me.email" }],
      "delete": ["owner", "author"],
      "fields": {
        "title": { "type": "string", "required": true, "max": 200 },
        "done": "boolean",
        "assignee": "email",
        "due": "date",
        "status": { "type": "string", "enum": ["open", "blocked", "done"] }
      },
      "attachments": { "max": 5, "types": ["image/*", "application/pdf"] }
    },
    "notes": { "scope": "per-user" }
  },
  "blobs": {
    "settings": { "read": "viewer", "write": "owner" }
  },
  "actions": [
    { "on": "tasks.create", "do": "email", "to": { "field": "assignee" }, "subject": "New task: {{title}}" },
    { "on": ["tasks.create", "tasks.update"], "do": "stamp", "field": "completedAt", "when": { "field": "done", "is": true } },
    { "do": "digest", "collection": "tasks", "to": { "role": "manager" }, "hour": 13 }
  ]
}

Roles

A ladder, highest first. The first role must be owner, and the artifact's owner always holds it. Each role can do everything the roles below it can. With no roles, the ladder is owner, editor, viewer.

Rules

Each operation names who may do it:

EntryMeans
"staff"That role and every role above it.
"author"Whoever created the record (read, update, delete).
{ "field": "assignee", "is": "me.email" }Records whose field holds the viewer's email (read, update, delete).
"public"Anyone, signed in or not, on a public artifact (read only).

A list grants access if any entry matches. Collection operations are read, create, update and delete. Blob operations are read and write.

Write the rules out. If you leave one out, read goes to every role and the writes go to the role just above the lowest.

Collections

A collection holds records, each with an id. The server sets id, _author, _createdAt, _updatedAt and _version on every record. Field names cannot start with _.

Fields

fields is optional. Without it, any JSON object is accepted. With it, the server rejects unknown fields and wrong types, and says which. A field is a type name, or an object with type and options.

TypeHolds
stringText up to 1000 characters, unless max says otherwise.
textLonger text.
number, integerNumbers; integer is whole numbers only.
booleantrue or false.
emailAn email address.
dateYYYY-MM-DD.
datetimeISO 8601.
urlA URL.
list, jsonA list, or any JSON value.

Options: required, min, max, enum.

Per-User Scope

"scope": "per-user" on a collection makes each person's records visible only to them. On a blob, it gives each person their own copy.

Attachments

attachments lets people attach files to records. Set it to true, or to an object:

KeyMeansDefault
maxFiles per record (1 to 100)10
maxBytesBytes per file10485760 (10 MB)
typesMIME types, like "image/*" or "application/pdf"Any type

Anyone who can change a record, and its author, may attach and remove files. Anyone who can read the record may open them. Records then carry _files: [{ id, name, size, type, url }]. Images and PDFs open in the browser; everything else downloads.

Blobs

A blob is one JSON document per name, with a version check, for settings or anything that is not a list of records.

Actions

The complete list:

ActionWhat It Does
emailOn <collection>.create, .update or .delete, emails { "role": … } (that role and above), { "field": … } (an email field) or { "author": true }. subject and optional body may use {{field}}. Optional when: { field, is }; on update it sends only when the condition becomes true.
stampOn create or update, sets field to the time ("value": "now", the default) or the viewer's email ("value": "me.email"). With when, it sets the field once the condition holds and clears it when it stops holding.
digestOnce a day at hour (UTC, default 13), emails a role a list of what was added or changed in a collection. If nothing changed, nothing is sent.

Email goes only to people who have access to the artifact. The person who made a change is not emailed about it. Sends are capped per owner per day.

The Browser Client

Load the client from the artifact's own host:

<script src="/_astrodock/client.js"></script>
<script type="module">
  const me = await astrodock.me();          // { signedIn, email, role, roles, permissions }
  const tasks = astrodock.db('tasks');
  const open = await tasks.list({ where: { done: false }, order: '-_createdAt', limit: 100 });
  const t = await tasks.add({ title: 'Call the vendor', assignee: 'sam@example.com' });
  await tasks.update(t.id, { done: true, _version: t._version });   // 409 if someone changed it first
  await tasks.remove(t.id);
  const { counts } = await tasks.count('status');
  const stop = tasks.subscribe(({ type, record }) => { /* create, update or delete */ });
  const file = await tasks.attach(t.id, input.files[0]);   // { id, name, size, type, url }
  await tasks.detach(t.id, file.id);
  const settings = astrodock.blob('settings');
  const { data, version } = await settings.get();
  await settings.set({ ...data, theme: 'dark' }, version);
</script>
  • list options: where (exact match on fields), order (a field, _createdAt or _updatedAt; prefix - for descending), limit (up to 1000), offset.
  • me().permissions says, per collection and blob, whether the viewer can do each operation: true, false, or "some" (only records they wrote or are named on). Use it to hide controls the viewer cannot use.
  • Errors throw with .status. A rejected record also has .problems, and a 409 has .current (the record as it is now).
  • astrodock.signOut() ends the viewer's session on this artifact.
  • astrodock.report(message) records an error of your own choosing.

The page can load anything from anywhere (fonts, chart libraries). Data calls go only to /_astrodock/api on the artifact's own host.

Sharing and Guest Sign-In

An artifact is private to its owner until it is shared. Share by email and give each person a role:

npx @astrodock/cli artifacts share <id> sam@example.com --role staff
  • Each person gets an email with a link (--no-notify skips it). When they open it, they enter their email and get a 6-digit sign-in code.
  • People on the Astrodock account itself are signed in without a code.
  • Removing someone from the share list ends their access at once.

Setting visibility to public (the Settings tab, or visibility over HTTP) lets anyone open the artifact without signing in. Only rules that include "public" apply to them, and only for reading. Public artifacts need a paid plan on the hosted service.

Live Updates

subscribe calls back with { type, record } on every create, update or delete, and returns a function that stops it. It uses server-sent events and reconnects by itself. Each viewer only receives changes to records they can read.

Attachment changes are not sent as live updates. Re-read the record to get its _files.

Errors, Problem Reports, Usage and History

The platform adds /_astrodock/client.js to every HTML page it serves, so each page reports its own errors: uncaught errors, rejected promises, console.error calls and requests that failed. The server records failed data calls. Errors are grouped, with a count and the people who hit them.

npx @astrodock/cli artifacts errors <id>           # read them
npx @astrodock/cli artifacts errors <id> --clear   # clear them once fixed

The client also adds a small Report a Problem link to every page. Reports go to the owner.

In the dashboard, each artifact has Files, Sharing, Data, Activity, Errors, Manifest and Settings tabs. From the CLI, artifacts usage <id> prints views, people, changes, reads, records, storage, emails and errors, and each person with their role and when they were last seen.

What Is Logged

Page views, every write, every failed call, sign-in attempts, errors, and the before and after of every change are kept for 90 days. Self-hosted, the operator can change that in Settings (Artifact Log Retention (Days)). Reads are counted per hour. The owner and the platform's admins can see the logs. Every change to a record can be read back: who, when, before and after.

Capability Feedback

When an artifact needs something this setup cannot do (a rule it cannot express, an action that does not exist, a limit that is too low), the agent sends a feedback item and carries on with the best workaround:

npx @astrodock/cli artifacts feedback "What you needed" --tried "…" --workaround "…" --artifact <id>

It goes to the Astrodock project, from every instance including self-hosted ones, and decides what gets built next. The artifact's manifest is sent with it. Records, email addresses and files are not. One item per missing capability.

Errors in the page are bugs to fix, not capability feedback. A plan limit is a plan question, not a capability gap.

Plans and Limits

On the hosted service, each creator has a plan. Viewers are free on every plan. A server plan on Astrodock Cloud includes Creator.

FreeCreator
PriceFree$10/month
AvailabilityOpen nowComing soon
Artifacts3Unlimited
People per Artifact10250
Storage100 MB10 GB
Public ArtifactsNoYes, with 50 GB a month of public bandwidth

Storage counts files, records, blobs and attachments across all of a creator's artifacts. Going over a plan limit returns 403 with "code": "plan_limit" and a limit naming which one (artifacts, guests, storage or public). Self-hosted instances have no plan limits.

These limits apply everywhere. Self-hosted, the operator can change each one with the setting shown:

LimitDefaultSetting
File size25 MBASTRODOCK_ARTIFACT_MAX_FILE
Files per upload50ASTRODOCK_ARTIFACT_MAX_FILES
Record size64 KBASTRODOCK_ARTIFACT_MAX_RECORD
Records per artifact50,000ASTRODOCK_ARTIFACT_MAX_RECORDS
Blob size1 MBASTRODOCK_ARTIFACT_MAX_BLOB
Invites per owner per day100ASTRODOCK_ARTIFACT_INVITES_PER_DAY
Action emails per owner per day200ASTRODOCK_ARTIFACT_ACTION_EMAILS_PER_DAY
Sign-in codes per email per hour5ASTRODOCK_ARTIFACT_CODES_PER_HOUR

CLI Commands

Run them from the folder that holds .env.astrodock. npx @astrodock/cli artifacts help prints this list.

CommandWhat It Does
artifacts login --email E [--name N]Connect through the hosted service. The key reaches artifacts only.
artifacts guidePrint the guide: manifest, rules, client, actions, limits.
artifacts listYour artifacts.
artifacts create "<title>" [--dir D] [--manifest F]Make one, upload the files in D, and set the manifest from F.
artifacts push <id> <dir|file>Upload files. Replaces files of the same name.
artifacts manifest <id> [file.json]Print the manifest, or set it from a file.
artifacts share <id> <email>… [--role R] [--no-notify] Share with one or more people.
artifacts unshare <id> <email>End one person's access.
artifacts errors <id> [--clear]Errors from the page and failed data calls.
artifacts usage <id>Views, people, writes, storage, emails.
artifacts feedback "<needed>" [--tried T] [--workaround W] [--artifact ID] Something the framework cannot do. Goes to the Astrodock project.

A push skips hidden files, node_modules and a folder named private.

HTTP API

Every call uses your Astrodock key, Authorization: Bearer tk_..., against the address saved as ASTRODOCK_URL (self-hosted, the dashboard host, https://admin.<domain>).

POST   /admin/artifacts                      { title, manifest, files: [{ name, content }] }
GET    /admin/artifacts                      everything you own or can open
GET    /admin/artifacts/:id
PATCH  /admin/artifacts/:id                  { title, manifest, entryFile, folderId, visibility }
PUT    /admin/artifacts/:id/files            { files: [{ name, content, encoding? }] }  ("base64" for binary)
DELETE /admin/artifacts/:id/file?name=…
POST   /admin/artifacts/:id/shares           { emails: [...], role, notify? }
DELETE /admin/artifacts/:id/shares?email=…
GET    /admin/artifacts/:id/data/:collection  every record, as the owner sees it
GET    /admin/artifacts/:id/errors           errors from the page and failed data calls
DELETE /admin/artifacts/:id/errors           clear them
GET    /admin/artifacts/:id/reports          Report a Problem submissions
GET    /admin/artifacts/:id/usage            views, people, writes, reads, storage, emails
GET    /admin/artifacts/:id/activity?kind=views|api|signins
GET    /admin/artifacts/:id/history?recordId=…  every change to a record: who, when, before, after
POST   /admin/artifacts/feedback             { artifactId, needed, tried, workaround }

Moving a Page Into an Artifact

A page's detail view in the dashboard has a Move to Artifacts button. It copies the page's files into a new artifact, turns its saved data into a blob named data, and turns its allowlist into shares without emailing anyone. The page is left as it was. A page that called _data needs those calls changed to astrodock.blob('data'). A passkey does not carry over: share the artifact with the people who had it.

Next Steps