Migrating from Directus

default discord avatar
vlethalast year

Im just starting a Directus project but i just found out that Payload exists and it looks awesome. Is there a way to migrate a db from Directus to Payload?

  • default discord avatar
    yocorylast year

    are you using MongoDB already?

  • default discord avatar
    christopher.nowlanlast year

    Does Directus have a rest API? You could write a custom import script. I did one for WordPress a few months agy

  • default discord avatar
    yocorylast year

    yes it does! very good idea 🙂

  • default discord avatar
    vlethalast year

    no, postgresql

  • default discord avatar
    yocorylast year

    you will first need to convert your database to mongodb, or export your items via json, csv

    if you haven't already, you'll need to to specify your types for each item, then create a collection for them

    this is another response:

    Data migration: Export your data from Directus and import it into PayloadCMS. The specific steps for exporting data from Directus will depend on your setup. Generally, you'll need to export your data in a format compatible with PayloadCMS, such as JSON or CSV. PayloadCMS provides an API and various import methods that you can use to import the data into your new instance.

    Recreate collections and fields: In PayloadCMS, recreate the collections (equivalent to tables in a database) and fields that existed in your Directus installation. Pay attention to data types, validations, and relationships, ensuring that they align with your original setup.

    Configure access control and permissions: Set up access control and permissions in PayloadCMS to match the user roles and permissions you had in Directus. This step ensures that the right users have the appropriate access levels in the new system.

    i other words, it's not gonna be easy. your best bet would be to just start from scratch, create your data sets, then import your csv's.

    Someone else may have a better way of doing it, as I'm new to payload

  • discord user avatar
    last year

    This is a classic ETL problem, @yocory is absolutely right about how to think and go about it.

  • default discord avatar
    grandnainconnu12 months ago

    We migrated 25 collections from Directus to Payload, took about a week or so alone. We made basic functions for media uploads, while including rate limiters, and the rest API to API straight. Be sure to check well for the fields query to go deep enough for your relationships (we had to do 3/4 runs because we were lacking data due to that)

Star on GitHub


Chat on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.