# File storage inside every project.

Source: https://cubibase.com/features/storage

Also available: [Markdown version](https://cubibase.com/features/storage.md) · [llms.txt](https://cubibase.com/llms.txt) · [full site content](https://cubibase.com/llms-full.txt)

CubiBase Storage keeps your files in private, encrypted object storage and the file catalog in your project’s PostgreSQL database. Apps upload directly with short-lived authorizations, every download is metered, and private buckets require a key, a user session, or a signed link.

## At a glance

- **Public and private buckets** — Per-bucket visibility, MIME allowlists, and size caps. Folders are path prefixes over opaque physical keys.
- **Direct uploads** — A presigned POST pinned to one upload and the exact size. The file goes straight from the client to storage.
- **Metered downloads** — Every download counts against bandwidth. Range requests are metered byte-accurately.
- **Signed share links** — A signed token scoped to a single object with a short expiry. Public objects also have a stable public URL.
- **Hard quotas** — Capacity checked atomically before any upload authorization. At a limit, uploads stop by default — metered additional usage is an explicit opt-in with a spending limit.
- **Durable object events** — Created, updated, and deleted events recorded with every catalog change, ready to trigger Functions.

## Public and private buckets

A bucket is a named container for objects, unique within the project. Each bucket is public or private, can cap the file size below the plan maximum, and can restrict uploads to an allowlist of MIME types such as image/* or application/pdf.

- Public means anonymous read-only access to published files. Uploads, overwrites, and deletions always require authorization.
- Private buckets require a project API key, an end-user session, or a short-lived signed download link.
- Folders are path prefixes, not real directories: images/avatar.png is a logical path, while the stored object uses an opaque generated key.
- Bucket metadata lives in a managed storage schema in the project database — customer code cannot read or write it directly.

## Direct uploads, verified completion

An upload takes three steps. Your client starts an upload session; CubiBase reserves the bytes against the project and account quotas and returns a short-lived presigned POST pinned to one upload and the exact declared size. The client posts the file directly to storage. Then the client completes the session: CubiBase checks the stored object’s exact size and MIME type, publishes it at its path, and turns the reservation into committed usage.

Completion is idempotent, expired sessions release their reservations automatically, and a failed upload never becomes a downloadable object or emits a creation event. Overwriting an existing path requires an explicit opt-in and accounts for the net change in bytes.

## Metered downloads and signed links

Every download — public or private, API or Console — counts against the account’s monthly bandwidth quota. HTTP Range requests are supported and metered byte-accurately; a canceled download counts only the bytes actually delivered. There are no unrestricted download URLs that could bypass the meter.

For sharing, CubiBase issues a signed download token scoped to a single object with a short expiry. Public objects also have a stable public URL.

## Quotas enforced on the server

Storage limits come from the same subscription as the rest of the platform, shared across your organization: Free includes 2 GB of object storage, Pro 100 GB, Business 250 GB, with 15 GB/500 GB/750 GB of monthly total bandwidth shared by API responses and file delivery (API bandwidth is a sublimit of that total) and a 50 MB/1 GB/5 GB maximum file size. Capacity is checked atomically before any upload authorization is issued, so concurrent uploads cannot race past it.

- At a storage limit, new uploads are blocked; downloads, deletions, and upgrades keep working.
- When bandwidth is exhausted, downloads are refused until the billing cycle resets; metadata management stays available.
- Downgrading below current usage preserves every file and blocks uploads until usage fits the new plan.
- No automatic overage charges: by default a quota is a hard stop, not a bill. Paid plans can opt in to metered additional usage with a spending limit.

## Durable object events and function triggers

Every finalized upload, overwrite, and deletion records a versioned storage.object.created, storage.object.updated, or storage.object.deleted event in the same database transaction as the catalog change. Events carry the project, bucket, object, path, size, and actor identity — never file contents or credentials.

CubiBase Functions consume these events through storage triggers: generate thumbnails, process PDFs, clean up expired files. Configure a bucket, event types, and an optional key prefix in the Console — no polling infrastructure of your own. Function-created objects count toward the same quotas through the same service, and invocation-depth tracking bounds recursive loops.

## FAQ

**Do storage credentials ever reach the client?**

No. Clients receive only a short-lived presigned POST for one upload with an exact size, or a signed download token for one object. The underlying storage blocks all public access.

**What happens to a file when I overwrite it?**

The new upload must explicitly opt in to overwriting. CubiBase verifies the new object before replacing the old one and adjusts usage by the net difference in bytes. A storage.object.updated event is recorded.

**Is storage isolated between projects?**

Yes. Stored objects are namespaced by project and bucket, the catalog lives in each project’s own database, and every request is resolved from the project host and credentials — never from a client-supplied project id.

## Related

- [Storage docs](https://cubibase.com/docs/storage) — Buckets, uploads, downloads, and quota errors with real API calls.
- [Security](https://cubibase.com/features/security) — Keys, JWTs, and the authorization model Storage reuses.
- [Pricing](https://cubibase.com/pricing) — Storage and bandwidth quotas on every plan.
