Assets
Direct browser uploads
LiveCreate a short-lived signed upload URL on your server, then PUT the file directly from the browser.
Goal
Avoid routing large user files through your own application server.
Current status
Live
This area is documented as current, user-reliable behavior.
Workflow
- 1Your backend calls assets.signedUploadUrl with bucket, key, visibility, expiresIn, and maxBytes.
- 2Your frontend uploads the File to the returned URL with the returned HTTP method.
- 3StackShift validates the token, stores the file, and returns asset metadata.
Server creates the upload URL
Example
tsconst upload = await stackshift.assets.signedUploadUrl({
bucket: 'avatars',
key: 'users/user_123.png',
visibility: 'public',
expiresIn: '10m',
maxBytes: 5_000_000,
})Browser uploads the file
Example
tsawait fetch(upload.url, {
method: upload.method,
body: file,
headers: { 'Content-Type': file.type },
})Expected result
The browser uploads directly to StackShift Assets without receiving API credentials.