Skip to main content
RapidDev - Software Development Agency
flutterflow-integrationsFlutterFlow API Call

Redis

Connect FlutterFlow to Redis using Upstash Redis's HTTPS REST API — a plain FlutterFlow API Group with a Bearer token, no TCP sockets, no custom Dart code needed. Upstash turns every Redis command into a URL path like `/get/{key}` or `/set/{key}/{value}`, returning JSON that FlutterFlow can parse and bind directly to widgets. Use Redis for caching expensive API responses, rate-limit counters, and lightweight session flags.

What you'll learn

  • Why classic Redis TCP connections don't work in Flutter and how Upstash REST solves this
  • How to create a free Upstash Redis database and find your REST credentials
  • How to build a FlutterFlow API Group that executes Redis commands via URL paths
  • How to use Redis GET, SET, and INCR from FlutterFlow for caching and counters
  • When to proxy destructive commands through a Cloud Function instead of using the client token directly
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner16 min read20 minutesDatabase & BackendLast updated July 2026RapidDev Engineering Team
TL;DR

Connect FlutterFlow to Redis using Upstash Redis's HTTPS REST API — a plain FlutterFlow API Group with a Bearer token, no TCP sockets, no custom Dart code needed. Upstash turns every Redis command into a URL path like `/get/{key}` or `/set/{key}/{value}`, returning JSON that FlutterFlow can parse and bind directly to widgets. Use Redis for caching expensive API responses, rate-limit counters, and lightweight session flags.

Quick facts about this guide
FactValue
ToolRedis
CategoryDatabase & Backend
MethodFlutterFlow API Call
DifficultyBeginner
Time required20 minutes
Last updatedJuly 2026

Upstash REST: Redis Commands as Plain HTTPS Calls

Redis is one of the most useful tools in a modern app's backend — it caches the results of slow API calls, tracks rate-limit counters, stores session flags, powers leaderboards with sorted sets, and handles lightweight pub/sub. But classic Redis clients work by opening a persistent TCP connection to port 6379, sending binary-encoded commands, and reading back responses. A Flutter app cannot open raw TCP sockets safely (on web it cannot at all), so the `redis` pub.dev package in a Custom Action is a dead end for web builds and a security problem on mobile because it requires your Redis password in client code.

Upstash solves this elegantly. Upstash is a serverless Redis provider that wraps your Redis database in an HTTPS REST API. Instead of connecting over TCP, you call URLs: `GET https://{db-id}.upstash.io/get/mykey` returns `{"result":"myvalue"}`. Every Redis command maps to a URL path. Authentication is a Bearer token in the header. FlutterFlow's API Group is perfectly suited for this — you point it at your Upstash URL, add the Bearer header, and define endpoints for each command you need. No Dart code, no pub.dev packages, no platform permissions.

Upstash's free tier gives you 10,000 commands per day. After that, usage is roughly $0.20 per 100,000 commands — check current pricing at upstash.com/pricing. There is no minimum monthly fee. Pick an Upstash region close to your Cloud Function (if you also have a backend) or your primary user base to minimise latency. The REST token grants full access to your database, so keep read-intensive or destructive commands (FLUSHALL, DEL all keys) in a Cloud Function — only expose safe increment and get operations to the client-held token.

Integration method

FlutterFlow API Call

Classic Redis clients connect over TCP on port 6379, which Flutter apps cannot do safely (and web builds cannot do at all). Upstash Redis solves this by exposing an HTTPS REST API where every Redis command becomes a URL path — GET, SET, INCR, and more. FlutterFlow builds an API Group pointing at the Upstash REST endpoint with a Bearer token, making Redis integration as simple as any other REST API call. No pub.dev packages, no Dart sockets, no platform-specific setup required.

Prerequisites

  • An Upstash account (free at console.upstash.com — no credit card required for the free tier)
  • An Upstash Redis database created in a region close to your users
  • Your Upstash REST URL and REST token from the database dashboard
  • A FlutterFlow project (any plan — API Calls are available on all plans)

Step-by-step guide

1

Create a free Upstash Redis database

