Thursday, 19 November 2026

Shola Jegede
← All packages

Authentication · Convex component

@sholajegede/kinde-sync

A kinde sync component for Convex.

npm install @sholajegede/kinde-sync
8downloads last week
988downloads last 12 months
v0.1.4latest, Oct 22, 2026
5releases since Mar 12, 2026

Downloads

Download history

Loading download history…

Build this

Build with @sholajegede/kinde-sync

  1. 1

    Installation

    sh
    npm install @sholajegede/kinde-sync

    Add the component to your convex/convex.config.ts:

    ts
    import { defineApp } from "convex/server";
    import kindeSync from "@sholajegede/kinde-sync/convex.config.js";
    
    const app = defineApp();
    app.use(kindeSync);
    
    export default app;
  2. 2

    Setup

    1. Mount the webhook handler in convex/http.ts:

    ts
    import { httpRouter } from "convex/server";
    import { components } from "./_generated/api.js";
    import { KindeSync } from "@sholajegede/kinde-sync";
    
    const kindeSync = new KindeSync(components.kindeSync, {
      KINDE_ISSUER_URL: process.env.KINDE_ISSUER_URL!,
    });
    
    const http = httpRouter();
    
    http.route({
      path: "/webhooks/kinde",
      method: "POST",
      handler: kindeSync.webhookHandler,
    });
    
    export default http;

    2. Set your Convex environment variables:

    sh
    npx convex env set KINDE_ISSUER_URL https://yourapp.kinde.com
    npx convex env set KINDE_CLIENT_ID your_client_id
    npx convex env set KINDE_CLIENT_SECRET your_client_secret

    3. Configure Kinde auth for ctx.auth:

    This component handles webhook sync only. To enable ctx.auth in your Convex functions, create convex/auth.config.ts:

    ts
    const authConfig = {
      providers: [
        {
          domain: process.env.KINDE_ISSUER_URL,
          applicationID: process.env.KINDE_CLIENT_ID,
        },
      ],
    };
    
    export default authConfig;

    4. Register the webhook in your Kinde dashboard:

    1. Go to your Kinde dashboard → Settings → Webhooks
    2. Click Add webhook
    3. Give it a name e.g. Convex user sync
    4. In the Endpoint URL field, enter your Convex HTTP actions URL:
    code
       https://<your-deployment>.convex.site/webhooks/kinde

    You can find your Convex site URL by running npx convex dev and looking for VITE_CONVEX_SITE_URL in your .env.local, or on the under your deployment settings. 5. Under Event triggers, select:

    • user.created
    • user.updated
    • user.deleted
    1. Click Save

    To verify it's working, create a user in your Kinde dashboard and check your Convex dashboard logs — you should see the webhook fire and the user appear in your kindeUsers table instantly.

  3. 3

    Usage

    Query synced users reactively from your Convex functions:

    ts
    import { query } from "./_generated/server.js";
    import { components } from "./_generated/api.js";
    import { v } from "convex/values";
    
    export const getUser = query({
      args: { kindeId: v.string() },
      handler: async (ctx, args) => {
        return await ctx.runQuery(components.kindeSync.lib.getUser, {
          kindeId: args.kindeId,
        });
      },
    });
    
    export const listUsers = query({
      args: {},
      handler: async (ctx) => {
        return await ctx.runQuery(components.kindeSync.lib.listUsers, {});
      },
    });
    tsx
    // React
    const user = useQuery(api.myFunctions.getUser, { kindeId: "kp_..." });
    const users = useQuery(api.myFunctions.listUsers, {});