Skip to content

Sirv plugin for Storyblok

By , Head of Sirv StudioUpdated

Open this page in a new chat

Short answer

Deploy the Sirv field plugin once with Storyblok's Field Plugin CLI, and it appears as a field type named sirv-dam in your spaces. Add it to a block as a Plugin field, connect your Sirv account with its REST API Client ID and Client Secret, and editors can pick images, videos, 360 spins and more from Sirv.

After reading this you will know

  • How to deploy the Sirv field plugin to Storyblok
  • How to add the Sirv picker to a block
  • How to show the picked media on your frontend
Storyblok logo

Browse, search and pick media from your Sirv account without leaving the Storyblok editor.

The Sirv field plugin for Storyblok adds a full Sirv DAM browser to your content blocks.

Editors pick images, videos, 360 spins, Sirv Media Viewer assets and 3D models (glTF/GLB) from Sirv.

Your frontend delivers them through Sirv’s global CDN, resized, optimized and in the best format for every visitor.

Alt text and captions are filled in automatically from your Sirv asset metadata, and galleries support multi-select and drag-to-reorder.

The plugin ships with zero embedded credentials. Each editor connects with their own Sirv REST API key, which never touches your content or the plugin code.

  • A Sirv account (free or paid) and its REST API Client ID and Client Secret from Settings > API access.
  • A Storyblok account. To deploy the plugin you also need Node.js 18.15+ and pnpm 10+ on your computer.

The plugin is deployed to your Storyblok account with Storyblok’s Field Plugin CLI. You do this once; afterwards it appears as a custom field type named sirv-dam in every space you own.

  1. Clone the repository and install dependencies:

    git clone https://github.com/ishugurov/sirv-storyblok.git
    cd sirv-storyblok
    pnpm install
  2. Create a Storyblok personal access token at My account > Personal access tokens. When generating it, tick “Full user permission (no scope/space restriction)”.

    Tokens generated with selected scopes cannot deploy plugins. The plugins API rejects them, because plugins are account-level and no plugin scope exists.

  3. Save the token in apps/storyblok-plugin/.env (this file is gitignored):

    STORYBLOK_PERSONAL_ACCESS_TOKEN=your-token-here
  4. Deploy:

    pnpm --filter @sirv/storyblok-plugin run deploy

The plugin is uploaded and published to My account > My Plugins as sirv-dam.

Re-run the same command any time to publish an update (hard-refresh the Storyblok editor afterwards - it caches the plugin bundle).

The Sirv picker is added to your content as a field of type Plugin on any block. You can add it to a brand new block or to a block you already use.

  1. In your Storyblok space, open Block Library from the left sidebar.

  2. Click + New block (top right).

  3. Enter a technical name for the block, for example product, choose the block type (Nestable block for components you insert into pages; Content type block for whole stories) and click Add Block.

    Create a new block in the Storyblok Block Library

Open Block Library and click the block you want to extend - its schema editor opens on the right.

  1. In the block’s schema editor, type a field name into the Add field box, for example image, pick the field type Plugin and click Add.

  2. Click the new field to open its settings and set Custom Type to sirv-dam.

    Set the field type to Plugin and the Custom Type to sirv-dam
  3. Under Options, add key/value pairs to configure the field (see the field options below). For a single image picker:

    mode single
    allowedTypes image
    Configure the Sirv field options in the block schema
  4. Click Save schema. Every story using this block now shows an Add asset from Sirv button for the field.

One plugin covers every use case - the field’s behavior is set per block field with these options:

  • mode - what the field stores. single (one asset, the default), list (a gallery with multi-select and drag-to-reorder) or url (a plain URL string to any Sirv asset, including documents).

  • allowedTypes - comma-separated list of asset types the picker offers: image, video, spin (360 spins), view (Sirv Media Viewer files), model (glTF/GLB 3D models).

    Add file to also allow generic files such as PDFs and ZIPs (useful in url mode). Default: the five media types.

  • renderMode - a hint for galleries on your frontend: separate (each asset rendered on its own, the default) or viewer (all assets combined into one Sirv Media Viewer).

  • rootPath - the Sirv folder the browser opens in, e.g. /products. Default: your account root.

  • clientId and clientSecret - optional team-wide Sirv account. When both are set in the block schema, editors skip the connect step entirely.

    Anyone who can read the block schema can see the secret. Prefer the per-editor connect flow unless you specifically want one shared, admin-managed account.

  • deliveryAlias - the delivery domain for the shared account, e.g. yourcompany.sirv.com (used with clientId/clientSecret).

