Storage
Every project gets S3-compatible object storage. You organize files into buckets, and each bucket can be private (access through your app / signed URLs) or public (files served directly over a permanent URL). Use it for avatars, uploads, exports, static assets, and more.
Concepts
| Term | Meaning |
|---|---|
| Bucket | A top-level container for files. Created public or private. |
| Object | A single file, addressed by its path (e.g. user-123/avatar.png). |
| Folder | A path prefix. There are no real directories — a / in the path groups files. avatars/2026/pic.png lives in the avatars/2026/ folder. |
| Public bucket | Objects are readable by anyone at a permanent URL, no token. Good for assets. The bucket itself is not listed: only someone with a file's URL can read it. Pages, SVG, XML and scripts are served as downloads, never run in the browser. |
| Private bucket | Objects require your app's session or a time-limited signed URL. |
Buckets
Manage buckets with bf.storage.
import { createClient } from 'basefyio-js'
const bf = createClient()
// Create a bucket (private by default)
await bf.storage.createBucket('avatars')
// Create a PUBLIC bucket
await bf.storage.createBucket('assets', { public: true })
// List all buckets
const { data: buckets } = await bf.storage.listBuckets()
// [{ name, public, objectCount, totalSize, createdAt }]
// Change visibility (public ↔ private)
await bf.storage.updateBucket('avatars', { public: true })
// Delete a bucket (must be empty; a bucket with files answers 409)
await bf.storage.deleteBucket('avatars')
// Delete a bucket and every file in it
await bf.storage.deleteBucket('avatars', { force: true })Bucket names are 3–63 characters, lowercase letters, numbers and hyphens, and can't start or end with a hyphen.
A bucket belongs to the project that created it, and every route checks that before it reads or writes anything. A bucket your project does not own answers exactly like a missing one (404 Bucket "name" not found). A name that would land in another project's storage namespace is refused with a 409; choose a different name.
Uploading files
Scope operations to a bucket with bf.storage.from(bucket). The path may include / to place the file in a folder — parent folders are created implicitly.
const bucket = bf.storage.from('avatars')
// Upload (browser File/Blob, Uint8Array or ArrayBuffer)
const { data, error } = await bucket.upload(
'user-123/avatar.png', // path — the "user-123/" folder is implied
file,
{ contentType: 'image/png' }
)
// Uploading to the same path overwrites the existing object.A single upload request accepts files up to 500 MB by default (a self-hosted install can change this withSTORAGE_MAX_UPLOAD_MB); a larger file is refused with 413. For bigger files, useuploadResumable(), which sends them in chunks. For folders, see the dashboard's Upload folder action below.
Listing files & folders
// List the bucket root
const { data } = await bf.storage.from('avatars').list()
// List inside a folder (prefix)
const { data } = await bf.storage.from('avatars').list('user-123/')
// Entries with a "prefix" field are folders; entries with "name" are files:
// { name, size, lastModified, etag } | { prefix: 'user-123/' }Downloading files
// Download as a Blob
const { data: blob } = await bf.storage.from('avatars').download('user-123/avatar.png')
// Delete one or more files
await bf.storage.from('avatars').remove([
'user-123/avatar.png',
'user-123/old.png',
])Public links & signed URLs
Public bucket — objects are served directly, no token, at a permanent URL:
https://storage.basefyio.com/<internal-bucket>/<path>From the dashboard (Storage tab) you can copy the public link for the whole bucket, any folder, or an individual file — and toggle a bucket public/private. For a private bucket, generate a time-limited signed URL instead:
// Temporary signed URL for a private object (default 1 hour, max 7 days)
const { data } = await bf.storage.from('reports').createSignedUrl(
'q1/summary.pdf',
{ expiresIn: 3600 } // seconds
)
// data.url data.expiresInA folder/bucket public link is the base URL for its objects — appending a file path yields a working link. Object storage has no anonymous directory listing, so the base URL alone won't list contents.
In the dashboard
The Storage tab adds workflows beyond the SDK:
- New folder — create an empty folder in the current location.
- Upload folder — upload a whole local folder, preserving its structure; if files already exist you're asked to overwrite or skip them.
- Public link — copy a shareable URL for a public bucket, folder, or file.
- Toggle a bucket between public and private.
REST API
All routes are under https://api.basefyio.com/api/projects/:projectId/storage and require your API key / session.
| Method | Path | Description |
|---|---|---|
| GET | /buckets | List buckets |
| POST | /buckets | Create bucket { name, public } |
| PATCH | /buckets/:bucket | Set visibility { public } |
| DELETE | /buckets/:bucket | Delete bucket |
| GET | /buckets/:bucket/public-url?path= | Public URL (public buckets) |
| POST | /buckets/:bucket/folders | Create folder { path } |
| GET | /buckets/:bucket/objects?prefix= | List objects/folders; optional limit (1-1000), offset, sortBy (name, size, lastModified), order |
| POST | /buckets/:bucket/objects?path= | Upload (multipart file) |
| POST | /buckets/:bucket/objects/exists | Which of { paths } exist |
| GET | /buckets/:bucket/objects/download?path= | Download a file |
| GET | /buckets/:bucket/objects/url?path=&expiry= | Signed URL: expiry 60 to 604800 seconds (default 3600); 404 for a missing object |
| POST | /buckets/:bucket/objects/move | Move into a folder { sources, destFolder }; 409 if a destination exists, 404 if a source is missing |
| POST | /buckets/:bucket/objects/copy | Copy one object { source, destination } (404 missing source, 409 existing destination) |
| POST | /buckets/:bucket/objects/rename | Rename one object { source, destination } |
| DELETE | /buckets/:bucket/objects | Delete { paths }; the count is of objects that existed |
S3 access keys
A server that already speaks S3 (an AWS SDK, rclone, a backup tool) can write to your project's buckets directly with an S3 access key: standard AWS Signature V4, path-style addressing, against https://storage.basefyio.com. Each key reaches only this project's buckets, by exact name. When this server offers S3 keys, create one with basefyio storage create-key, the create_s3_key MCP tool or the REST route below. Managing keys needs your team's credentials permission.
- The secret is shown once, when the key is created. basefyio does not keep a copy; lost means revoke and create a new one.
- S3 clients use the physical bucket name,
bf-<project prefix>-<bucket>;basefyio storage statuslists them. - Keys read, write, list and delete objects. They cannot create or delete buckets, change a bucket's visibility or list other buckets; do that through the API.
- Revoking a key stops it on its next request. A project can hold 5 keys at a time.
Service-level credential. A key talks to the object store directly, so storage access rules, per-bucket size and file-type limits, the upload quota check and upload activity do not apply to it (stored bytes are still measured for billing). Treat it like the service key: servers only, never a browser or a mobile app. Projects that authorise storage with database policies cannot create keys.
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'
const s3 = new S3Client({
endpoint: 'https://storage.basefyio.com',
region: 'us-east-1',
forcePathStyle: true,
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
},
})
await s3.send(new PutObjectCommand({
Bucket: 'bf-acme-x1y2z3-invoices', // physical name from `basefyio storage status`
Key: '2026/11/inv-1001.pdf',
Body: pdfBuffer,
}))| Method | Path | Description |
|---|---|---|
| GET | /s3-keys/info | Endpoint, region, path-style, physical bucket names; whether keys are available (secrets:read) |
| GET | /s3-keys | Keys: id, name, access key id, last four of the secret (secrets:read) |
| POST | /s3-keys | Create { name }; the answer holds secretAccessKey, once (secrets:write) |
| DELETE | /s3-keys/:keyId | Revoke (secrets:write) |