Skip to content

Framework GuidesFramework Adapters

Framework Adapters

Every official server adapter: the package to install, where it mounts, and the guide that walks through it.

2 min readproxy mode

Courier's proxy runs behind one route of your app. An official adapter mounts it in your framework: install its package and add that route. The handler takes no arguments, because it reads the sources the app registered, so moving to another framework changes only the import and the one call.

Full-stack frameworks

The proxy lives in an API route of the app itself.

FrameworkPackageRouteGuide
Next.js@noverax/courier-nextapp/api/request/route.tsNext.js
Nuxt@noverax/courier-nuxtserver/api/request.tsNuxt
SvelteKit@noverax/courier-sveltekitsrc/routes/api/request/+server.tsSvelteKit
Astro@noverax/courier-astrosrc/pages/api/request.tsAstro
Remix & React Router@noverax/courier-remixapp/routes/api.request.tsRemix & React Router
SolidStart@noverax/courier-solidsrc/routes/api/request.tsSolidStart

Server frameworks

The proxy is one route of your server.

FrameworkPackageMounted withGuide
Express@noverax/courier-expressapp.all("/api/request", courierHandler())Express
Hono@noverax/courier-honoapp.all("/api/request", courierHandler())Hono
Fastify@noverax/courier-fastifyapp.register(courierPlugin, { prefix: "/api/request" })Fastify
NestJS@noverax/courier-nestjsconsumer.apply(courierMiddleware()).forRoutes("api/request")NestJS

The user's session in server code

An API that keeps a session gets the user's session with every call server code makes for a request, once the framework serves the request with it at hand. Each adapter does that in one line; the versions listed are the ones checked in a real application on every change.

FrameworkServe each request with the sessionChecked
Next.jscreateServerCaller(api)14, 15, 16
Nuxtexport default defineNitroPlugin(requestContextPlugin)3, 4
SvelteKitregisterRequestContext(svelteKitRequestContext(getRequestEvent)), or requestContextHandle()2.19, 2
Astroexport const onRequest = requestContext()5
React Routerexport const middleware = [requestContext()]7, 8
Remixapp.use(requestContext()) from @noverax/courier-express, before Remix's handler2
SolidStartregisterRequestContext(solidStartRequestContext(getRequestEvent))1, 2
Expressapp.use(requestContext())4, 5
Fastifyapp.addHook("onRequest", requestContext())4, 5
Honoapp.use(requestContext())4
NestJSapp.use(requestContext()), on the Express or the Fastify platform10, 11, 12

Where each goes, and what each framework does differently, is in User Sessions.

The client side

The adapters serve the proxy. The typed caller the browser calls it with has guides of its own: React, with React Query, and Vue. A mobile app calls its API directly: see React Native & Expo.

Another framework

A framework that hands its route a Web-standard Request and takes a Response back can mount Courier's own handler without an adapter: see Server Handler.