Can we persist Strapi Media Library assets in a PostgreSQL db?

System Information
  • Strapi Version: “@strapi/strapi”: “^4.25.1”,
  • Operating System: MacOs
  • Database: PostgreSQL
  • Node Version: “node”: “>=20.12.0”
  • NPM Version: 10.5.0
  • Yarn Version: N/A

Hello! We are currently running the Strapi CMS on-prem with containerization and utilizing a PostgreSQL db. We need the Media Library to persist between container builds (outside the file system) - is it possible to persist the Media Library assets into a Database somehow? We noticed when we would re-build, we lost our media library assets. I searched the docs and forum but could not find the answer to this specific question. Thanks in advance for any insight!

What you need is an image upload provider, by default Strapi uses the local provider.

That said, it is possible to do this and I know of one company that has done images in the database. But this is not recommended, causes issues later

1 Like

Ok this is making more sense! So local does not work as it does not persist. Database will not work as it causes issues later. Going an AWS S3 or Cloudinary route will allow us to use the Strapi maintained plugins while still allowing data persistence and control from the Strapi GUI. @nallaj does that sound right?

Yeah, you’ve got it :smiley:

1 Like

Thank you so much!