Rate Limiting Edge Functions
Redis[0] is an open source (BSD licensed), in-memory data structure store used as a database, cache, message broker, and streaming engine. It is optimised for atomic operations like incrementing a value, for example for a view counter or rate limiting. We can even rate limit based on the user ID from Supabase Auth! Upstash[1] provides an HTTP/REST based Redis client which is ideal for serverless use-cases and therefore works well with Supabase Edge Functions[2]. Find the code: https://github.com/thorwebdev/edgy-edge-functions/blob/main/supabase/functions/upstash-redis-ratelimit/index.ts 🎙️ Presented by Thor Schaeff (@thorwebdev https://go.thor.bio/x) ## Chapters 00:00 Intro to Upstash Ratelimit 00:50 Add Upstash Ratelimit to Deno Import Map 01:39 Create a new Supabase Functions 02:30 Basic Rate Limiting with Upstash Redis 04:47 Test Rate Limiting locally 06:03 Rate Limiting by User ID with Supabase Auth 10:03 Test Supabase Auth in Edge Functions locally ## About Edgy Edge Functions Edgy Edge Functions is a video series where we explore Supabase Edge Functions[2] and Deno[3] functionality and features. If there's something you'd like to learn about, please open an issue[4] and let me know on this Tweet thread[5]. Thanks for stopping by! Denosaur and I will see you soon \o/ [0] https://redis.io/docs/about/ [1] https://upstash.com/ [2] https://supabase.com/edge-functions [3] https://deno.land/ [4] https://github.com/thorwebdev/edgy-edge-functions/issues/new/choose [5] https://twitter.com/thorwebdev/status/1595719098863788032
Download
0 formatsNo download links available.