Start

PassIt Documentation

Build clean Next.js App Router proxy routes with server-only secrets, retries, timeouts, normalization, and hooks.

PassIt is a config-driven proxy gateway for Next.js App Router Route Handlers. It sits between your client and your real backend, handling auth headers, retries, timeouts, error normalization, and logging.

txt
Client -> Route Handler (PassIt) -> Real Backend

With PassIt, repeated proxy route boilerplate becomes a small route handler:

ts
import { passIt } from "@pajarrahmansyah/passit"; import type { NextRequest } from "next/server"; export async function GET(req: NextRequest) { return passIt({ path: "/users", req }); }

Config lives in one place. Secrets stay server-side. Route handlers stay small.

What PassIt handles

  • Proxying client requests to your real backend securely.
  • Keeping API keys and backend URLs server-side only.
  • Auto-forwarding query params, request body, and dynamic headers when req is provided.
  • Merging headers with PassIt config/route headers winning on conflicts.
  • Timeout handling with per-route override.
  • Retry logic on configured onStatus codes, network errors, and adapter exceptions.
  • Response normalization into a consistent success/error shape.
  • Content-Type detection for JSON and plain text. HTML responses are consumed and returned as null.
  • Logging hooks with dev/prod separation.
  • fetch and optional axios support.

What PassIt does not handle

PassIt does not replace client-side data fetching, configure CORS, or handle infrastructure concerns like rate limiting, SSL, load balancing, and WAF rules. It is App Router-only for now.