Go to console.upstash.com and sign up or sign in with your Google or GitHub account — no credit card is needed for the free tier. Click 'Create Database'. Give it a name like 'flutterflow-cache'. Select the type 'Regional' (single region, lower latency) rather than 'Global' unless you specifically need multi-region replication. Choose the AWS or Google Cloud region closest to where your Cloud Functions or primary users are located — latency from a FlutterFlow app to Redis is the round-trip from the user's device, so pick a region that is geographically close. Once the database is created, you land on the database detail page. You need two values for FlutterFlow: the 'REST URL' (something like `https://us1-abc-12345.upstash.io`) and the 'REST Token' (a long string beginning with `AX...`). Click the eye icon to reveal the token. Copy both values — you'll paste them into FlutterFlow in the next step. Note: the REST Token gives full read/write access to the database. For your FlutterFlow integration, you'll use this token directly in the API Call header for safe read and increment operations. For destructive operations like FLUSHALL or DEL (delete all keys), you should route those through a Firebase Cloud Function that holds the same token server-side and validates the request before executing the command.

Pro tip: Upstash also provides a 'Read-Only Token' on the database page — if your FlutterFlow app only needs to read cached values (never write them), use the read-only token for extra security.

Expected result: An Upstash Redis database is created and you have the REST URL and REST Token copied from the dashboard.

2

Build the Upstash API Group in FlutterFlow

Open your FlutterFlow project. In the left navigation, click 'API Calls', then '+ Add' → 'Create API Group'. Name it 'Upstash'. Set the Base URL to your Upstash REST URL (e.g. `https://us1-abc-12345.upstash.io`). In the Headers section, add: Key = `Authorization`, Value = `Bearer YOUR_REST_TOKEN_HERE`. Paste your actual REST token. Now add individual API Calls for each Redis command you need. Start with GET: Click '+ Add' inside the Upstash group. Name it 'GetKey'. Set Method to GET and URL to `/get/{{key}}`. Add a Variable named `key` (String). In the Response & Test tab, add a JSON Path `$.result` named `value` — Upstash always wraps the result in `{"result": ...}`. Test with a key name and you'll see `{"result": null}` for a non-existent key. Add another API Call named 'SetKey'. Method GET (Upstash REST uses GET for all commands via URL paths, not just reads). URL = `/set/{{key}}/{{value}}`. Add variables `key` and `value` (both String). To set an expiry in seconds, add an optional `ex` variable and use the URL `/set/{{key}}/{{value}}?ex={{ex}}`. The response is `{"result":"OK"}`. Add 'IncrKey': Method GET, URL = `/incr/{{key}}`. This increments the integer at the key by 1 and returns the new value in `$.result`. Useful for counters and rate limits.

upstash_commands.txt
1// Upstash REST API Call configurations
2
3// GET a value:
4// GET https://{db}.upstash.io/get/{key}
5// Response: { "result": "cached_value" } or { "result": null }
6
7// SET a value with 1-hour TTL:
8// GET https://{db}.upstash.io/set/{key}/{value}?ex=3600
9// Response: { "result": "OK" }
10
11// INCR a counter:
12// GET https://{db}.upstash.io/incr/{key}
13// Response: { "result": 5 } // new counter value
14
15// JSON Path to extract the result:
16// $.result

Pro tip: All Upstash REST commands use GET method regardless of whether they read or write — this is unlike standard REST conventions. Set and Incr are also GET requests with parameters in the URL path.

Expected result: The Upstash API Group is created with GetKey, SetKey, and IncrKey calls. Testing GetKey returns `{"result":null}` for a new key. Testing SetKey returns `{"result":"OK"}`. Testing IncrKey returns `{"result":1}` on first call.

3

Use Redis GET for caching API responses

