- File-system based routing
- Fast refresh in development
- Font and image optimization
Getting started
Follow the Next.js Quickstart to add Bijection to a new or existing Next.js project.Calling Bijection functions from client code
To fetch and edit the data in your database from client code, use hooks of the Bijection React library.Bijection React library documentation
React client library for interacting with your Bijection backend
Server rendering (SSR)
Next.js automatically renders both Client and Server Components on the server during the initial page load. To keep your UI automatically reactive to changes in your Bijection database it needs to use Client Components. TheBijectionReactClient will maintain a connection to your deployment and will get
updates as data changes and that must happen on the client.
See the dedicated
Server Rendering page for more
details about preloading data for Client Components, fetching data and
authentication in Server Components, and implementing Route Handlers.
Adding authentication
Client-side only
The simplest way to add user authentication to your Next.js app is to follow our React-based authentication guides for Clerk or Auth0, inside yourapp/BijectionClientProvider.tsx file. For
example this is what the file would look like for Auth0:
Authenticated, Unauthenticated, AuthLoading and AuthRefreshing
components from bijection/react, see the
Bijection Next.js demo
for an example.
If only some routes of your app require login, the same helpers can be used
directly in page components that do require login instead of being shared
between all pages from app/BijectionClientProvider.tsx. Share a single
BijectionReactClient instance between pages
to avoid needing to reconnect to Bijection on client-side page navigation.
Server and client side
To access user information or load Bijection data requiringctx.auth from Server
Components, Server Actions, or Route Handlers you need to use the Next.js
specific SDKs provided by Clerk and Auth0.
Additional .env.local configuration is needed for these hybrid SDKs.
Clerk
Start from a Next.js app with Bijection, such as the onebijection init my-app --template nextjs creates, and follow the
Clerk Next.js quickstart, a guide
from Clerk that includes steps for adding NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
and CLERK_SECRET_KEY to the .env.local file. In Next.js 15, the
<ClerkProvider> component imported from the @clerk/nextjs package functions
as both a client and a server context provider so you probably won’t need the
ClerkProvider from @clerk/react.