Back to blog
Blog

How to Migrate from Drupal to Cosmic

Tony Spiro's avatar

Tony Spiro

April 11, 2026

How to Migrate from Drupal to Cosmic - cover image

Drupal served a generation of content teams well. But between the PHP overhead, major-version upgrade cycles, and the complete absence of native AI capabilities, many teams are now making the move to a modern headless CMS. This guide walks you through migrating from Drupal to Cosmic step by step, with real TypeScript code you can run today.


Why Teams Are Leaving Drupal Now

Drupal 7 reached end-of-life in January 2025. That forced thousands of organizations into a choice: invest heavily in upgrading to Drupal 10, or use the moment as an opportunity to rethink the architecture entirely.

The case for moving on is strong:

  • Module sprawl and complexity. Most production Drupal sites run dozens of contrib modules. Each one is a maintenance burden and a potential security surface.
  • Dev-only content changes. Even simple schema changes, adding a field to a content type, typically require a developer, a code deployment, and a cache flush.
  • No native AI. Drupal was designed long before LLMs. Every AI integration is a custom module or a fragile third-party connector.
  • Infrastructure overhead. A production Drupal site needs a server (or managed host), a MySQL/PostgreSQL database, and caching layers like Varnish or Redis.

Cosmic removes all of that. Fully managed cloud, REST API, TypeScript SDK, built-in AI Agents, and a visual schema builder. Let's move your content.


Drupal to Cosmic Concept Mapping

Before writing a single line of code, it helps to understand how Drupal's concepts translate to Cosmic's model:

Drupal ConceptCosmic EquivalentNotes
Content TypesObject TypesDefined in Cosmic's schema builder, no code required
NodesObjectsEach piece of content is an Object
FieldsMetafieldsText, number, date, file, select, relationship, and more
TaxonomiesSelect/multi-select metafields or related ObjectsFlat taxonomies become select fields; hierarchical ones become related Object Types
MediaCosmic Media (imgix CDN)Upload once, serve globally via imgix
ViewsREST API queries with filtersUse , , , params on the REST API
ModulesIntegrations / Cosmic SDKWebhooks, localization, revision history available as add-ons
Roles & PermissionsTeam member roles in CosmicOwner, Admin, Editor

Step-by-Step Migration Guide

Step 1: Audit Your Drupal Content Model

Before you export anything, document what you have.

In Drupal, navigate to Structure > Content Types and list every content type. For each, note:

  • All field names, types, and cardinality (single vs. multiple values)
  • Which fields are required
  • Any taxonomy references
  • Any entity references (related content)

You can also query Drupal's REST API (if enabled) to get a machine-readable list:


Create a spreadsheet mapping each Drupal content type and field to its Cosmic equivalent. This is your migration blueprint.


Step 2: Create Your Cosmic Object Types

Sign up at cosmicjs.com and create a new Bucket.

For each Drupal content type, create a matching Object Type in Cosmic. You can do this in the Cosmic dashboard (no code required) or via the REST API.

Here's an example using the Cosmic TypeScript SDK to create an Object Type programmatically:


For most migrations, the visual schema builder in the Cosmic dashboard is the fastest path. Map each Drupal field type like this:

Drupal Field TypeCosmic Metafield Type
Text (plain)
Text (long) or
Text (formatted)
Integer / Decimal
Boolean
Date
Image (with )
File
Entity reference (single)
Entity reference (multiple)
List (text) or
Taxonomy term reference or related

Step 3: Export Your Drupal Content

Enable Drupal's JSON:API module (included in Drupal 8.7+ core) if it isn't already active. Then export your nodes:


For large datasets, write a script to paginate through all records and save them to local JSON files. Here's a TypeScript utility:



Step 4: Import Content to Cosmic via the REST API

With your exported JSON in hand, write an import script using the Cosmic TypeScript SDK:


Tips:

  • Run the import in batches of 50-100 objects at a time
  • Log successes and failures separately so you can re-run failures without duplicating successful imports
  • Use flags in your script during testing

Step 5: Migrate Media Files

Drupal stores media files locally or on a CDN. Cosmic uses imgix for global media delivery.

Here's how to migrate your media:


Once uploaded to Cosmic, every image is automatically served through imgix with on-the-fly resizing, format conversion (WebP, AVIF), and global CDN delivery.


Step 6: Set Up Webhooks and Rebuild Your Frontend

Cosmic's webhook system (available as an add-on) lets you trigger rebuilds on your frontend whenever content changes. Set up webhooks in Bucket Settings > Webhooks.

For a Next.js frontend:


Cosmic works with all major frontend frameworks: Next.js, React, Vue, Nuxt, Astro, Remix, and Svelte. Check the Cosmic docs for framework-specific starters.


Step 7: Test, Redirect, and Go Live

Before flipping DNS:

  1. Compare content counts between Drupal and Cosmic to verify completeness
  2. Spot-check 10-20 objects across different content types
  3. Verify all media URLs resolve via imgix
  4. Test your frontend against the Cosmic API in a staging environment
  5. Set up 301 redirects from old Drupal URLs to new paths
  6. Update your DNS or CDN configuration
  7. Monitor API response times (target: under 100ms)

Migration Checklist

Use this checklist to track your Drupal to Cosmic migration:

  • Audit all Drupal content types and fields
  • Map Drupal fields to Cosmic metafield types
  • Create all Object Types in Cosmic
  • Set up Cosmic Bucket and API keys
  • Export all Drupal nodes via JSON:API
  • Export all Drupal taxonomy terms
  • Export all media files and file metadata
  • Import content to Cosmic via TypeScript SDK
  • Migrate media files to Cosmic Media (imgix)
  • Verify object counts match between Drupal and Cosmic
  • Spot-check content for formatting issues
  • Build or adapt frontend to use Cosmic REST API
  • Set up Cosmic webhooks for incremental rebuilds
  • Configure 301 redirects for all changed URLs
  • Test full site in staging environment
  • Set DNS TTL low before cutover
  • Flip DNS to new frontend
  • Monitor error rates and API latency post-launch
  • Decommission or archive Drupal server

What You Get on the Other Side

After migrating to Cosmic, your team gets:

  • A clean REST API with sub-100ms response times and 99.9% uptime SLA
  • TypeScript SDK and CLI for fast local development
  • Built-in AI Agents that live in Slack, WhatsApp, and Telegram
  • MCP Server for native AI tooling integration
  • imgix CDN for all your media with on-the-fly transformations
  • A visual schema builder so editors can propose content model changes without involving a developer
  • No more major version migrations. Ever.

Pricing After the Migration

Here's what Cosmic costs after you leave Drupal behind:

PlanPriceBucketsTeam MembersObjects
Free$0/month121,000
Builder$49/month235,000
Team$299/month3520,000
Business$499/month51050,000
EnterpriseCustomCustomCustomCustom

Additional users are $29/user/month. No server bills, no hosting costs, no module licensing fees.


Ready to Start?

Sign up free and have your first Object Type created in minutes. Need help scoping a large migration? Book a call with Tony.


Ready to get started?

Build your next project with Cosmic and start creating content faster.

No credit card required • 75,000+ developers