Intro to Cloudflare Workers

maxresdefault.jpg

Cloudflare is never missing to amaze me. It’s a beautiful service with a lot of free versions of almost all of their services makes cloudflare a great experiment hub. 

Cloudflare started as a DNS proxy with adding security and “routing” features on to their service offerings in recent years. I almost 100% of the time use and suggest cloudflare if we are setting up a new website or taking over an existing web property. Cloudflare works like magic most of the time with very minimal setup.

I recently started playing and experimenting more with their relatively new service offering “workers”. Workers is basically distributed, serverless service that allows us to build lightweight back-end components. With it, you can serve static and dynamic web pages, create APIs for your front-end application without even thinking about hosting part of your site.

You simply set up your domain, set up workers and configure your “routes” for your workers. For instance, you can redirect all traffic going to “mfyz.com/about” url to be handled by workerA. And workerA can create dynamic or static responses to this request. You can do almost anything with the worker responding this request.

Check out the workers service page: https://workers.cloudflare.com/

As I mentioned above, Cloudflare Workers has a free tier with generous $100k requests a day. And their first tier is $5/mo pricing which makes it extremely affordable even in larger traffic. The free tier allows you to start playing with it right now.

I only wanted to introduce and talk about my opinion of the service on this article. So I’m not going to give examples or a tutorial. 

Here is a very good article with some examples (seems like it’s sponsored article that was probably supported/created by cloudflare team as of their service launch):
https://www.smashingmagazine.com/2019/04/cloudflare-workers-serverless/

Flareact

For react and nextjs lovers, there are ways to configure your nextjs app to run on cloudflare workers. But there is an open source project: Flareact, makes things much easier for the nextjs lovers. It’s not directly built on top of nextjs, so you wouldn’t use nextjs apis or components but they have almost all of the apis and components mirrored on this project that makes adaptation of your current nextjs app breeze.

Check out their documentation and tutorial here: https://flareact.com/

Cloudflare also likes to talk about this framework, worth to try: https://blog.cloudflare.com/rendering-react-on-the-edge-with-flareact-and-cloudflare-workers/

What do you think of this post?
  • 👏 (0)
  • 👍 (0)
  • 🤔 (0)
  • 🙁 (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.