Documentation
README
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:
This is the opening of the README. Read the full README on GitHub.