Back to Templates

Ratelimiting in React Native

Ratelimiting email sending in mobile apps

Written by
harshsbhat
Framework
React Native
Language
Typescript
Ratelimiting email sending in mobile apps

Unkey x React-Native x Resend

This app demonstrates @unkey/ratelimit and how you can rate limit your React-Native Expo routes. Setup the app and try sending emails.

Usage

https://github.com/user-attachments/assets/35588e37-b388-4d6d-b3b6-f45d67296941

Prerequisites

Setup Unkey

  1. Go to unkey ratelimits

  2. Create a new namespace with the name unkey-react-native

  3. Go to settings/root-keys and create a root key with Ratelimit permissions

  4. You can follow this link to create the root key with ratelimit permissions https://app.unkey.com/settings/root-keys/new?permissions=ratelimit..create_namespace,ratelimit..read_namespace,ratelimit..limit,ratelimit..update_namespace,ratelimit.*.delete_namespace

  5. Add it in the .env file UNKEY_ROOT_KEY

Setup Environment

Copy .env.example to .env

1cp .env.example .env

Set the unkey root-key that we just created:

1UNKEY_ROOT_KEY=

Set the resend API key that we just created:

1RESEND_API_KEY=

If you are going to run the app on mobile ( ios/android ) set the base URL as your IP http://192.168.x.x:8081. To run on the web you can set the URL as http://localhost:8081

1EXPO_PUBLIC_API_URL

Quickstart

Install dependencies:

1npm install

Start the app. Scan the QR displayed after this to run the app on mobile. If you want to run it on the Web it will start on port 8081

1npm run start

Protect your API.
Start today.

2500 verifications and 100K successful rate‑limited requests per month. No CC required.