Now that the Upstash API Group is set up, use it to cache expensive or rate-limited API calls. The pattern is: check the cache first, return cached data if found, call the real API if not found, and store the result in cache before returning it to the UI. In the Action Flow Editor, add the following sequence to your data-fetching action: First, call 'Upstash → GetKey' with a key like `weather_london`. Store the `$.result` in a Page State variable called `cachedWeather`. Add a Conditional Action — if `cachedWeather` is not null and not empty, bind the UI directly to `cachedWeather` and end the action flow. If `cachedWeather` is null, continue to the real API call. After the real API call returns data, add two more actions: bind the API response to your UI widgets, then call 'Upstash → SetKey' with the key `weather_london`, the value set to the serialised API response (convert the response to a JSON string), and the expiry (`ex` variable) set to `3600` for a 1-hour cache. Next time a user opens the screen within that hour, the first GetKey call returns the cached value and the real API call is skipped. This pattern dramatically reduces the number of calls to rate-limited APIs and speeds up screen load time — instead of waiting for a network call to an external API, the Redis GET returns in under 50ms (assuming a nearby Upstash region). It also reduces costs on APIs that charge per call.

Pro tip: Use descriptive Redis key names with a consistent prefix pattern like `cache:weather:london` or `counter:submit:userId123` — this makes it easy to scan and debug keys in the Upstash console's data browser.

Expected result: The first screen open calls the real API and caches the result in Redis. Subsequent opens within the TTL window return the cached value instantly without calling the external API.

4

Use Redis INCR for rate-limit counters

Redis's INCR command atomically increments an integer stored at a key, returning the new value. This is perfect for rate-limit counters and submission counts. Because Upstash handles the increment server-side and returns the new value in a single round-trip, there is no race condition — multiple users incrementing the same key get consistent results. For a per-user submission counter: when the user taps Submit, call 'Upstash → IncrKey' with the key `submit:{userId}` (use the logged-in user's ID as part of the key to keep counts separate per user). Parse the `$.result` number from the response. Add a Conditional Action — if the result is greater than your allowed limit (e.g. 5), show an error message and stop the form submission. If within the limit, proceed with the form submission action. For the key to reset automatically every hour, you also need to set an expiry. Since Upstash INCR doesn't accept an EX parameter directly, use INCR first, then add a second action that calls 'Upstash → SetKey' with the same key, the same value (the incremented count), and `ex=3600`. This sets the TTL only if the key didn't already have one — the TTL persists across increments within the window. For more complex rate-limiting patterns (sliding window, burst limits), consider handling the logic in a Firebase Cloud Function that performs multiple Redis operations atomically using Upstash's Redis pipeline or Lua scripting — but for most FlutterFlow apps, the simple INCR + EX pattern is sufficient.

Pro tip: Test your rate limit counter thoroughly with a test user before launching — INCR never decrements on its own, so if you reset the counter logic incorrectly, users may be permanently blocked until the key expires.

Expected result: Submitting the form more than 5 times within an hour shows a 'Too many requests' error. The 6th submission attempt is blocked at the FlutterFlow action level without reaching the backend API.

5

Handle URL encoding and proxy destructive commands

Two things to watch when working with Upstash REST from FlutterFlow: URL-encoding of key values, and keeping destructive commands server-side. URL encoding: Upstash REST embeds key names and values directly in URL paths (e.g. `/get/mykey` or `/set/mykey/myvalue`). If your key contains slashes, spaces, colons, or special characters, the URL path breaks and you get incorrect results or 404 errors. Always URL-encode key and value strings before passing them to the Upstash API Calls. In FlutterFlow, you can use a Custom Function or ensure your key naming convention avoids special characters. A safe key naming pattern: use colons for namespacing (`cache:weather:london`) and underscores for spaces (`user_123`). Destructive commands: The REST token you put in the FlutterFlow API Group gives full access to your database. This means a user who decompiles your APK can call `FLUSHALL` and wipe your entire Redis database, or `DEL` any key. For commands that delete data, route them through a Firebase Cloud Function that validates the request (checks that the user is authenticated and authorised to delete that specific key) before executing the command via Upstash's REST API from server-side code. For your FlutterFlow client token, the safe operations are GET, SET (with values), and INCR — all of these have bounded impact. A user who writes to a key they shouldn't can only pollute their own cache entries if your key naming scheme includes their user ID. Design your key namespace with this constraint in mind. If you'd rather have RapidDev's team help architect a more complex Redis caching layer for your FlutterFlow app, we offer free scoping calls at rapidevelopers.com/contact.

