How we added Cloudflare R2 support in exactly one week
In the ever-evolving landscape of technology, staying ahead of the curve is imperative. At Transloadit, we pride ourselves on our agility and commitment to meeting the dynamic needs of our customers. Recently, we had the opportunity to showcase our dedication to customer satisfaction when a client approached us with a specific request regarding Cloudflare R2 support.
What is Cloudflare R2?
Before we delve into the technical challenge we faced implementing Cloudflare R2 support, let's take a brief look at what Cloudflare R2 actually is. Cloudflare R2 is a global object storage service, allowing you to store large amounts of unstructured data. In the same way that you may be drawn to S3 thanks to its easy integration with the rest of the AWS ecosystem, Cloudflare R2 might be a good option for you if you're already using other Cloudflare services.
Whether you're already using Cloudflare R2 or you're considering switching from another blob storage service, you can use the new Transloadit Cloudflare Robots to seamlessly integrate your current file processing stack. We'll detail how to do this later, but for now let's get back on track.
It all began when a customer reached out to our support team, asking whether we had a Robot for Cloudflare's R2 as they were looking for alternatives to DigitalOcean Spaces and Amazon S3. At that point, we didn't have integration with the R2 platform, which meant that Transloadit wouldn't be a viable option for their file processing needs if they chose to switch to Cloudflare R2.
However, not to back down from a challenge, our co-founder Tim let the customer know that we would deliver the feature within the coming weeks. This was on March 29.
The following weekend was a four-day break due to Easter, which also coincided with the start of Tim's vacation. However, as soon as Tim returned from his holiday on April 4, he immediately began working on Cloudflare R2 support.
It then took only a single day before the feature was ready to be deployed and used by the customer.
Of course, the job wasn't entirely complete, as documentation and other related tasks still needed to be finalized. Nevertheless, it took exactly seven days from the customer's initial ticket to a working, deployed version that they could use in production. While we can't promise this rapid turnaround for all future feature releases, it demonstrates our commitment to delivering value to our customers as quickly as possible, allowing you to focus on the core of your product.
Using the Cloudflare Robots
The Cloudflare R2 Robots are now available for everyone, so let's take a look at how you can integrate with /cloudflare/store and /cloudflare/import .
{
"steps": {
"imported": {
"robot": "/cloudflare/import",
"result": true,
"credentials": "YOUR_CLOUDFLARE_R2_CREDENTIALS",
"path": "my_source_folder/file.png"
},
"converted": {
"use": ":original",
"robot": "/image/resize",
"result": true,
"format": "jpg",
"imagemagick_stack": "v3.0.0"
},
"exported": {
"robot": "/cloudflare/store",
"use": "converted",
"result": true,
"credentials": "YOUR_CLOUDFLARE_R2_CREDENTIALS",
"path": "my_target_folder/file.jpg"
}
}
}
The Template above imports a file from Cloudflare R2, converts it to a JPG and then exports it back to a target folder in Cloudflare R2. This is a very simple Template just to demonstrate the premise, but if you want to sink your teeth into something a bit more substantial, check out our list of demos for a variety of different use cases.
What's next?
We are always looking for new ways to innovate, and we have plenty of new features we're hoping to show off soon. Make sure to sign up for the Dev Times below to stay updated on the latest, both with regard to Transloadit and the tech world in general.