Backend for Frontend (BFF)

A small backend tailored to one client, combining services into the exact response shape that web, mobile, or another frontend needs.

a backend just for the mobile appgive the frontend exactly the data it needsone endpoint that combines dashboard databackend for frontenta server that calls the other services for my appAPI made for one screenbff backendbackend for front end

See it

Live demo coming soon

What it is

A backend for frontend, usually shortened to BFF, is a server-side API built for one client experience. A web app, mobile app, and TV app can each have a BFF that calls several internal services and returns the exact shape that client needs. The pattern came out of SoundCloud and spread under this name through Sam Newman's 2015 write-up.

Reach for it when the client is making a chatty chain of calls, exposing server credentials, or repeatedly reshaping data from several services. The BFF can aggregate in parallel, hide private tokens, and make one coarse-grained response for a screen without forcing every client into one universal API.

The trap is copying business logic into every BFF. Keep pricing, permissions, and state changes in the owning services; let the BFF orchestrate and shape. Do not create one per page by reflex, and do not let a shared BFF become another general-purpose backend with every client coupled to it.

Ask AI for it

Build a Next.js Route Handler at app/api/dashboard/route.ts as a BFF for the web dashboard. Keep the Stripe secret key server-only, fetch the account, subscription, and activity services in parallel with Promise.all, apply AbortSignal.timeout to every call, validate upstream JSON with Zod, and return one typed view model containing only fields the screen renders. Preserve request IDs, map upstream failures to stable error codes, and add tests for partial failure and timeout.

You might have meant

api proxygraphqlpayloadendpointsdk client library