image (18)

New Release: Clerk Integration 🪪

imagejas
Jasdeep Garcha
·
10/04/2024

Today, we’re announcing an out-of-the-box integration with Clerk. Users can now extend identity with entitlements and our library of embeddable UI components for end-to-end purchasing experiences and plan management.

Dig into our documentation here.

When we started Schematic, we thought a lot about a few product categories that felt adjacent to pricing and packaging & authentication was one of those. Many implementations we saw in the wild around access, pricing, and packaging in B2B SaaS applications took advantage of JWT tokens and other functionality in authentication tools to power RBAC, ReBAC, and to surface plan and access information to the end user. While this works, it has drawbacks (hard to do metering, stateless tokens, user-centric entities, drift). Extending Clerk with Schematic allows you to quickly deploy sophisticated and optimized pricing and packaging experiences without compromising.

We personally use Clerk as an authentication provider and we share a similar worldview around components, so it felt natural to build against their solution as a our first authentication integration.

Using the Clerk integration with Schematic, you can:

  • Automatically import organizations and users from your existing identity provider, Clerk

  • Enrich Schematic company profiles with existing metadata

  • Assign and enforce entitlements directly in your application with feature flags

  • Embed drop-in components that are context-aware for a complete purchasing experience

Integrating Clerk with Schematic

You can set up the Clerk integration in the Integrations tab within Schematic.

Image

Once there, do the following:

  1. In Clerk, navigate to Configure > Webhooks.

  2. Add a new endpoint and enter the URL from Schematic.

  3. Subscribe to the events listed above to ensure Schematic will receive updates from Clerk when organizations or users change, and click Create.

  4. Once you’ve created the webhook, you should be provided a signing key. Copy that and add to the field in Schematic.

  5. Create a Clerk secret key (Configure > API keys) and add that in the corresponding field in Schematic. Click Connect to Clerk.

Once you’re connected, Schematic will import organizations, users, and memberships from Clerk. A clerkId will be added as a unique key to all entities & additional key, email, will be added as a unique key for users. The following data will be imported and kept up-to-date automatically:

  • Organizations

    • logourl

  • Users

    • updatedat (epoch time)

    • createdat (epoch time)

    • imageurl

    • role

On initial import, if an organization or user in Schematic already exists with a clerkId that matches data from Clerk, the record will simply be updated.

You will now be able to assign entitlements and enforce them in your application using Schematic flags, features, and plans.

Using Schematic Components

Similar to Clerk’s UI components, Schematic offers drop-in components for end-to-end purchasing experiences and plan management.

Once you’ve imported organizations and users and built out your packaging model, you can navigate to the Components tab in Schematic to design, customize, and deploy customer portals.

When Schematic Components are embedded in your application, they will be aware of the identity of the logged in user and serve the appropriate data and controls.

Image

Coming Soon

We’re actively considering ways to expand the integration, including:

  • Syncing Clerk metadata fields as additional keys or traits

  • Automatically linking Stripe, Clerk, and Schematic entities by inferring relationships

  • Enriching Clerk with pricing and packaging data from Schematic

  • … and more!