
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, using Sanity as a "middleware" or curation layer is definitely a valid pattern! This workflow is exactly what you're describing: import data from an external database during build time, then let editors manually curate, filter, or enhance it in Sanity Studio.
The pattern you're describing aligns with what Sanity calls a sync plugin approach. Here's the typical flow:
Sanity Connect is the official implementation of this pattern, currently available for Shopify. It automatically syncs external data and keeps it updated. The benefits are:
For your specific use case with a custom database, you'd write your own import script:
Using sanity exec - Run scripts with authentication:
sanity exec scripts/import-from-db.js --with-user-tokenYour script would fetch from your database and create/update documents in Sanity using the client API.
Using NDJSON import - Generate an NDJSON file from your database query results:
sanity dataset import data.ndjson productionThe CLI migration tooling is ideal for this because it provides:
Create a migration:
npx sanity@latest migration createThis approach gives you the best of both worlds:
You can trigger re-imports on:
Many e-commerce teams do this with product catalogs: import products from their PIM/database, then let merchandisers curate which products appear on the site, add lifestyle images, write better descriptions, or remove discontinued items—all without touching the source database.
This pattern works great when you want your database to remain the system of record for certain data (like inventory or technical specs) while Sanity becomes the editorial/presentation layer.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store