rn-backend

Guidance for connecting an Expo and React Native app to a backend, the server-side system that handles accounts, data, files, or live updates. It covers patterns that work regardless of which backend provider you choose.

In plain words
What is it for?
Use it to add authentication, database access, file storage, real-time features, login-protected routes, token refresh, and reliable sign-out behavior.
Why use it?
It helps avoid insecure token storage, scattered login logic, failed session refreshes, and protected screens showing data after sign-out.

Skill for Claude CodeCodex

Part of the dev-flow plugin — 45 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/lukedj78/dev-flow/rn-backend
Any agent
npx skills add lukedj78/dev-flow --skill rn-backend
Clone the repo
git clone --depth 1 https://github.com/lukedj78/dev-flow

Made for: Claude Code, Codex.

Or install dev-flow, the plugin that ships this one along with the rest of its 45 skills.

Per session 178 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 902 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00178 $0.00902
Opus 5 $0.00089 $0.00451
Sonnet 5 $0.00036 $0.00180
Haiku 4.5 $0.00018 $0.00090

Measured 2d ago against content hash 1dd1846877e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

rn-backend scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rn-backend/SKILL.md · 44 lines

How it starts

The opening of the file, as written. The whole thing — 44 lines — stays where its author put it; the contents beside it link to each section on GitHub.

rn-backend — provider-agnostic backend integration for RN/Expo

For the current Expo API and per-version details, verify against the Expo docs / MCP mcp.expo.dev / expo/skills (see rn-fundamentals → Source of truth).

The 5 rules (non-negotiable, regardless of provider)

  1. Tokens in expo-secure-store, never AsyncStorage or plain in-memory. Tokens are bearer credentials — they go in Keychain (iOS) / Keystore (Android) encrypted at rest.
  2. Auth state in a Zustand store + replicated in TanStack Query with key ["auth", "session"]. Zustand for synchronous reads in components and _layout.tsx redirect logic; TanStack Query for refetch-on-focus and revalidation.
  3. api() wrapper owns auth headers + refresh-on-401. Every fetch goes through it. Refresh flow is centralized — no per-call retry logic.
  4. Auth gate via Expo Router groups: (auth)/ for public screens, (app)/ for protected; the (app)/_layout.tsx checks the store and <Redirect /> if no user.
  5. Sign-out clears EVERYTHING: secure-store token, Zustand store, TanStack Query cache (queryClient.clear()). No "user signed out but still see old data" bugs.

Quick decision tree

  • "Which provider? Supabase / Firebase / custom REST / tRPC?" → references/decision-tree.md
  • "What's the shared client-auth architecture?" → references/concepts.md
  • "How do I wire it up — store, middleware, gate?" → references/patterns.md
  • "I picked Supabase. Specifics?" → references/supabase.md
  • "I picked Firebase." → references/firebase.md
  • "I'm bringing my own REST/JSON backend." → references/custom-rest.md
  • "I want tRPC end-to-end typed." → references/trpc.md

Common anti-patterns (NEVER do)

  • AsyncStorage.setItem("token", token) — use SecureStore.setItemAsync("token", token).
  • ❌ Reading the token inside every api() call from secure-store synchronously — cache it in the Zustand store, refresh from secure-store only on app start.
  • ❌ Stored "logged in" boolean in the client that drifts from the server token's actual validity — single source of truth is the token + a /me query.
  • ❌ Calling signOut() and forgetting to queryClient.clear() — next user sees previous user's posts in cache.
  • ❌ Hardcoding Authorization: Bearer xxx in a single screen — wrap in api().
  • ❌ Vendor lock-in code scattered (supabase.auth.signIn(...) in 12 components) — wrap in lib/auth.ts so swapping providers touches one file.

Read the full file on GitHub · 44 lines

Files

What ships with it

8 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 44 lines · 178 tokens per session scan A 1dd1846877e4

Subscribe to this mod's changes

rn-backend is a skill published in the GitHub repository lukedj78/dev-flow (5 stars, last pushed 5d ago), licensed MIT. It adds 178 tokens to every session and 902 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

uniwind

Uniwind — Tailwind CSS v4 styling for React Native. Use when adding, building, or debugging components in a React Native project that uses Uniwind classNames. Covers setup, Metro config, global.css, theming, className props, accent- color props, platform/data/state/responsive variants, CSS variables, custom utilities…

uni-stack/uniwind · 130 tokens

setup-react-native-storybook

Set up Storybook for React Native in Expo, React Native CLI, or Re.Pack projects. Use when adding Storybook to a project, configuring metro.config.js with withStorybook, creating .rnstorybook configuration files, setting up Storybook routes in Expo Router, configuring getStorybookUI, or adding the StorybookPlugin to a…

storybookjs/react-native · 102 tokens

upgrading-react-native-storybook

Incrementally upgrade React Native Storybook across the supported migration paths. Use when upgrading @storybook/react-native projects from 5.3.x to 6.5.x, 6.5.x to 7.6.x, 7.6.x to 8.3.x, 8.x to 9.x, or 9.x to 10.x. Detect the currently installed Storybook version, choose only the next migration step, update…

storybookjs/react-native · 151 tokens

platform-specialist

Doc-driven platform integration expert. Converts a web app to LINE MINI App (LIFF SDK), PWA (Next.js 16), and Capacitor (iOS/Android). Expo & Tauri are secondary/legacy. ปรัชญาหลัก: ดึง docs จริงล่าสุดก่อนเขียนโค้ดเสมอ — ไม่ freeze snippet ที่จะ rot. Triggers: "LINE MINI App", "LIFF", "LINE OA", "convert to app"…

wasintoh/toh-framework · 161 tokens

wire-sdk

앱인토스 SDK(권한·저장소·공유·Safe Area 등)를 화면에 붙인다.

TOKTOKHAN-DEV/agent-company · 2 tokens

migrate-nativewind-to-uniwind

Migrate a React Native project from NativeWind to Uniwind. Use when the user wants to replace NativeWind with Uniwind, upgrade from NativeWind, switch to Uniwind, or mentions NativeWind-to-Uniwind migration. Handles package removal, config migration, Tailwind 4 upgrade, cssInterop removal, theme conversion, and all…

uni-stack/uniwind · 82 tokens