expo-api-routes

Implement secure API routes in Expo Router apps using +api.ts files.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/soham2008xyz/trade-tycoon --skill expo-api-routes-soham2008xyz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: expo-api-routes
Source: https://github.com/soham2008xyz/trade-tycoon/tree/main/.agents/skills/expo-api-routes
Command: npx skills add https://github.com/soham2008xyz/trade-tycoon --skill expo-api-routes-soham2008xyz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

expo-api-routes helps you design API endpoints in an Expo Router app so sensitive logic and secrets stay on the server, while client requests remain simple and safe.

Core Features & Use Cases

  • Use API routes for server-side secrets: Keep keys and credentials (e.g., OpenAI/Stripe) out of the client while still enabling the needed functionality.
  • Implement robust REST endpoints: Create GET/POST/PUT/DELETE handlers with dynamic route segments like users/[id] for structured resources.
  • Handle production constraints on EAS Hosting: Prepare for Cloudflare Workers limitations by using Web APIs and edge-friendly database options.
  • Add web-ready CORS and consistent error handling: Support browser clients and return appropriate status codes for validation and failures.
  • Use environment variables correctly: Store secrets with process.env and configure them for local development and EAS/production.

Quick Start

Create a new file in your Expo Router app under app/api with the +api.ts suffix (for example, app/api/hello+api.ts) and implement the required named HTTP method exports to return Response.json from your server code.

Frequently Asked Questions about expo-api-routes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I keep server-side secrets out of my Expo Router client app?

To keep server-side secrets out of your Expo Router client app, implement API routes using +api.ts files under the app/api directory. This ensures sensitive keys remain on the server while the client makes safe requests.

What are Expo Router API routes and when should I use them?

Expo Router API routes are server-side endpoints created with +api.ts files that process HTTP requests securely. Use them when handling sensitive credentials or running server logic like database operations to prevent exposing secrets to the client.

How do I create a REST endpoint with dynamic routes in Expo Router?

Create a REST endpoint with dynamic routes in Expo Router by adding a +api.ts file and using named exports per HTTP method. You can handle dynamic route segments like users/[id] to manage structured resources and return Response.json.

Can I use environment variables for API keys in EAS Hosting and Cloudflare Workers?

Yes, you can use environment variables for API keys in EAS Hosting and Cloudflare Workers by reading secrets from process.env. Configure these variables for local development and production to keep credentials secure.

How do I configure CORS for web clients in Expo API routes?

To configure CORS for web clients in Expo API routes, implement web-ready CORS headers within your +api.ts file. This allows your endpoints to support browser clients and handle cross-origin requests safely.

What limitations exist for Expo API routes on Cloudflare Workers?

Expo API routes on Cloudflare Workers face limitations requiring Web APIs and edge-friendly database options. You must adapt server logic to fit EAS Hosting constraints, ensuring your code relies on standard Web APIs instead of Node-specific modules.