Published
What moves, and what does not
Moving from Cloudinary means two jobs: copying your originals into Fileboy, and changing the image URLs in your app. The two services use different URL formats, so this is a change to your code, not a switch to flip.
Before you start, read the Fileboy and Cloudinary comparison, in particular where Fileboy is the weaker fit. Generative AI effects and a full marketing asset library are not things to move across. If you rely on them, keep Cloudinary for those and move the rest.
Check your file count and total size against the plan you want on the pricing page first. Uploads past an app's file or storage limit are refused, and nothing is stored.
1. Map your URLs
A Cloudinary delivery URL puts options in the path, such as w_400,c_fill. A Fileboy URL has one path, /images/get/FILE_ID, and the steps go in ?transform=, separated by semicolons. These are the options with an equivalent:
w_400becomesresize:400x_(the underscore means: work the height out).w_400,h_300,c_fillbecomesresize:400x300~fit:cover. Roughly:c_fillalso takes a gravity, and Fileboy'spositionoption is the nearest match.c_fitbecomesresize:400x300~fit:inside. Roughly the same.c_padbecomesresize:400x300~fit:contain~background:hex(fff). Roughly the same.f_autobecomesformat:auto, andf_webpbecomesformat:webp.q_80becomesquality:80.q_autohas no equivalent, so pick a number.
https://res.cloudinary.com/YOUR_CLOUD/image/upload/w_400,h_300,c_fill,f_auto/shop/boots.jpg
https://api.fileboy.io/images/get/FILE_ID?transform=resize:400x300~fit:cover;format:autoAnything not listed, such as generative effects, face detection or named transformations, has no mapping here: check each one by hand. Fileboy presets can stand in for named transformations, so you define a set of steps once and refer to it by name.
2. Import your library
This script lists your Cloudinary images and asks Fileboy to fetch each one from its Cloudinary URL with uploadFileFromUrl. Nothing is downloaded to your machine. It writes the old public ID into each file's metadata, so a second run skips what is already there, and the same metadata gives you the old ID to new ID map afterwards. It needs your Fileboy private key, which also lets it create folders from your public ID paths.
import { v2 as cloudinary } from "cloudinary"
import { Fileboy } from "@cd2/fileboy-node"
cloudinary.config({
cloud_name: process.env.CLOUDINARY_CLOUD_NAME,
api_key: process.env.CLOUDINARY_API_KEY,
api_secret: process.env.CLOUDINARY_API_SECRET,
})
const fileboy = Fileboy({
publicKey: process.env.FILEBOY_PUBLIC_KEY,
privateKey: process.env.FILEBOY_PRIVATE_KEY,
})
const failed = []
let cursor
do {
const page = await cloudinary.api.resources({
resource_type: "image",
type: "upload",
max_results: 100,
next_cursor: cursor,
})
for (const asset of page.resources) {
try {
// Skip what an earlier run already imported
const done = await fileboy.listFiles({ metadata: { cloudinaryId: asset.public_id }, limit: 1 })
if (done.data.length > 0) continue
const parts = asset.public_id.split("/")
const name = parts.pop() + "." + asset.format
const file = await fileboy.uploadFileFromUrl(asset.secure_url, {
name,
metadata: { cloudinaryId: asset.public_id },
...(parts.length > 0 && { folderPath: "/" + parts.join("/") }),
})
// A cheap check: the stored size should be the size Cloudinary reported
if (file.fileSize !== asset.bytes) {
console.warn("Size differs for " + asset.public_id, file.fileSize, asset.bytes)
}
} catch (error) {
failed.push(asset.public_id)
console.error(asset.public_id, error.message)
}
}
cursor = page.next_cursor
} while (cursor)
console.log("Failed: " + failed.length, failed)A sketch to adapt. The Fileboy calls are the library's, but check Cloudinary's SDK for its current call names and fields. Assets of the private or authenticated type need signed URLs to be fetched. Documents are raw assets, so run it again with resource_type: "raw". Try it on one folder first.
Fileboy fetches each address itself, so it must be a public internet address. A fetch that stalls for 60 seconds, or takes more than nine minutes, is refused with url_fetch_timeout, and one file can be up to 5 GB. For Cloudinary videos, use the video upload in the Mux guide: uploadFileFromUrl is for files and images.
3. Write down the new IDs
Your database holds Cloudinary public IDs. Add a column for the Fileboy ID and fill it from this map, keeping the old column until you have checked everything.
import { writeFile } from "node:fs/promises"
import { Fileboy } from "@cd2/fileboy-node"
const fileboy = Fileboy({
publicKey: process.env.FILEBOY_PUBLIC_KEY,
privateKey: process.env.FILEBOY_PRIVATE_KEY,
})
// Fileboy kept the old id in each file's metadata, so it can write the map for you
const map = {}
let cursor
do {
const page = await fileboy.listFiles({ hasMetadata: ["cloudinaryId"], limit: 100, cursor })
for (const file of page.data) map[file.metadata.cloudinaryId] = file.id
cursor = page.nextCursor ?? undefined
} while (cursor)
await writeFile("cloudinary-map.json", JSON.stringify(map, null, 2))
console.log(Object.keys(map).length + " files in the map")In your code, the helper that built Cloudinary URLs becomes one that builds Fileboy URLs from the stored ID:
// Before (Cloudinary's SDK)
cloudinary.url("shop/boots", { width: 400, height: 300, crop: "fill", fetch_format: "auto" })
// After
fileboy.buildImageUrl(fileboyId, {
transforms: [
{ type: "resize", width: 400, height: 300, fit: "cover" },
{ type: "format", format: "auto" },
],
})A client that has a private key adds a short-lived signature to the URLs it builds. For URLs that go into pages, build them with a client that has only your public key, or write the URL yourself as shown above.
4. Check the import
- Count: the number of entries in
cloudinary-map.jsonshould equal the number of images in Cloudinary. Re-run the import: it should report no new files, and an emptyFailedlist. - Sizes: the import script warns when a stored size differs from the one Cloudinary reported. Look at every warning.
- Pictures: open twenty or so images at the sizes your pages use and compare them with the originals, including a transparent PNG and the biggest file you have.
- URLs: request a transformed URL and check you get an image back, for example
curl -I "https://api.fileboy.io/images/get/FILE_ID?transform=resize:400x_;format:webp"should answer 200.
5. Cut over
- Create your Fileboy app's keys and set the app's allowed origins to your site. Keep the private key on your server only.
- Match privacy: if your Cloudinary assets are private, turn on signed URLs for the Fileboy app before you move them.
- Point new uploads at Fileboy first (the React uploader or a server upload), so no new files land in Cloudinary while you move the old ones.
- Run the import once more to pick up what arrived in the meantime, then export the map again.
- Switch the URL builder in your app to Fileboy, behind a flag or on one page first, and compare those pages with the old ones.
- Leave Cloudinary as it is for a few weeks. Old emails, caches and other sites may still point at it. Only remove assets when your own logs show no more traffic, and keep a copy of the map.
Checked against the current libraries in November 2026. Found something that no longer works? Tell us.