Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ainsleydev/strapi-provider-upload-vercel

A provider for Strapi that uploads media to Vercel's Blob store.
https://github.com/ainsleydev/strapi-provider-upload-vercel

cms strapi typescript uploader vercel

Last synced: 4 days ago
JSON representation

A provider for Strapi that uploads media to Vercel's Blob store.

Awesome Lists containing this project

README

        





ainsley.dev



[![npm](https://img.shields.io/npm/v/strapi-provider-upload-vercel.svg?style=flat-shiny&logo=npm&color=white)](https://www.npmjs.com/package/strapi-provider-upload-vercel)
![Made with TypeScript](https://img.shields.io/badge/Made%20with-TypeScript-blue.svg?style=flat&logo=typescript)
[![Lint](https://github.com/ainsleydev/audits.com/actions/workflows/lint.yaml/badge.svg?branch=main&query=main)](https://github.com/ainsleydev/audits.com/actions/workflows/lint.yaml?query=main)
[![ainsley.dev](https://img.shields.io/badge/-ainsley.dev-black?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAAB3RJTUUH5wEYDzUGL1b35AAABA1JREFUWMPtlttvFVUUxn977ZnZu+W0tLalqRovBAUvQag0xNQbpSIosSSIJC198YknJfHJxDf9A/DBJ0x8MbFACjVqvCASq6FYFLFBvJAaAomkFCmhHGpLO+PDzOmZzpn2nKP4pCs5ycmevb7vW99as/fA//FfD1XO5p1nzuA3NWJHx5T8cVkRBPHHQfRjd0tzyZhOOQIy27bAxET9zCuvvhY0r2kC/OiRABeAN4BL/4oDr9+3lGszPs7UVNfUE23v3Nj5koszR/8N4EXg3XJckFIFuCLUuU7GWNNtTg25cu4syJx0F+gGMuU4UJKAt1Yux1UKV6TVat1qs+OYwQESMwDQCjwKsOv4iZsnwGihwbiuEek2WjJGhMrvv0UujYKa08VFkQvuTXNgz6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ACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wMS0yNFQxNTo1MzowNiswMDowMOrGXwgAAABXelRYdFJhdyBwcm9maWxlIHR5cGUgaXB0YwAAeJzj8gwIcVYoKMpPy8xJ5VIAAyMLLmMLEyMTS5MUAxMgRIA0w2QDI7NUIMvY1MjEzMQcxAfLgEigSi4A6hcRdPJCNZUAAAAASUVORK5CYII=)](https://ainsley.dev)
[![Twitter Handle](https://img.shields.io/twitter/follow/ainsleydev)](https://twitter.com/ainsleydev)

## Strapi Vercel Blob Provider

A provider for Strapi that uploads media to Vercel's Blob store.

## Install

`npm install strapi-provider-upload-vercel`

## Configuration

The plugin settings mimic the SDK parameters defined in
their [documentation](https://vercel.com/docs/storage/vercel-blob/using-blob-sdk)

- `token` A string specifying the token to use when making requests. It defaults to `process.env.BLOB_READ_WRITE_TOKEN`
when deployed on Vercel as explained in Read-write token. You can also pass a client token created with
the `generateClientTokenFromReadWriteToken` method
- `addRandomSuffix` A boolean specifying whether to add a random suffix to the pathname. It defaults to `true`.
- `cacheControlMaxAge` A number in seconds to configure the edge and browser cache. Defaults to one year. See the
caching documentation for more details.

### Provider Configuration

`./config/plugins.js` or `./config/plugins.ts` for TypeScript projects:

```typescript
module.exports = ({ env }) => ({
upload: {
config: {
provider: 'strapi-provider-upload-vercel',
providerOptions: {
token: env('VERCEL_BLOB_TOKEN'),
addRandomSuffix: true,
cacheControlMaxAge: 31536000, // Year in seconds
},
},
},
});
```

## Security Middleware Configuration

Due to the default settings in the Strapi Security Middleware you will need to modify the `contentSecurityPolicy`
settings to properly see thumbnail previews in the Media Library. You should replace `strapi::security` string with the
object below instead as explained in the middleware configuration documentation.

```typescript
export default [
// ...
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'connect-src': ["'self'", 'https:'],
'img-src': [
"'self'",
'data:',
'blob:',
'https://yourbucketname.public.blob.vercel-storage.com',
],
'media-src': [
"'self'",
'data:',
'blob:',
'https://yourbucketname.public.blob.vercel-storage.com',
],
upgradeInsecureRequests: null,
},
},
},
},
];
```

## Open Source

[ainsley.dev](https://ainsley.dev) permits the use of any code found within the repository for use with external
projects.

## Trademark

ainsley.dev and the ainsley.dev logo are either registered trademarks or trademarks of ainsley.dev LTD in the United
Kingdom and/or other countries. All other trademarks are the property of their respective owners.