npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lezzauth

v0.1.9

Published

1. Install `lezzauth` package in your Next.js project:

Downloads

5

Readme

Installation

  1. Install lezzauth package in your Next.js project:
npm install lezzauth

Preparation

  1. Sign up or log in to our platform here.

  2. Create an application on the dashboard and copy the API KEY from the Next.js section.

  3. Place the API KEY inside your .env file.

  4. Log in to our platform using:

npx lezzauth login

Note: If you use OAuth to log in (e.g., Google OAuth), set your password in the platform -> user settings -> set password, then try login again

  1. Generate components for your app:
npx lezzauth dev
  1. Edit your layout.tsx file or other Next.js root file. Example:
"use client"

import { LezzAuthProvider } from "lezzauth/nextjs";
import './globals.css'

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}): JSX.Element {
  return (
    <html lang="en">
      <LezzAuthProvider publishableKey={process.env.NEXT_PUBLIC_LEZZAUTH_PUBLISHABLE_KEY!}>
        <body>{children}</body>
      </LezzAuthProvider>
    </html>
  );
}
  1. Inside globals.css:
@tailwind base;
@tailwind components;
@tailwind utilities;

Basic Usage

  1. Create your sign-in pages. Example:
// ./app/sign-in/page.tsx

"use client"

import { SignIn } from "@/lezzauth/_generated/components/sign-in";

export default function Page() {
    return <SignIn />
}
  1. Create your sign-up pages. Example:
// ./app/sign-up/page.tsx

"use client"

import { SignUp } from "@/lezzauth/_generated/components/sign-up";

export default function Page() {
    return <SignUp />
}
  1. Create your homepage. Example:
// ./app/page.tsx

"use client"

import { UserButton } from "@/lezzauth/_generated/components/user-button"
import { useUser } from "lezzauth/nextjs"

export default function Page() {
    const { user } = useUser()

    return (
        <div className="flex justify-between p-3">
            <h1>Hello {user.email} {":)"}</h1>
            <UserButton />
        </div>
    )
}

Advance Usage

Middleware Protected Route

Create middleware.ts in your root Next.js project. Example:

import { authMiddleware } from "lezzauth/nextjs";

export default authMiddleware({
  publicRoutes: ["/sign-in", "/sign-up"]
})

export const config = {
  matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
};

Partial Components

You can also custom per partial component, for example :

SignIn Partial

"use client"

import { 
    EmailInput, 
    EmailLabel, 
    PasswordInput, 
    PasswordLabel, 
    Button as SignInButton, 
    SignInContainer, 
    SignInProvider 
} from "@/lezzauth/_generated/components/sign-in";

export default function Page() {
    return (
        <SignInProvider>
            <EmailLabel />
            <EmailInput className="border-2 border-black" />

            <PasswordLabel />
            <PasswordInput style={{ border: "2px solid black" }} />

            <SignInButton />
        </SignInProvider>
    )
}

SignUp Partial

"use client"

import { 
    EmailInput,
    EmailLabel, 
    PasswordInput, 
    PasswordLabel, 
    Button as SignUpButton, 
    SignUpContainer, 
    SignUpProvider 
} from "@/lezzauth/_generated/components/sign-up";

export default function Page() {
    return (
        <SignUpProvider>
            <EmailLabel />
            <EmailInput />

            <PasswordLabel />
            <PasswordInput />

            <SignUpButton />
        </SignUpProvider >
    )
}

Custom Redirection

NEXT_PUBLIC_LEZZAUTH_SIGN_IN_URL= #default : /sign-in
NEXT_PUBLIC_LEZZAUTH_SIGN_UP_URL= #default: /sign-up
NEXT_PUBLIC_LEZZAUTH_PUBLISHABLE_KEY=
NEXT_PUBLIC_LEZZAUTH_AFTER_SIGN_IN_URL= #default: /
NEXT_PUBLIC_LEZZAUTH_AFTER_SIGN_UP_URL= #default: /