![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@fluido/dreno-nextjs
Advanced tools
Dreno is one of the easiest way to add authentication and user management to your Next.js application. Add sign up, sign in, and profile management to your application in minutes.
npm install @fluido/dreno-nextjs
To build the package locally with the TypeScript compiler, run:
npm run build
To build the package in watch mode, run the following:
npm run dev
Dreno only requires your application to export a middleware
.
DRENO_KEY
Get your DRENO_KEY
at dreno.fluido.design.
Set DRENO_KEY
to your .env.local
file.
DRENO_KEY=[projectId]:•••••••••••
middleware.ts
At the root of your Next.js project, create a file named middleware.ts
like the following:
import { drenoMiddleware } from '@fluido/dreno-nextjs/server'
export const middleware = drenoMiddleware()
export const config = {
matcher: [
/*
* Standard Next.js matcher config.
* Read more at Next's Documentation:
* https://nextjs.org/docs/app/building-your-application/routing/middleware#matching-paths
*
*/
'/((?!api|_next/static|_next/image|favicon.ico).*)',
],
}
With async Server Components the getAuth
function returns a Promise that you can await to get auth info.
import { getAuth } from '@fluido/dreno-nextjs/server'
import { redirect } from 'next/navigation'
export default async function Page() {
const auth = await getAuth()
if (!auth.isAuthorized) redirect('/404')
return <h1>Hello {auth.user.name}!</h1>
}
With Client Components the useAuth
hook returns an auth info object.
'use client'
import { useAuth } from '@fluido/dreno-nextjs'
export function LogoutButton() {
const auth = useAuth()
return <button onClick={() => auth?.logout()}>Logout</button>
}
This is a bare minimum example that protects every route of your app. When trying to access any route, the visitor will be redirected to a custom domain provided by Fluido.
For further details on how to create your own login roudes, examples, and more, please refer to our Documentation.
You can get in touch with us in any of the following ways:
We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines.
@fluido/dreno-nextjs
follows good practices of security, but 100% security cannot be assured.
@fluido/dreno-nextjs
is provided "as is" without any warranty. Use at your own risk.
For more information and to report security issues, please refer to our security documentation.
This project is licensed under the MIT license.
See LICENSE for more information.
FAQs
Dreno library
The npm package @fluido/dreno-nextjs receives a total of 1 weekly downloads. As such, @fluido/dreno-nextjs popularity was classified as not popular.
We found that @fluido/dreno-nextjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.