A layer in front of your API, the key on the server.
Your apps call this layer's /api routes. The routes forward to your real API with the key attached on the server, so it never reaches the browser.
Use it when
You already have an API or a third-party service and need a secure layer in front of it — with a website included.
Building the API from scratch? template-backend instead →What's included
Done from the start.
A proxy for everything
A catch-all route forwarding GET, POST, PUT, PATCH and DELETE, with query and JSON.
Typed client
A server-side client with a Bearer key, a 30-second timeout and clear errors.
CORS and tracing
Allowed origins from a list, and an x-request-id on every response.
Webhooks and health
A webhook receiver and a health check.
Security headers
HSTS, X-Frame-Options, Referrer-Policy and Permissions-Policy.
Design system
Tailwind CSS 4 with dark mode and components for a landing page.
Get started
pnpm install
cp .env.example .env.local
pnpm dev # http://localhost:3009Structure
app/api/proxy/[...path]/ forwards every method to API_BASE_URL
app/api/webhooks/ webhook receiver
app/api/health/ health check
lib/api-client.ts typed server-side client
middleware.ts CORS + x-request-id
components/ design system and landing pageEnvironment variables
- API_BASE_URL
- API_KEY
- ALLOWED_ORIGINS
- NEXT_PUBLIC_APP_URL
API_KEY is optional and sent as a Bearer token to your API.
Good to know
- Webhook signature verification is a TODO — add it for your provider before going live.
- The Dockerfile copies a public/ folder the repo doesn't have yet. Create it before building the image.
Built with
- Next.js 15
- React 19
- TypeScript
- Tailwind CSS 4
- next-themes
- Docker
More templates
template-next-supabase
MITNext.js and Supabase, where a typed data layer owns every query and every authorization check.
Next.js 16 · React 19 · Supabase
Read more →template-next-mongo
MITNext.js and MongoDB, where a shared data layer owns the client, schemas, queries and authorization.
Next.js 16 · React 19 · MongoDB driver 7
Read more →template-monorepo
MITA Next.js web app, an Express API and Inngest background jobs sharing one database schema.
Next.js 15 · React 19 · Clerk
Read more →template-backend
MITA REST API in Express and TypeScript with sign-in, Postgres, Redis and validation in place.
Express 5 · TypeScript · Clerk
Read more →template-react-native
MITAn iOS and Android app in Expo with navigation, light and dark themes and a typed API client.
Expo SDK 54 · React Native 0.81 · React 19
Read more →
Let's build
the next thing.
You talk to me, not a salesperson. The first call is free.
— Kenny
psst, it takes 15 min
Write, and I reply the same working day.