Skip to content
Spacefast Docs
Esc
navigateopen⌘Jpreview
On this page

Storage

Upload objects from Zero, reach the store from Functions through env.STORAGE, and manage it with the sf storage commands.

Every space that runs code has one durable, unversioned object store, shared by Zero and Functions. Like database rows, objects belong to the space, not to a version, and survive rollbacks.

Reach it from code

Zero clients upload straight from the browser without a separate storage credential:

import { storage } from "@spacefast/zero/client";

const uploaded = await storage.upload(file);
await storage.delete(uploaded.id);

Objects are addressed by a random 128-bit id. Read URLs carry a runtime read key that Spacefast can rotate. Rotation immediately invalidates every URL minted under the old key. Uploads require an identified visitor, except for anonymous commenters admitted by Comments. Those uploads count against the 200 MiB rolling daily budget. Only the uploader can delete an object.

Functions workers receive the same store as env.STORAGE, with upload(file), get(id), and delete(id) methods. For the full binding contract, see the Functions storage section.

Operate the store

The space owner gets an inventory across uploaders and can force-delete an object:

sf storage ls
sf storage rm 0123456789abcdef0123456789abcdef --yes

A force delete is destructive and unrecoverable. Over HTTP, list objects with GET /v1/spaces/{spaceId}/storage and delete one with DELETE /v1/spaces/{spaceId}/storage/{objectId}. See the API reference.

Safety and limits

The store applies these limits:

  • Each object is capped at 5 MiB.
  • Anonymous uploads share a 200 MiB rolling daily budget per space.
  • The store refuses empty uploads and executable or active web content (HTML, JavaScript, PHP, binaries).
  • Total storage counts against the plan’s storage limit.

Last updated on August 24, 2026

Was this page helpful?