CursorClaude 3.5 Sonnet / Cursorweb app development2 Customizable Placeholders
Resilient tRPC / Express API Router with JWT & Rate Limiting
Constructs a resilient Node.js / TypeScript API router featuring token bucket rate limiting, JWT verification, and standardized error responses.

Creator SwitchRoute Engineering Team
Expected Output Format:Hardened backend router code with middleware, rate limiting, and RFC 7807 error responses.
Primary Use Case:Building reliable public API services, microservice endpoints, and payment integrations.
Official Tool Documentation:Open Official Platform / Docs
Customize Placeholders in Real-Time
Define your service name and the resource endpoints to scaffold.
Prompt InstructionsCopy count not available
Build an enterprise-grade backend API router in TypeScript (Express or tRPC) for [API_SERVICE_NAME]. Architecture requirements: 1. Middleware Pipeline: - Structured JSON logging with request-id tracing (Winston / Pino). - Redis-backed sliding window rate limiter (100 requests per 15 minutes per IP/Token). - Strict CORS configuration and security headers with Helmet. - JWT authentication middleware parsing Bearer tokens with cryptographic expiration checks. 2. Endpoints / Procedures: - GET /api/v1/[RESOURCE]: Pagination with cursor support, sort direction, and field filtering. - POST /api/v1/[RESOURCE]: Idempotency key header handling to prevent duplicate billing or writes. 3. Error Handling: - Global error handler catching Zod validation errors, database constraint violations, and unhandled rejections. - Return standardized RFC 7807 Problem Details JSON format. 4. Integration Test: Supertest suite covering rate limit exhaustion (429) and invalid token rejection (401).
Optimization Tips & Parameters
Idempotency keys on POST requests prevent duplicate customer charges during network retry spikes.