Skip to content

Storage — Features

Aerostack Storage provides file uploads and object storage with global CDN distribution.

import { useAerostack } from '@aerostack/react'
function AvatarUpload({ userId }) {
const { sdk } = useAerostack()
const handleFile = async (e) => {
const file = e.target.files[0]
const formData = new FormData()
formData.append('file', file)
formData.append('path', `avatars/${userId}`)
const result = await fetch(`/api/storage/upload`, {
method: 'POST',
headers: { Authorization: `Bearer ${tokens.accessToken}` },
body: formData,
})
const { url } = await result.json()
// url is the CDN URL for the uploaded file
}
return <input type="file" accept="image/*" onChange={handleFile} />
}
import { sdk } from '@aerostack/sdk'
// Upload from a request
app.post('/upload', async (c) => {
const formData = await c.req.formData()
const file = formData.get('file') as File
const result = await sdk.storage.upload({
file,
path: `uploads/${Date.now()}-${file.name}`,
contentType: file.type,
})
return c.json({ url: result.url, key: result.key })
})
Terminal window
POST /api/v1/projects/{slug}/storage/upload
Content-Type: multipart/form-data
Authorization: Bearer {token}
# Form fields:
# file: (the file binary)
# path: optional custom path (default: uuid)

Response:

{
"url": "https://cdn.aerostack.dev/projects/slug/uploads/file.jpg",
"key": "projects/slug/uploads/file.jpg",
"size": 204800,
"contentType": "image/jpeg"
}
await sdk.storage.delete('projects/slug/uploads/file.jpg')

All file types are accepted. Maximum file size is 100 MB per upload.

Let users upload profile photos from any device. Store them at a predictable path like avatars/{userId} so you can always construct the CDN URL without a database lookup. Overwriting the same path replaces the old avatar automatically.

const result = await sdk.storage.upload({
file,
path: `avatars/${userId}`,
contentType: 'image/jpeg',
})
// result.url is immediately available via CDN

Build a file manager where users upload, organize, and share PDFs, spreadsheets, and presentations. Use path prefixes like docs/{orgId}/{folderId}/ to mirror your folder hierarchy in storage, and store metadata (file name, owner, permissions) in the database alongside the storage key.

Accept image and video uploads for a portfolio, real estate listing, or social feed. Storage handles files up to 100 MB, so high-resolution images and short video clips work out of the box. Serve thumbnails and originals from the same CDN with different path conventions.

Host user-generated content (blog post images, community uploads, exported reports) with global CDN delivery. Since files are served from the edge, your users get sub-10ms latency regardless of their location.