
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@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 { notFound } from 'next/navigation'
export default async function Page() {
const auth = await getAuth()
if (!auth.isAuthorized) notFound()
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
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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.