Example configurations:

A gallery of images and videos, rendered as one combined viewer:
mode list
allowedTypes image,video
renderMode viewer
A download link to any file in your /docs folder:
mode url
allowedTypes file
rootPath /docs

The first time an editor opens the picker, the plugin asks for Sirv REST API credentials:

  1. In a story, click Add asset from Sirv. The Sirv media library opens.

  2. Paste your Client ID and Client Secret from app.sirv.com > Settings > API access and click Connect.

  3. Choose the delivery domain to serve assets from (if your account has more than one).

    Connect your Sirv account inside the Storyblok editor

The credentials are stored only in that editor’s browser (scoped to the Storyblok space) - never in your content, the plugin bundle or the repository.

The connection is reused silently afterwards; use the logout icon in the media library header to disconnect or switch accounts.

Once connected, the media library shows your Sirv folders and files:

  • Browse folders with the breadcrumb trail, or search your entire account by filename.

  • Filter chips narrow results to images, videos, 360 spins, viewer files or 3D models.

  • Click an asset to preview it, then click Use this asset. Spins, viewer files and 3D models load live (drag to rotate or orbit), and videos play.

    Or click the + button on a thumbnail to add it instantly without the preview step.

  • In list mode, click several assets (across folders and searches) and add them together. Reorder the gallery afterwards by dragging items; an insertion line shows exactly where each item will land.

Browse and pick Sirv assets in the Storyblok editor

When an image or video is picked, its alt text and caption are filled in automatically from the asset’s title and description in Sirv.

Editors can adjust them - plus image quality and video playback options - right in the field.

The field saves plain JSON in your story - no Storyblok asset duplication, the media stays on Sirv:

{
"_type": "sirvMedia",
"mediaType": "image",
"sirvPath": "/products/shoe.jpg",
"sirvAlias": "yourcompany.sirv.com",
"originalUrl": "https://yourcompany.sirv.com/products/shoe.jpg",
"width": 2000,
"height": 1890,
"alt": "Red running shoe",
"caption": "Side view"
}

list mode stores an array of these objects; url mode stores a plain URL string.

Fetch the story from Storyblok’s Content Delivery API as usual, then render the stored values with the @sirv/react components.

They build responsive, optimized Sirv URLs and load sirv.js automatically for spins and viewers:

import {
SirvProvider,
SirvMedia,
SirvGallery,
fromSanityMedia as fromStoredMedia,
} from '@sirv/react';
<SirvProvider alias="yourcompany.sirv.com">
<SirvMedia value={fromStoredMedia(story.content.image)} width={640} />
<SirvGallery
items={story.content.gallery.map(fromStoredMedia)}
layout="viewer"
width={640}
height={480}
/>
</SirvProvider>

3D models are rendered by sirv.js rather than a @sirv/react component - drop the model URL into a .Sirv container:

<div class="Sirv" data-src="https://yourcompany.sirv.com/models/chair.glb"></div>

A complete Next.js example, including live fetching from the Content Delivery API and a 3D-model section, is in the examples/next folder of the repository.

Can the Sirv picker replace Storyblok's native Asset field?

No. Storyblok does not let third parties hook into its native Asset field - every external DAM (Bynder, Cloudinary, Frontify and others) integrates the same way, as a custom Plugin field. Use a field of type Plugin with the sirv-dam custom type instead of the native Asset field.

Where are my Sirv credentials stored?

In your browser's local storage, scoped to the Storyblok space. They are never written into your content, the plugin bundle or the repository. Optionally, a team-wide account can be configured by an admin via the clientId and clientSecret options in the block schema.

Which media types does the plugin support?

Images, videos, 360 spins, Sirv Media Viewer (.view) files and 3D models (.glb/.gltf) in all modes, plus generic files such as PDFs and ZIPs when "file" is added to allowedTypes (typically in url mode).

I deployed a new plugin version but the editor still shows the old one.

The Storyblok editor caches the plugin bundle. Hard-refresh the editor page (Cmd+Shift+R or Ctrl+Shift+R) after deploying an update.

Back to top