Overview

Slingshot

Direct-to-S3 file uploads for any JavaScript runtime.

Documentation

Authorize and key files on the server, then let the browser send bytes straight to S3-compatible storage. Works on any JavaScript server runtime, with a composable React upload UI when you need one.

const slingshot = createSlingshotServer({
  profile: 'avatar',
  adapter: s3({ bucket: process.env.AWS_BUCKET }),
  authorize: ({ req, meta }) => checkAccess(req, meta.userId),
  key: ({ meta }) => `users/${meta.userId}/avatar`,
})

export const POST = handle(slingshot)

Useful guides

  • Basic usage
  • Next.js
  • React
  • Shadcn UI

Version

0.4.4

Category

Files

Downloads

205 weekly

Last updated

5 months ago

View sourceView on NPM