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 🙏

© 2026 – Pkg Stats / Ryan Hefner

adonis-clerk

v1.0.3

Published

Clerk authentication plugin for AdonisJS v6 - Sign in, sign out, and user management

Readme

adonis-clerk

A Clerk authentication plugin for AdonisJS v6. Provides seamless integration with Clerk for handling sign-in, sign-out, and user management in your AdonisJS applications.

Features

  • 🔐 Session Token Verification - Verify Clerk session tokens from cookies or Authorization headers
  • 🛡️ Middleware Protection - Protect routes with authentication and authorization middleware
  • 👤 User Management - Fetch, update, and manage users via the Clerk Backend API
  • 🏢 Organization Support - Role-based access control with organizations
  • 🔗 Webhook Support - Verify and handle Clerk webhooks

Installation

```bash npm install adonis-clerk @clerk/backend ```

Configuration

Run the configure command to set up the package:

```bash node ace configure adonis-clerk ```

This will:

  1. Create `config/clerk.ts` configuration file
  2. Add environment variables to `.env`
  3. Register the provider in `adonisrc.ts`

Environment Variables

Add your Clerk keys to `.env`:

```env CLERKPUBLISHABLE_KEY=pk_test... CLERKSECRET_KEY=sk_test... ```

Get your keys from the Clerk Dashboard → API Keys.

Usage

Protecting Routes

```typescript import router from "@adonisjs/core/services/router" import app from "@adonisjs/core/services/app" import { clerkMiddleware, clerkRequireAuth } from "adonis-clerk"

// Get clerk service const clerk = await app.container.make("clerk")

// Apply global middleware router.use([clerkMiddleware(clerk)])

// Protect routes router.get("/dashboard", async ({ clerk }) => { return { userId: clerk.userId } }).use(clerkRequireAuth(clerk)) ```

Accessing Auth State

```typescript router.get("/api/me", async ({ clerk, response }) => { if (!clerk.userId) { return response.unauthorized({ error: "Not authenticated" }) } return { userId: clerk.userId, sessionId: clerk.sessionId, } }) ```

Sign Out (Revoke Sessions)

```typescript // Revoke a single session await clerk.revokeSession("sess_xxx")

// Sign out everywhere await clerk.revokeAllUserSessions("user_xxx") ```

API Reference

ClerkService Methods

| Method | Description | | ---------------------------------------- | --------------------------- | | `verifyToken(token)` | Verify a session token | | `getUser(userId)` | Get a user by ID | | `revokeSession(sessionId)` | Revoke a session (sign out) | | `revokeAllUserSessions(userId)` | Sign out everywhere | | `updateUserMetadata(userId, metadata)` | Update user metadata |

Middleware Functions

| Middleware | Description | | ----------------------------------- | ----------------------------------- | | `clerkMiddleware(clerk)` | Attaches auth state to all requests | | `clerkRequireAuth(clerk)` | Requires authentication | | `clerkRequireOrg(clerk, options)` | Requires organization membership | | `clerkLoadUser(clerk)` | Loads full user data |

License

MIT License - see LICENSE.md