A Sanity Studio plugin that integrates Raster - a modern Digital Asset Management (DAM) platform that helps teams organize, optimize, and deliver their media assets with powerful AI features and an intuitive interface.
- 🖼️ Seamless integration with Raster DAM in Sanity Studio
- 🔄 Direct asset selection from your Raster libraries
- 🎯 Custom image field type (
raster.image
) for better type safety - 🎨 Modern UI that matches Sanity's design system
- 📱 Responsive image preview and selection
npm install @raster-app/sanity-plugin-raster
# or
yarn add @raster-app/sanity-plugin-raster
# or
pnpm add @raster-app/sanity-plugin-raster
- Sign up for a Raster account at raster.app
- Get your API key from your Raster dashboard
- Note your organization ID
// sanity.config.ts
import { defineConfig } from "sanity";
import { rasterPlugin } from "@raster-app/sanity-plugin-raster";
export default defineConfig({
// ...other config
plugins: [
// ...other plugins
rasterPlugin({
apiKey: "your-raster-api-key",
orgId: "your-organization-id",
}),
],
});
// schemas/blogPost.ts
import { defineType } from "sanity";
export default defineType({
name: "blogPost",
title: "Blog Post",
type: "document",
fields: [
{
name: "title",
title: "Title",
type: "string",
validation: (Rule) => Rule.required(),
},
{
name: "description",
title: "Description",
type: "text",
rows: 3,
},
{
name: "featuredImage",
title: "Featured Image",
type: "image",
description: "Select an image from Raster",
},
],
});
The image field will store the URL and alt text. Here's how the data structure looks:
interface RasterImage {
_type: "image";
asset: {
url: string;
};
alt?: string;
}
Example usage in Next.js:
import Image from "next/image";
function BlogPost({ post }) {
return (
<article>
<h1>{post.title}</h1>
{post.featuredImage && (
<Image
src={post.featuredImage.asset.url}
alt={post.featuredImage.alt || ""}
width={1200}
height={630}
/>
)}
<p>{post.description}</p>
</article>
);
}
-
Clone this repository
-
Install dependencies with
pnpm install
-
Run
pnpm build
to build the plugin -
Link the plugin to your Sanity studio for testing:
# In the plugin directory pnpm link-watch # In your Sanity studio directory pnpm yalc add @raster-app/sanity-plugin-raster pnpm install
Contributions are welcome! Please read our contributing guidelines to get started.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
MIT © Monogram Inc.
Raster is a modern Digital Asset Management (DAM) platform that helps teams organize, optimize, and deliver their media assets. With features like AI-powered search, automatic tagging, and advanced image optimization, Raster makes it easy to manage your digital assets at scale.
Key features:
- AI-powered asset organization
- Advanced image optimization
- Intuitive asset management
- Powerful API and integrations
- Team collaboration tools