Since its inception, Cloudflare Apps has made it possible for website owners to install a tool or a service directly onto a domain they have that lives on the Cloudflare network. As an App Developer, you’ve had the ability to deliver your product by modifying traffic and content of a user’s website using a combination of Javascript, HTML, CSS injection with the ability to modify Cloudflare features such as DNS.
Today we are announcing a public beta for our Cloudflare Apps with Workers! If you are a developer who has been using Workers or Cloudflare Apps, this is a significant step forward to bring together our server-less platform allowing you the next wave of innovation in the Cloudflare marketplace.
Wait! Yet more Workers news? It’s already been a furious year of releases for Workers, from our GA launch in February to numerous improvements including the beta of Cache API and a flurry of updates during Cloudflare’s Birthday week, where we made available our K/V Storage and WASM support. With this beta, developers can now package all Workers capabilities, deliver new worker-powered experiences to Cloudflare customers all within a few clicks via Cloudflare Apps.
Now your Apps can be more powerful, and Workers code running on the Cloudflare network are the engine that can take you there. If you’ve successfully built and deployed a worker on your own domain, you can package it as an App and bring your idea to the Cloudflare Marketplace.
Apps and Workers Life of a Request
New App experiences are possible including but not limited to personalization, experimentation with A/B testing, custom security, content validation, and localization.
How Do I Build An App with Cloudflare Workers?
To package a Worker in your App as an additional resource in your install.json, simply add a reference to your Worker script similar to how DNS entries were declared before.
{
"resources": [...],
"hooks": [...],
"workers": [{
"src": "./worker.js"
}]
}
You can also deliver custom variables as install options which can then be referenced in Workers; useful for apps who may need to include a service specific token at App install time.
// inside src/worker.js
addEventListener('fetch', event => {
event.respondWith(workerFn(event.request))
let someOptionFromInstall = INSTALL_OPTIONS.UserAgents // UserAgents was selected by siteowner in previewer
})
Does the Approval Process Change?
As before, when you submit your app for approval and review, the submission process will gather your app and worker sources and make it available for our Moderation Team to review. Once successfully through the Moderation process, you can expect an additional Security Review of your Worker, before this app will be made available just like any App is today.
How Can I Apply to the Beta?
Back in August, we announced the upcoming App with Worker capability and since then we’ve seen great interest across our developers and partners who are eager to put their Workers based solutions into the hands to a much broader audience We are continuing to welcome new App Developers in our beta. Apply below to be part of our beta program.