For years, I was tired of wrestling with overly complex authentication libraries.
Building my own authentication system needed much more care than I could ever imagine. Lucia comes with a simple, flexible, and type-safe authentication library designed for Astro, Express, Next.js, Nuxt, SolidStart, SvelteKit, and more! π
Why Lucia?
Unlike other third-party authentication libraries like Clerk, NextAuth, or Supabase auth, Lucia takes a different approach. It's not a one-size-fits-all solution. Instead, Lucia empowers you to create authentication tailored precisely to your app's needs. No hidden configurations or callbacks that force you into a corner.
Key Features:
β Own your data with full control
β Secure with a focus on user privacy
β MIT license for open development
β Fully typed for TypeScript lovers
How Does Lucia Stand Out?
πΉ Flexibility: Customize your sign-in forms and APIs the way you want.
πΉ Integration: Direct support for Next.js, SvelteKit, and Astro SSR.
πΉ Database Support: Adapters for MySQL, Postgres, Sqlite, MongoDB, and Redis.
πΉ Custom User Attributes: Set any user attributes, similar to Firebase custom claims.
πΉ Low-Level Control: Manage user and session data easily.
Code Example:
import { Lucia } from "lucia";
const lucia = new Lucia(new Adapter(db));
const user = await lucia.createUser("email", userEmail, {
password: userPassword,
attributes: {
username: userUsername
}
});
const session = await lucia.createSession(user.userId);
const sessionCookies = lucia.createSessionCookies(session);
Comparison with Other Libraries:
π Supabase auth, SuperTokens, NextAuth: These libraries have too much abstraction for users to have control over their authentication flow. Lucia gives you the tools to craft authentication that fits your app perfectly.
Demo Repo: Check out my example repo using Lucia with Next.js and Prisma ORM: Lucia Basic Starter
If you're tired of authentication libraries that dictate how you should build your app, give Lucia a try. Explore more about Lucia in the official documentation. Have questions? Feel free to reach out on GitHub or Discord. Let's empower our apps with flexible and secure authentication together! π
Top comments (0)