Open Source ยท MIT License

Auth for TypeScript, done right.

Himayah is a lightweight, schema-first authentication framework. You own your database, your schema, and your code. We handle the hard parts.

lib/auth.ts
import { createAuth } from "@himayah/core";
import { createJWTSessionStore } from "@himayah/session";
import { passwordPlugin } from "@himayah/plugin-password";
import { drizzleAdapter } from "@himayah/adapter-drizzle";

export const auth = createAuth({
  adapter: drizzleAdapter(db, { users }),
  sessionStore: createJWTSessionStore({
    secret: process.env.AUTH_SECRET!,
  }),
  plugins: [
    passwordPlugin({ getPasswordHash, setPasswordHash }),
  ],
  baseUrl: process.env.APP_URL!,
});

Everything you need, nothing you don't

Himayah ships with production-grade security defaults and a composable plugin system.

๐Ÿ”

AES-256-GCM Sessions

Stateless JWE sessions encrypted client-side. Zero database round-trips on every request.

๐Ÿงฉ

Plugin Composable

Mix and match password, OAuth, magic link, OTP, passkeys, and organizations. Pay only for what you use.

๐Ÿ—„๏ธ

Bring Your Own Schema

Define your tables with Drizzle, Prisma, or Kysely. Himayah never owns your migrations.

๐ŸŒ

Runs Anywhere

Cloudflare Workers, Vercel Edge, Deno, Bun, Node.js. Pure Web Crypto โ€” no native bindings.

๐Ÿ›ก๏ธ

Secure by Default

CSRF double-submit, constant-time comparisons, PKCE for OAuth, host-header spoofing protection.

โšก

Type-Safe Client

First-class TypeScript throughout. The browser client is a fully typed proxy of your server config.

How does Himayah compare?

Different tools for different needs. Here's an honest look at the tradeoffs.

FeatureHimayahNextAuth.jsLuciaAuth.js
Schema ownershipโœ… Always yoursโš ๏ธ Adapter neededโœ… Always yoursโš ๏ธ Adapter needed
Edge runtimeโœ… Nativeโš ๏ธ Partialโœ… Nativeโœ… Native
Plugin composabilityโœ… Fullโš ๏ธ LimitedโŒ DIYโš ๏ธ Limited
Built-in OTP/Magic Linkโœ… YesโŒ NoโŒ NoโŒ No
Built-in Organizationsโœ… YesโŒ NoโŒ NoโŒ No
PKCE for OAuthโœ… Yesโœ… YesโŒ DIYโœ… Yes
Framework agnosticโœ… YesโŒ Next.js onlyโœ… Yesโœ… Yes

Ready to add auth to your app?

Follow the getting started guide and have authentication running in under 10 minutes.

Get Started for free โ†’