Pro tip: Free Upstash tier allows 10,000 commands per day. A cache-check on every screen load can burn this quota quickly if your app has many active users. Cache the Redis result in Page State or App State after the first GET within a session to avoid re-fetching the same key multiple times in one session.

Expected result: Redis keys use safe naming conventions without special characters. Destructive operations like FLUSHALL and DEL are not available from the FlutterFlow client and are only callable from authenticated Cloud Function endpoints.

Common use cases

App with cached API responses to reduce load time and API costs

A news or content app calls an expensive third-party API (weather, stock prices, news feed) that has rate limits and per-call costs. The app first checks Upstash Redis for a cached response with `GET /get/weather_nyc`. If the result is non-null, it displays the cached data instantly. If null, it calls the third-party API, displays the response, and stores it in Redis with `SET /set/weather_nyc/{value}?ex=3600` (1-hour TTL). Subsequent opens within the hour hit the cache instead of the paid API.

FlutterFlow Prompt

Add a weather widget to the home screen. Before calling the weather API, check Upstash Redis for a cached result. If found, display it. If not, call the weather API, display the result, and cache it for 1 hour using Redis SET with an expiry.

Copy this prompt to try it in FlutterFlow

In-app rate limiter that caps how many times a user can submit a form

A form-based app (quote request, support ticket, referral submission) wants to prevent abuse by limiting users to 5 submissions per hour. When the form is submitted, an INCR command on a key like `submit_count_{userId}` increments the counter. If the value exceeds 5, the app shows a 'Too many requests — try again later' message instead of submitting. The key expires after 3600 seconds (SET with EX), resetting the counter each hour without any cron job.

FlutterFlow Prompt

On form submit, call Redis INCR for the key 'submit_{userId}'. If the returned count exceeds 5, show an error message. Otherwise, proceed with form submission and also SET the key's expiry to 3600 seconds on first increment.

Copy this prompt to try it in FlutterFlow

Simple leaderboard using Redis sorted sets

A quiz or gaming FlutterFlow app stores player scores in a Redis sorted set with ZADD. On the leaderboard screen, ZREVRANGE returns the top 10 players in score order with their values. Because leaderboard data changes frequently and must reflect updates from all active users, Redis's in-memory sorted set gives sub-millisecond reads even with thousands of players. Upstash REST exposes these sorted set commands over HTTPS, so FlutterFlow reads the leaderboard with a single API Call.

FlutterFlow Prompt

Build a leaderboard screen that calls Upstash Redis ZREVRANGE to get the top 10 players by score from a sorted set named 'quiz_scores'. Display player names and scores in a ranked list. Add a ZADD call after each quiz completion to update the player's score.

Copy this prompt to try it in FlutterFlow

Troubleshooting

Custom Action using the `redis` Dart package throws 'Unsupported operation: Socket' on web builds

Cause: The `redis` and similar TCP-based Dart Redis packages use `dart:io` sockets, which are not available in Flutter web. Even on mobile, this approach puts your Redis password in the app binary.

Solution: Do not use the Dart `redis` package in FlutterFlow. Use the Upstash REST API via a FlutterFlow API Group instead — it is HTTPS-based, works on web, iOS, Android, and desktop, and requires no Dart code.

GET /get/{key} returns {"result":null} but the key definitely has a value in the Upstash console

Cause: The key name in the URL path has special characters (spaces, colons, slashes) that are interpreted as URL separators rather than part of the key name, causing the wrong key to be looked up.

Solution: URL-encode the key name before passing it as a variable to the API Call. Avoid using slashes in key names entirely when using path-based REST commands. Switch to an underscore or hyphen-based naming scheme (e.g. `cache_weather_london` instead of `cache:weather:london/2026`).

401 Unauthorized — Upstash returns authentication error on every request

Cause: The Authorization header is malformed or the REST token has been rotated in the Upstash console and is no longer valid.

Solution: Open the Upstash console → your database → REST API tab. Verify the current REST token matches what is in FlutterFlow's API Group Authorization header. The format must be exactly `Bearer {token}` with a space after 'Bearer'. If you recently regenerated the token, update it in FlutterFlow's API Group header.

Free tier quota exhausted — Upstash returns 'DAILY_REQUEST_LIMIT_EXCEEDED'

