# Storage Providers

> Configure AWS S3 (or any S3-compatible provider).

*Canonical: https://makerkit.dev/docs/tanstack-drizzle/storage/providers*

---

The storage package supports multiple cloud providers through unstorage drivers. This guide covers setup for each provider.

## Local Filesystem (Development)

The filesystem driver is enabled by default in development:

```bash {% title="apps/web/.env" %}
# apps/web/.env
STORAGE_PROVIDER=fs
STORAGE_BASE_URL=storage.dev
```

Files are stored under `apps/web/public/storage.dev` and served as static assets by the TanStack Start / Vite dev server.

**Note:** Filesystem storage is disabled in production (`NODE_ENV === 'production'`).

## AWS S3 (or any S3-compatible provider)

### Environment Variables

```bash {% title=".env.production" %}
# .env.production
STORAGE_PROVIDER=s3
STORAGE_BASE_URL=https://my-bucket.s3.us-east-1.amazonaws.com

STORAGE_S3_ACCESS_KEY_ID=your-access-key
STORAGE_S3_SECRET_ACCESS_KEY=your-secret-key
STORAGE_S3_REGION=us-east-1
STORAGE_S3_BUCKET=my-bucket
```

**Warning:** Do not add the secret access key to the environment variables file. Instead, use your hosting provider to set the environment variable.

## Custom Provider

Register any unstorage-compatible driver by editing `packages/storage/src/registry.ts` directly. Import `createStorage` from `unstorage` and register your driver on the existing `storageRegistry`:

```typescript {% title="packages/storage/src/registry.ts" %}
storageRegistry.register('custom', async () => {
  const { createStorage } = await import('unstorage');

  const { default: customDriver } = await import('./my-custom-driver');

  return createStorage({
    driver: customDriver({
      // Driver options
    }),
  });
});
```

Then set:

```bash
STORAGE_PROVIDER=custom
```

---

**Next:** [API Reference](./api-reference)
