sickn33/agentic-awesome-skills/expo-api-routes
Claude Code and agent skill by sickn33/agentic-awesome-skills
- community
Checking that the SKILL.md file is still in the repository.
Guidelines for creating API routes in Expo Router with EAS Hosting
Install
npx vskill@latest install sickn33/agentic-awesome-skills/expo-api-routesSKILL.md
The same SKILL.md was published earlier as sickn33/agentic-awesome-skills/expo-api-routes.
When to Use API Routes
Use API routes when you need:
- Server-side secrets — API keys, database credentials, or tokens that must never reach the client
- Database operations — Direct database queries that shouldn't be exposed
- Third-party API proxies — Hide API keys when calling external services (OpenAI, Stripe, etc.)
- Server-side validation — Validate data before database writes
- Webhook endpoints — Receive callbacks from services like Stripe or GitHub
- Rate limiting — Control access at the server level
- Heavy computation — Offload processing that would be slow on mobile
When NOT to Use API Routes
Avoid API routes when:
- Data is already public — Use direct fetch to public APIs instead
- No secrets required — Static data or client-safe operations
- Real-time updates needed — Use WebSockets or services like Supabase Realtime
- Simple CRUD — Consider Firebase, Supabase, or Convex for managed backends
- File uploads — Use direct-to-storage uploads (S3 presigned URLs, Cloudflare R2)
- Authentication only — Use Clerk, Auth0, or Firebase Auth instead
File Structure
Confirm the installed Expo/EAS version and configure web output for server routes. Fragments are incomplete demos: header presence and nonempty password fields do not authenticate anyone. Implement token verification, per-user authorization, body/schema/size limits and rate/cost limits before exposing database or paid AI proxy routes. Keep secrets out of EXPO_PUBLIC variables/client imports. Native callers need the configured server origin; do not assume a relative URL works identically on every platform. Validate webhook signatures over the required raw body and deduplicate events. Bound upstream requests, check response.ok and return only approved fields; the weather endpoint is illustrative, not a verified API contract.
API routes live in the app directory with +api.ts suffix:
Basic API Route
HTTP Methods
Export named functions for each HTTP method:
Dynamic Routes
Request Handling
Query Parameters
Headers
JSON Body
Environment Variables
Use process.env for server-side secrets:
Set environment variables:
- Local: Create
.envfile (never commit) - EAS Hosting: Use
eas env:createor Expo dashboard
CORS Headers
Add CORS for web clients:
Error Handling
Testing Locally
Start the development server with API routes:
This starts a local server at http://localhost:8081 with full API route support.
Test with curl:
Deployment to EAS Hosting
Prerequisites
Deploy
Export the configured server web output first, then deploy that artifact with the supported EAS CLI; deployment is a separate authorized public action.
Environment Variables for Production
Custom Domain
Configure in eas.json or Expo dashboard.
EAS Hosting Runtime (Cloudflare Workers)
API routes run on Cloudflare Workers. Key limitations:
Missing/Limited APIs
- No Node.js filesystem —
fsmodule unavailable - No native Node modules — Use Web APIs or polyfills
- Limited execution time — 30 second timeout for CPU-intensive tasks
- No persistent connections — WebSockets require Durable Objects
- fetch is available — Use standard fetch for HTTP requests
Use Web APIs Instead
Database Options
Since filesystem is unavailable, use cloud databases:
- Cloudflare D1 — SQLite at the edge
- Turso — Distributed SQLite
- PlanetScale — Serverless MySQL
- Supabase — Postgres with REST API
- Neon — Serverless Postgres
Example with Turso:
Calling API Routes from Client
Common Patterns
Authentication Middleware
Proxy External API
Rules
- NEVER expose API keys or secrets in client code
- ALWAYS validate and sanitize user input
- Use proper HTTP status codes (200, 201, 400, 401, 404, 500)
- Handle errors gracefully with try/catch
- Keep API routes focused — one responsibility per endpoint
- Use TypeScript for type safety
- Log errors server-side for debugging
Limitations
- Use this skill only when the task clearly matches its upstream product or API scope.
- Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
- Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/agentic-awesome-skills/skills/expo-api-routes/SKILL.md
Popularity
- Repository stars
- 47,167
- Repository forks
- 6,871
- 7-day trend score
- 54
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sickn33/agentic-awesome-skills/expo-api-routes)