Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

egghead.io

Cache Supabase data at the Edge with Cloudflare Workers and KV Storage

via egghead.io

Overview

The “Edge” is where you write and store your code where your data is being produced. This allows for a quick and efficient data transfer, eliminating or severely reducing lag.
Supabase is a suite of open-source tools wrapping a PostgreSQL database. It provides the building blocks of an app - database hosting, auth, file storage, real-time, and edge functions - so we can focus on what makes our app unique.
Cloudflare Workers are serverless functions that run at the Edge! In this course, we will use the Wrangler CLI tool for interfacing with your Cloudflare account and creating or publishing your Workers.
KV Storage is a cache that Cloudflare makes available to our Workers. It replicates across multiple CDN nodes, making it super performant to cache data.
Combined, these three things give you the benefits of that reduced lag in a smooth and streamlined process.
Throughout this course, Jon will teach you how to create a small blog that hits the key points of how to:
Query Supabase from Cloudflare Workers
Read and write KV Storage cache from Cloudflare Worker
Cache Supabase response at the Edge with KV storage
And more!

Syllabus

  • Create a Cloudflare Worker with the Wrangler CLI
  • Create a Supabase project
  • Query Supabase from Cloudflare Worker
  • Proxy Supabase requests with Cloudflare Workers and Itty Router
  • Bind a KV store to Cloudflare Worker
  • Read and write KV Storage cache from Cloudflare Worker
  • Cache Supabase response at the Edge with KV storage
  • Cache-busting with Cloudflare KV stores and Supabase
  • Revalidate stale data by ID
  • Automatically revalidate KV Store cache on change with Database Webhooks in Supabase
  • Use waitUntil to perform work after Cloudflare Worker returns response

Taught by

Jon Meyers

Reviews

4.7 rating at egghead.io based on 27 ratings

Start your review of Cache Supabase data at the Edge with Cloudflare Workers and KV Storage

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.