# Overview (/docs)



`@evensurface/upload-sdk` is a server-side TypeScript SDK for preparing direct-to-provider file uploads.

The client reports basic information about a selected file:

```ts
{
  filename: "profile.png",
  contentType: "image/png",
  size: 120_000,
}
```

Upload SDK checks that information against the rules configured for a named upload asset. When the information is accepted, it creates a safe storage key and returns a short-lived signed upload target.

```ts
const upload = await uploader.prepareUpload("avatar", {
  filename: "profile.png",
  contentType: "image/png",
  size: 120_000,
});
```

The client then uploads the file directly to the selected storage provider. The file does not pass through your application server.

## What Upload SDK handles [#what-upload-sdk-handles]

Upload SDK gives you one consistent way to:

* Configure storage providers
* Define reusable upload assets
* Check client-reported file information against asset rules
* Sanitize filenames and key prefixes
* Generate collision-resistant storage keys
* Create short-lived multipart upload targets
* Work with different providers through the same upload flow
* Handle failures with consistent SDK errors

## Upload assets [#upload-assets]

An upload asset is a named set of rules for a type of upload.

For example, an `avatar` asset can allow specific filename extensions, declared MIME types, and a maximum reported file size.

When you call:

```ts
uploader.prepareUpload("avatar", input);
```

the SDK checks `input` against the rules for `avatar` before asking the provider to sign the upload.

<Warning>
  Upload SDK checks information reported by the client. It does not read the
  file or verify its actual contents.
</Warning>

Learn more about these checks in [Upload Safety](/docs/getting-started/upload-safety).

## Safe storage keys [#safe-storage-keys]

The original client filename is not used directly as the final storage key.

Upload SDK sanitizes the filename, preserves the validated extension, adds a random UUID, and combines it with the asset's sanitized key prefix.

A filename such as:

```yaml
My Profile Photo.PNG
```

may produce a key similar to:

```yaml
avatars/My-Profile-Photo-550e8400-e29b-41d4-a716-446655440000.png
```

This makes accidental key collisions extremely unlikely.

## Supported providers [#supported-providers]

Upload SDK currently includes:

* [AWS S3](/docs/providers/aws-s3)
* [ImageKit](/docs/providers/imagekit)
* [Neon Object Storage](/docs/providers/neon-object-storage)

For provider-specific browser flows, see [S3 Presigned Browser Uploads](/docs/guides/s3-presigned-browser-uploads) and [ImageKit Browser Uploads](/docs/guides/imagekit-browser-uploads).

## Common upload patterns [#common-upload-patterns]

Upload SDK is commonly used for:

* [Next.js direct uploads](/docs/guides/next-js-direct-uploads) through App Router route handlers
* [S3 presigned browser uploads](/docs/guides/s3-presigned-browser-uploads) with a signed POST policy
* [ImageKit browser uploads](/docs/guides/imagekit-browser-uploads) with a signed upload token
* [Direct upload architecture](/docs/resources/direct-upload-architecture) where your app signs intent and the provider receives the file

## What your application handles [#what-your-application-handles]

Your application is still responsible for:

* Authenticating users
* Authorizing access to upload assets
* Sending the file from the client
* Confirming that an upload completed
* Inspecting uploaded file contents when required
* Saving trusted upload records
* Cleaning up invalid or abandoned uploads

Provider credentials must remain in server-side code.

## Next steps [#next-steps]

* [Quick Start:](/docs/getting-started/quick-start)
  Follow the complete upload lifecycle.

* [Next.js Direct Uploads:](/docs/guides/next-js-direct-uploads)
  Prepare uploads in a route handler and send files from the browser.
