Cloudflare working on Cloudflare Pages, for deploying and hosting JAMstack
twitter.com
twitter.com
So then, they said why not just upload your static site into the KV database, where the key might be "/index.html" and the value is the html content of that page. Then have a short javascript that reads from that KV and returns the requested page. They wrote some client-side scripts to simplify the uploading, and Workers Sites was born!
I love how your content is automatically replicated to all of their datacenters and loads super-fast from everywhere in the world. I also love that it's really cheap.
But the downside is how some features in Cloudflare's control panel don't work if you're hosting your static site this way. For example, I wanted to use the Page Rules to redirect /page1.html to /page2.html. I also wanted to use Page Rules to set browser caching for *.jpg files. But it turns out that Cloudflare Workers execute code before the Page Rules feature does, so it doesn't work! I had to solve both issues by changing their default javascript to build in redirects and browser caching manually. Not too hard, but annoying.
Well, it feels like it's automatically replicated, but your KV content is usually only stored in a few select datacenters until it becomes popular (and is then available on all DCs). This process is usually fairly quick (<50ms for a 10mb file, based on my testing from about a year ago) so it's almost imperceivable.
https://developers.cloudflare.com/workers/learning/how-kv-wo...
> It is optimized for these high-read applications, only reaching its full performance when data is being frequently read. Very infrequently read values are stored centrally, while more popular values are maintained in all of our data centers around the world.
Flexibility of Cloudflare KV reads in general still yield quick enough results and make doing a quick and dirty cache a pretty good use case IMHO.
But Worker Sites specifically also use the Cloudflare Worker Cache runtime API — aka, per each POP, first reads of a route (index.html, blah.css, cat.jpg) are from KV and THEN cached indefinitely cutting that time to like 10ms.
This is taken then even further by using ETAG matching to make BrowserTTL indefinite (304s not 200s) on all assets until cleared cutting repeat visitors (regardless of POP) to basically nothing. Though .html for some reason doesn’t respect this (I think...).
Which to me is a GREAT deal!
Cache Object: https://developers.cloudflare.com/workers/runtime-apis/cache
Asset Mapper: https://github.com/cloudflare/kv-asset-handler/blob/master/s...
Lines 181 and 224
The only time the request needs to hit the origin is if nobody fetched the page.
But probably not against a static page.
Wordpress is still PHP and a Database and whatever crazy plugins, templates and front end builders are involved.
Depending on how much JAM you have in your STACK, your site/app may or may perform better than WP.
I build a ton of sites in Jekyll, which are static sites and not JAMSTACK. The two get conflated.
To speed it up further, you can tell Cloudflare to cache your HTML pages. Now you've eliminated that round-the-world trip (for most visitors), but you've also lost some of the dynamicness of your site. At that point, you're basically building a static site by different means.
In the confidence it caches the HTML, and the plugin triggers a CDN purge when the HTML changes
Coupled with Cloudflare's standards support (TLS 1.2, H2, H3), and their image optimisation services it's really great for performance.
Just got to remember to disable many of the WP 'speed optimisation' plugins that may be installed as they actually can cause more speed issues.
[1] https://developers.cloudflare.com/workers/platform/sites
Cloudflare Pages sounds like a competitor to Netlify/Vercel mostly - paired with Workers it makes it very compelling. Slowly it's becoming a one-stop shop for me for small-medium projects that don't require any real compute.
[0]: https://github.com/gzuidhof/sunder [1]: https://github.com/gzuidhof/sunder-worker-template
For hosting a simple static/create-react-app-style web app, there's an overwhelming number of options for that already.
There is NO good starting point for developers beyond snippets.
- Vercel as a framework they can modify around their platform
- Netlify is just easy to use and welcoming / friendly / not scary
- Cloudflare has code snippets... I expect this to change overtime as more migrate to Serverless but Cloudflare is like Serverless 2.0 (Durable Objects, runtime APIs) while everyone is building for 1.0 (quick cache clearing and server less functions).
Has been a couple years and still nothing I think.
The link on this post is cool to compete with Netlify and eat up all those small simple static sites but we developers really need a bit more of an ecosystem for app development (framework)
If you had a next.js app why on earth would you NOT use Vercel thinking long term.
For Cloudflare, yeah a static site, configure some sort of basic SSR demos, a million Cloudflare code samples, but there’s no REAL starting point for full blown application development beyond going custom.
Coolest I have seen is Flarereact.
Netflify on the hand offers very little beyond insanely easy to use and a ton of developer promotion.
but I feel that as it matures, there are no prizes to being an early adopter - it looks like it's getting better and easier to use and a lot of features that you had to code for in the past become configurations. So I am still in 'wait and see mode'.
My theory is that more people coming to tech industry, and the base of pyramid is web pages up to web apps. Because all people want to have their personal site and blog. Tiny amount of people want to build application; it's surely harder. Numbers of app makers are just a few.
Tech community on social media is flood with tech that's for building these pages. And when people are hooked, they want to use this hammer for everything.