If you have not done so yet, be sure you have obtained credentials from the console.
1
Install packages
2
Configure routes
Configure the splat route. Be sure to add the nextJs extension, it will handle passing the client requests (
next/headers
), as well passing the correct headers on server-side calls automatically.app/api/[...nile]/route.ts
Server actions and RSC
The build-in components found in@niledatabase/react
will request information client side. If you’d like to hydrate them, @niledatabase/server
functions can be called.
Example: Verify email address
app/verify-email/page.tsx
nile.users.verifySelf
mirrors the client-side call to /api/auth/verify-email
. All server side calls can be called from a client based on their configured route.Client side
While in most cases, actions would be used to handle the calls to nile-auth, it is possible to use@niledatabase/react
which can do a lot of the heavy lifting for you, especially when it comes to client-side authorization, or quickly getting a demo app up and running.
Example: Hydrated sign up / dashboard page
@niledatabase/client
to handle the rest