Cause: Your app is making more than 10,000 Upstash Redis commands per day on the free tier. A cache check on every screen load, combined with many active users, can exhaust the daily quota quickly.

Solution: Cache the Redis GET result in a FlutterFlow App State variable at the start of each user session, and read from App State for the rest of the session instead of calling Redis again. For screens visited frequently, use the App State value until it expires rather than hitting Redis on every open. If your app genuinely needs more than 10,000 commands per day, upgrade to Upstash's pay-as-you-go plan (~$0.20 per 100,000 commands).

Best practices

  • Use Upstash Redis REST instead of any TCP-based Dart Redis package — the REST approach is cross-platform, requires no pub.dev dependencies, and works identically on web, iOS, and Android.
  • Design Redis key names with a consistent namespace prefix (e.g. `cache:`, `counter:`, `session:`) followed by entity type and ID — this makes debugging in the Upstash console much easier.
  • Never expose destructive commands (FLUSHALL, DEL with wildcards) to the FlutterFlow client token — route any operation that deletes data through a Firebase Cloud Function that validates the request.
  • Cache the Redis GET result in FlutterFlow's App State or Page State after the first fetch within a session — re-calling Redis on every screen rebuild wastes your free-tier quota.
  • Set key expiry (EX or TTL) on every cached value — a key without an expiry will persist indefinitely and serve stale data until explicitly deleted.
  • Use INCR (not GET then SET) for counters — INCR is atomic and race-condition-safe; separate GET + increment + SET operations can produce incorrect counts under concurrent access.
  • Pick an Upstash region that is geographically close to your primary Cloud Function location, not just your users' location — if your Cloud Function also reads from Redis, co-locating them reduces latency more than co-locating with users.
  • Monitor the Upstash console's daily command count graph during your app's beta to forecast whether you'll need to upgrade before the free-tier limit is reached.

Alternatives

Frequently asked questions

Why does every Upstash REST command use the GET HTTP method, even SET and INCR?

Upstash's REST API encodes both the command and its arguments in the URL path, so every operation is technically a GET request to a different URL path (`/set/key/value`, `/incr/key`). This is a design choice that makes the API simple and cache-friendly. In FlutterFlow's API Group, all Upstash commands use Method: GET — this is correct and expected.

Is it safe to put the Upstash REST token directly in a FlutterFlow API Call header?

The REST token grants full read/write access to your Upstash database. Putting it in an API Call header means it is compiled into the app binary and extractable. For read-only use-cases (caching), Upstash also provides a read-only token — use that instead. For write operations like SET and INCR, the risk is limited if your key naming scheme includes the user ID (a malicious user can only write to their own keys). Destructive commands (FLUSHALL, mass DEL) should always be proxied through a Cloud Function.

Does the Upstash free tier work for a small production app?

10,000 commands per day is enough for apps with up to a few hundred daily active users if you cache Redis results in App State within each session. If each user triggers 10 Redis calls per session and you have 200 DAU, you will use 2,000 commands per day — well within the free tier. Above that, Upstash's pay-as-you-go plan charges roughly $0.20 per 100,000 commands with no monthly minimum.

Can I use Redis pub/sub to push real-time events to FlutterFlow?

Not directly — Redis pub/sub requires a persistent connection to the broker, which FlutterFlow's REST-based API Calls don't support. For real-time events, use Firestore or Supabase Realtime (both natively supported by FlutterFlow). You can use Redis as a queue or cache feeding those real-time stores from a backend consumer, but FlutterFlow itself subscribes to Firestore or Supabase, not Redis pub/sub.

What happens to my cached data if Upstash has downtime?

Upstash Redis is a managed service with published uptime SLAs. During downtime, your Redis GET calls will fail and return errors — your app should handle these gracefully by falling back to calling the original data source directly and not caching the result (or caching it in App State only). Always add error handling to your cache-check action flow so a Redis outage doesn't break the core functionality of your app.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Integrations are where projects stall

We wire FlutterFlow integrations like this one every week — auth, webhooks, edge cases included. Fixed-price builds from $13K, delivered in 6–10 weeks.

Talk to an integration engineer

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.