These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
Why Use Cloudinary?
Cloudinary is a cloud-based platform that takes the hassle out of media handling. By optimizing and transforming your media on the fly, Cloudinary ensures your content loads swiftly and looks great on any device.
Cloudinary packs in features like smart cropping, advanced editing, and video encoding—all applied in real time via a global Content Delivery Network (CDN). That means your media stays high-quality no matter where your audience is. Plus, secure storage and backups save you from tedious manual work, giving you more freedom to focus on creativity.
Ready to dive deeper? The official documentation has all the technical details.
Why Use Strapi?
Strapi is the leading open-source headless CMS offering features, like customizable APIs, role-based permissions, multilingual support, etc. It simplifies content management and integrates effortlessly with modern frontend frameworks.
Explore the Strapi documentation for more details.
Strapi 5 Highlights
The out-of-the-box Strapi features allow you to get up and running in no time: 1. Single types: Create one-off pages that have a unique content structure. 2. Draft and Publish: Reduce the risk of publishing errors and streamline collaboration. 3. 100% TypeScript Support: Enjoy type safety & easy maintainability 4. Customizable API: With Strapi, you can just hop in your code editor and edit the code to fit your API to your needs. 5. Integrations: Strapi supports integrations with Cloudinary, SendGrid, Algolia, and others. 6. Editor interface: The editor allows you to pull in dynamic blocks of content. 7. Authentication: Secure and authorize access to your API with JWT or providers. 8. RBAC: Help maximize operational efficiency, reduce dev team support work, and safeguard against unauthorized access or configuration modifications. 9. i18n: Manage content in multiple languages. Easily query the different locales through the API. 10. Plugins: Customize and extend Strapi using plugins.
Learn more about Strapi 5 feature.
See Strapi in action with an interactive demo
Setup Strapi 5 Headless CMS
We are going to start by setting up our Strapi 5 project with the following command:
🖐️ Note: make sure that you have created a new directory for your project.
You can find the full documentation for Strapi 5 here.
Install Strapi
npx create-strapi-app@latest server
You will be asked to choose if you would like to use Strapi Cloud we will choose to skip for now.
Strapi v5.6.0 🚀 Let's create your new project
We can't find any auth credentials in your Strapi config.
Create a free account on Strapi Cloud and benefit from:
- ✦ Blazing-fast ✦ deployment for your projects
- ✦ Exclusive ✦ access to resources to make your project successful
- An ✦ Awesome ✦ community and full enjoyment of Strapi's ecosystem
Start your 14-day free trial now!
? Please log in or sign up.
Login/Sign up
❯ Skip
After that, you will be asked how you would like to set up your project. We will choose the following options:
? Do you want to use the default database (sqlite) ? Yes
? Start with an example structure & data? Yes <-- make sure you say yes
? Start with Typescript? Yes
? Install dependencies with npm? Yes
? Initialize a git repository? Yes
Once everything is set up and all the dependencies are installed, you can start your Strapi server with the following command:
cd server
npm run develop
You will be greeted with the Admin Create Account screen.
Go ahead and create your first Strapi user. All of this is local so you can use whatever you want.
Once you have created your user, you will be redirected to the Strapi Dashboard screen.
Publish Article Entries
Since we created our app with the example data, you should be able to navigate to your Article collection and see the data that was created for us.
Now, let's make sure that all of the data is published. If not, you can select all items via the checkbox and then click the Publish button.
Enable API Access
Once all your articles are published, we will expose our Strapi API for the Articles Collection. This can be done in Settings -> Users & Permissions plugin -> Roles -> Public -> Article.
You should have find
and findOne
selected. If not, go ahead and select them.
Test API
Now, if we make a GET
request to http://localhost:1337/api/articles
, we should see the following data for our articles.
🖐️ Note: The article covers (images) are not returned. This is because the REST API by default does not populate any relations, media fields, components, or dynamic zones.. Learn more about REST API: Population & Field Selection.
So, let's get the article covers by using the populate=*
parameter: http://localhost:1337/api/articles?populate=*
Getting Started with Cloudinary
Ready to streamline your media management? Integrating Cloudinary with Strapi not only simplifies the process but also gives you powerful optimization features for images and videos. Let's walk through how to set this up quickly. For a more detailed explanation, you might refer to Cloudinary setup for Strapi.
Configuring Strapi Environment
First things first: prepare your Strapi project and back up any existing content. Add your Cloudinary credentials to your .env
file:
1CLOUDINARY_CLOUD_NAME=your_cloud_name
2CLOUDINARY_API_KEY=your_api_key
3CLOUDINARY_API_SECRET=your_api_secret
Installing and Adjusting Settings
Next, install the Cloudinary provider package to integrate it with Strapi using the following commands:
For Yarn:
yarn add @strapi/provider-upload-cloudinary
For NPM:
npm install @strapi/provider-upload-cloudinary
Please ensure you are using the correct configuration for your specific version of Strapi. The setup for the Cloudinary provider in config/plugins.js
may vary depending on the version.
Code Implementation
After setting things up, try uploading a sample image through the Strapi Admin panel. If it shows up in your Cloudinary account, you've successfully integrated Cloudinary with Strapi. If you're interested in a practical example, check out how to build a photo gallery with Strapi and Cloudinary. Want more control? You can upload media directly from your frontend using Strapi's RESTful API:
1fetch("https://your-strapi-url/api/upload", {
2 method: "POST",
3 body: formData, // Include your image file in formData
4 headers: {
5 Authorization: `Bearer ${your_token}`,
6 },
7});
With this setup, every upload goes through Cloudinary for optimized delivery. If you're interested in advanced transformations and more, check out the Cloudinary documentation.
Combine all these steps, and you've got yourself a flexible, efficient system for managing and delivering media without the usual headaches. It's a straightforward way to provide your audience with faster load times and a better overall experience.
Awesome, great job!
Strapi Open Office Hours
If you have any questions about Strapi 5 or just would like to stop by and say hi, you can join us at Strapi's Discord Open Office Hours Monday through Friday at 12:30 pm - 1:30 pm CST: Strapi Discord Open Office Hours
For more details, visit the Strapi documentation and Cloudinary.