
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
    <channel>
        <title><![CDATA[ The Cloudflare Blog ]]></title>
        <description><![CDATA[ Get the latest news on how products at Cloudflare are built, technologies used, and join the teams helping to build a better Internet. ]]></description>
        <link>https://blog.cloudflare.com</link>
        <atom:link href="https://blog.cloudflare.com/" rel="self" type="application/rss+xml"/>
        <language>en-us</language>
        <image>
            <url>https://blog.cloudflare.com/favicon.png</url>
            <title>The Cloudflare Blog</title>
            <link>https://blog.cloudflare.com</link>
        </image>
        <lastBuildDate>Sun, 05 Apr 2026 17:05:03 GMT</lastBuildDate>
        <item>
            <title><![CDATA[Cloudflare Workers database integration with Upstash]]></title>
            <link>https://blog.cloudflare.com/cloudflare-workers-database-integration-with-upstash/</link>
            <pubDate>Wed, 02 Aug 2023 13:00:22 GMT</pubDate>
            <description><![CDATA[ Announcing the new Upstash database integrations for Workers. Now it is easier to use Upstash Redis, Kafka and QStash inside your Worker  ]]></description>
            <content:encoded><![CDATA[ <p><i></i></p><p><i>This blog post references a feature which has updated documentation. For the latest reference content, visit </i><a href="https://developers.cloudflare.com/workers/databases/third-party-integrations/"><i>https://developers.cloudflare.com/workers/databases/third-party-integrations/</i></a></p><p>During <a href="https://www.cloudflare.com/developer-week/">Developer Week</a> we announced <a href="/announcing-database-integrations/">Database Integrations on Workers</a> a new and seamless way to connect with some of the most popular databases. You select the provider, authorize through an OAuth2 flow and automatically get the right configuration stored as encrypted environment variables to your Worker.</p><p>Today we are thrilled to announce that we have been working with Upstash to expand our integrations catalog. We are now offering three new integrations: Upstash Redis, Upstash Kafka and Upstash QStash. These integrations allow our customers to unlock new capabilities on Workers. Providing them with a broader range of options to meet their specific requirements.</p>
    <div>
      <h3>Add the integration</h3>
      <a href="#add-the-integration">
        
      </a>
    </div>
    <p>We are going to show the setup process using the Upstash Redis integration.</p><p>Select your Worker, go to the Settings tab, select the Integrations tab to see all the available integrations.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4PgG63i9pFA5GtOuhGAAeE/5580ef72388faa48bb274d81edfd16ba/2.png" />
            
            </figure><p>After selecting the Upstash Redis integration we will get the following page.</p>
            <figure>
            
            <img src="https://cf-assets.www.cloudflare.com/zkvhlag99gkb/4oL9KEz7NUDqw16aXrk2g0/2708bd58089fa1e8abc503bfd7074649/3.png" />
            
            </figure><p>First, you need to review and grant permissions, so the Integration can add secrets to your Worker. Second, we need to connect to Upstash using the OAuth2 flow. Third, select the Redis database we want to use. Then, the Integration will fetch the right information to generate the credentials. Finally, click “Add Integration” and it's done! We can now use the credentials as environment variables on our Worker.</p>
    <div>
      <h3>Implementation example</h3>
      <a href="#implementation-example">
        
      </a>
    </div>
    <p>On this occasion we are going to use the <a href="https://developers.cloudflare.com/fundamentals/get-started/reference/http-request-headers/#cf-ipcountry">CF-IPCountry</a>  header to conditionally return a custom greeting message to visitors from Paraguay, United States, Great Britain and Netherlands. While returning a generic message to visitors from other countries.</p><p>To begin we are going to load the custom greeting messages using Upstash’s online CLI tool.</p>
            <pre><code>➜ set PY "Mba'ẽichapa 🇵🇾"
OK
➜ set US "How are you? 🇺🇸"
OK
➜ set GB "How do you do? 🇬🇧"
OK
➜ set NL "Hoe gaat het met u? 🇳🇱"
OK</code></pre>
            <p>We also need to install <code>@upstash/redis</code> package on our Worker before we upload the following code.</p>
            <pre><code>import { Redis } from '@upstash/redis/cloudflare'
 
export default {
  async fetch(request, env, ctx) {
    const country = request.headers.get("cf-ipcountry");
    const redis = Redis.fromEnv(env);
    if (country) {
      const localizedMessage = await redis.get(country);
      if (localizedMessage) {
        return new Response(localizedMessage);
      }
    }
    return new Response("👋👋 Hello there! 👋👋");
  },
};</code></pre>
            <p>Just like that we are returning a localized message from the Redis instance depending on the country which the request originated from. Furthermore, we have a couple ways to improve performance, for write heavy use cases we can use <a href="/announcing-workers-smart-placement/">Smart Placement</a> with no replicas, so the Worker code will be executed near the Redis instance provided by Upstash. Otherwise, creating a <a href="https://docs.upstash.com/redis/features/globaldatabase">Global Database</a> on Upstash to have multiple read replicas across regions will help.</p>
    <div>
      <h3><a href="https://developers.cloudflare.com/workers/databases/native-integrations/upstash/">Try it now</a></h3>
      <a href="#">
        
      </a>
    </div>
    <p>Upstash Redis, Kafka and QStash are now available for all users! Stay tuned for more updates as we continue to expand our Database Integrations catalog.</p> ]]></content:encoded>
            <category><![CDATA[Cloudflare Workers]]></category>
            <category><![CDATA[Developers]]></category>
            <category><![CDATA[Kafka]]></category>
            <category><![CDATA[Database]]></category>
            <category><![CDATA[Internship Experience]]></category>
            <category><![CDATA[Developer Platform]]></category>
            <guid isPermaLink="false">6PIdVuhR9PDMgFblDoqqfc</guid>
            <dc:creator>Joaquin Gimenez</dc:creator>
            <dc:creator>Shaun Persad</dc:creator>
        </item>
    </channel>
</rss>