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

@parcae/auth-clerk

v0.8.0

Published

Clerk adapter for Parcae — external auth proxied to your User model

Readme

@parcae/auth-clerk

Clerk adapter for Parcae. External authentication with user data proxied to your local User model.

Install

npm install @parcae/auth-clerk

Requires @parcae/backend and @parcae/model as peer dependencies.

Usage

import { createApp } from "@parcae/backend";
import { clerk } from "@parcae/auth-clerk";
import { User } from "./models/User";
import { Post } from "./models/Post";

const app = createApp({
  models: [User, Post],
  auth: clerk({
    secretKey: process.env.CLERK_SECRET_KEY!,
    publishableKey: process.env.CLERK_PUBLISHABLE_KEY!,
    webhookSecret: process.env.CLERK_WEBHOOK_SECRET, // optional
  }),
});

await app.start();

User Model

The User Model is a real, managed Parcae Model. Clerk user data is proxied into it.

import { Model } from "@parcae/model";

class User extends Model {
  static type = "user" as const;

  // Synced from Clerk (via proxy on first request or webhook)
  name: string = "";
  email: string = "";
  image?: string;

  // Your custom fields
  bio: string = "";
  role: "user" | "admin" = "user";
}

post.user resolves to a real User instance from your Postgres database. The Clerk user ID becomes the local User ID.

How It Works

First-request proxy

When a Clerk-authenticated request comes in:

  1. The adapter verifies the session token using @clerk/backend
  2. Looks up the Clerk user ID in your local users table
  3. If not found, fetches the user from Clerk's API and creates a local record
  4. Returns the session with the local user ID

Webhook sync (optional)

If webhookSecret is provided, the adapter mounts a webhook endpoint that handles:

  • user.created — creates a local User record
  • user.updated — updates the local User record
  • user.deleted — removes the local User record

Webhooks are verified using Svix (Clerk's webhook delivery system).

Custom user mapping

Override how Clerk user data maps to your Model:

clerk({
  secretKey: "...",
  publishableKey: "...",
  mapUser: (clerkUser) => ({
    name: `${clerkUser.firstName} ${clerkUser.lastName}`,
    email: clerkUser.emailAddresses[0]?.emailAddress ?? "",
    image: clerkUser.imageUrl,
    // Map any Clerk field to your Model's fields
  }),
});

Configuration

clerk({
  // Required
  secretKey: process.env.CLERK_SECRET_KEY!,
  publishableKey: process.env.CLERK_PUBLISHABLE_KEY!,

  // Optional — enables webhook sync
  webhookSecret: process.env.CLERK_WEBHOOK_SECRET,

  // Webhook route path. Default: "/webhooks/clerk"
  webhookPath: "/webhooks/clerk",

  // Custom Clerk → User mapping
  mapUser: (clerkUser) => ({ ... }),
})

Environment Variables

| Variable | Required | Description | | ----------------------- | -------- | ---------------------------------------- | | CLERK_SECRET_KEY | Yes | Clerk secret key (sk_...) | | CLERK_PUBLISHABLE_KEY | Yes | Clerk publishable key (pk_...) | | CLERK_WEBHOOK_SECRET | No | Svix webhook signing secret (whsec_...) |

License

MIT