Sirv plugin for Strapi
npm install @sirv/strapi-plugin2. Turn it on in config/plugins.tsexport default {
sirv: { enabled: true },
};3. Allow Sirv images in config/middlewares.ts, under contentSecurityPolicy directives'img-src': ["'self'", 'data:', 'blob:', 'https://*.sirv.com'],
'media-src': ["'self'", 'data:', 'blob:', 'https://*.sirv.com'],
'script-src': ["'self'", 'blob:', 'https://scripts.sirv.com'],4. Run npm run develop, open Settings › Sirv › Configuration and enter your Client ID and Client secret from Sirv: Account › Settings › API. No account yet? Create one freeOpen on npmShort answer
Install @sirv/strapi-plugin in your Strapi v5 project and enable it in config/plugins. In the admin, open Settings, Sirv, Configuration and enter your Sirv REST API Client ID and Client secret. Then add the "Sirv media" custom field to any content type, and editors can pick one asset or a gallery from Sirv.
After reading this you will know
- How to install the Sirv plugin for Strapi
- How to add the Sirv media field to a content type
- How to show the picked media on your frontend
Add Sirv as a first-class media source inside Strapi, the popular open-source headless CMS.
Editors can browse, search and pick assets straight from your connected Sirv account, without leaving Strapi.
You can pick images, videos, 360 spins, GLB models or even entire Sirv Smart Galleries.
Your files will stay on Sirv and will be delivered from Sirv’s fast, global CDN, then rendered on your frontend with the companion @sirv/react package.
Because assets are hosted on Sirv, you get automatic image optimization, responsive images, dynamic resizing, 360 spins and zoom, all without bloating your Strapi database.
Images will be served in the most optimal format for each user, normally AVIF or WebP, which are recommended by Google.
Requirements
Section titled “Requirements”- Strapi v5 (5.x)
- Node.js 18 or newer
- A Sirv account. Create one for free if you don’t have one.
Installation
Section titled “Installation”Documentation is also published on the official Strapi marketplace for Sirv.
-
Install the plugin in your Strapi project:
npm install @sirv/strapi-plugin -
Enable it in
config/plugins.ts(orconfig/plugins.js):export default {sirv: {enabled: true,},}; -
Strapi’s admin panel uses a strict Content-Security-Policy that blocks external images.
Since Sirv delivers assets from
*.sirv.com, allow it inconfig/middlewares.ts, otherwise thumbnails and previews won’t load:export default ['strapi::logger','strapi::errors',{name: 'strapi::security',config: {contentSecurityPolicy: {useDefaults: true,directives: {'img-src': ["'self'", 'data:', 'blob:', 'https://*.sirv.com'],'media-src': ["'self'", 'data:', 'blob:', 'https://*.sirv.com'],'script-src': ["'self'", 'blob:', 'https://scripts.sirv.com'],},},},},'strapi::cors','strapi::poweredBy','strapi::query','strapi::body','strapi::session','strapi::favicon','strapi::public',];Also allow your custom domain, if you’re using that feature of Sirv.
-
Rebuild and start Strapi:
npm run developA Sirv section will appear under
Settingsin the admin panel.
Free trial
Section titled “Free trial”If you don’t have a Sirv account yet, create one for free. You start on a free trial and can choose a free or paid plan later.
Connect your Sirv account
Section titled “Connect your Sirv account”-
In the Strapi admin, open
Settings → Sirv → Configuration. -
Enter your Sirv REST API Client ID and Client secret. You can create API credentials in your Sirv account at Settings > API access.
![Connect your Sirv account with Client ID and secret]()
-
Click Connect. Your credentials are validated against Sirv, then stored encrypted on the Strapi server. They are never exposed to the browser.
Once connected, the page shows your account and its storage usage. You can disconnect at any time.

Add the Sirv media field
Section titled “Add the Sirv media field”The plugin adds a custom field, Sirv media, that you can add to any content type.
-
In the Content-Type Builder, edit a content type, click Add another field, choose Custom, then Sirv media.
-
Or declare it directly in the content type’s
schema.json. UseallowedTypesto restrict what can be picked, andmultiplefor a gallery:{"attributes": {"hero": {"type": "customField","customField": "plugin::sirv.sirv-media","options": { "allowedTypes": ["image", "video"] }},"gallery": {"type": "customField","customField": "plugin::sirv.sirv-media","options": { "allowedTypes": ["image", "video", "spin", "view"], "multiple": true }}}}
Supported asset types are image, video, 360 spin and Sirv Media Viewer.
Pick an asset
Section titled “Pick an asset”When editing content, a Sirv media field shows a Pick from Sirv button. Click it to open the DAM browser: navigate folders, search your account, and filter by type.

Click an asset to preview it. Images show a large preview; spins, viewers and videos render an interactive live preview. From here you can open the original file or open it on my.sirv.com.
Click Use this asset to store it in the field.

The picked asset appears in the field with a thumbnail. Its title and description (if set on Sirv) are stored automatically as alt text and caption.

Pick multiple assets (gallery)
Section titled “Pick multiple assets (gallery)”For a field with multiple: true, the browser lets you select several assets at once. Tick each asset and click Add to build an ordered gallery.
Remove or reorder items in the field afterwards.

Render on your frontend
Section titled “Render on your frontend”Each Sirv media value is stored in a shape that the companion @sirv/react package will render directly - no conversion needed.
Install it in your frontend (Next.js, Nuxt, Astro, Remix, etc.):
npm install @sirv/reactFetch your content from Strapi’s REST or GraphQL API, then pass the stored value to the matching component:
import { SirvProvider, SirvImage, SirvVideo, SirvSpin, SirvView, SirvMedia, SirvGallery } from '@sirv/react';
export default function Post({ post }) { return ( <SirvProvider> {/* Type-specific components */} <SirvImage value={post.hero} width={800} /> <SirvVideo value={post.clip} width={640} /> <SirvSpin value={post.spin} width={500} height={500} /> <SirvView value={post.viewer} width={640} height={440} />
{/* Or the polymorphic component - renders the right one automatically */} <SirvMedia value={post.hero} width={800} />
{/* A gallery from a multiple field */} <SirvGallery items={post.gallery} /> </SirvProvider> );}<SirvImage> emits a responsive srcset and lazy-loads by default; <SirvSpin> and <SirvView> load sirv.js for interactive 360 spins and zoom.
Common questions
Section titled “Common questions”Will my files be copied into Strapi?
No. Your files will stay on Sirv. The field stores a lightweight reference for the asset, which is delivered from Sirv's CDN. This keeps your Strapi database small and gives you Sirv's best practices - image optimization, responsive images, lazy loading and 360/zoom/galleries.
Which file types are supported?
Images, videos, 360 spins, GLB files and media galleries (with Sirv Media Viewer). You can restrict what a field accepts with the field's allowedTypes option.
How do I enable next-gen image formats?
Your images will automatically be served in next-gen formats. Sirv will detect which formats the users' browser supports, then return each of your images in the most optimal format. Normally that will be AVIF or WebP, as recommended by Google. File size will be much smaller than JPEG or PNG.
Are my Sirv credentials safe?
Yes. Your Client ID and secret will be validated, then stored encrypted on the Strapi server. All Sirv API calls are proxied server-side, so credentials are never sent to the browser.
Why aren't thumbnails showing in the admin?
Strapi's admin sets a strict Content-Security-Policy that blocks external images. Add https://*.sirv.com to img-src and media-src (and https://scripts.sirv.com to script-src) in config/middlewares.ts, as shown in the installation steps.

