MCPcopy Index your code
hub / github.com/DarrenBaldwin07/clerk-rs

github.com/DarrenBaldwin07/clerk-rs @1.9.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.9.0 ↗ · + Follow
593 symbols 724 edges 139 files 120 documented · 20%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

crates.io download count badge

An unofficial Clerk.dev SDK for rust

For more detailed documentation, please reference the below links:

This SDK is updated frequently to keep up with any changes to the actual Clerk API. If you see anything that needs updated or is not inline with the official Clerk api, please open an issue!

Example

Checkout examples in the /examples directory

Using a traditional http request to a valid clerk endpoint:

use tokio;
use clerk_rs::{clerk::Clerk, ClerkConfiguration, endpoints::ClerkGetEndpoint};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ClerkConfiguration::new(None, None, Some("sk_test_key".to_string()), None);
    let client = Clerk::new(config);

    let res = client.get(ClerkGetEndpoint::GetUserList).await?;

    Ok(())
}

Using a clerk-rs method:

use tokio;
use clerk_rs::{clerk::Clerk, ClerkConfiguration, apis::emails_api::Email};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ClerkConfiguration::new(None, None, Some("sk_test_key".to_string()), None);
    let client = Clerk::new(config);

    Email::create(&client, Some(your_clerk_email));

    Ok(())
}

Protecting a actix-web endpoint with Clerk.dev:

use actix_web::{web, App, HttpServer, Responder};
use clerk_rs::{ClerkConfiguration, validators::actix::ClerkMiddleware};

async fn index() -> impl Responder {
    "Hello world!"
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {

    HttpServer::new(|| {
        let config = ClerkConfiguration::new(None, None, Some("sk_test_key".to_string()), None);
        App::new().service(
            web::scope("/app")
                .wrap(ClerkMiddleware::new(config, None, false))
                .route("/index", web::get().to(index)),
        )
    })
    .bind(("127.0.0.1", 8080))?
    .run()
    .await
}

Roadmap

  • [ ] Support other http clients along with the default reqwest client (like hyper)
  • [ ] Tokio and async-std async runtimes for hyper clients
  • [ ] Optional reqwest blocking client
  • [x] Support authorization via __session cookie on same-origin
  • [ ] Add validator support for axum, rocket, warp

Production users

Note: This SDK is completely maintained by the Rust community and is by no means affiliated with Clerk.dev.

Core symbols most depended-on inside this repo

Shape

Method 254
Enum 179
Class 133
Function 27

Languages

Rust100%

Modules by API surface

src/apis/users_api.rs29 symbols
src/apis/organizations_api.rs15 symbols
src/endpoints.rs13 symbols
src/apis/allow_list_block_list_api.rs13 symbols
src/clerk.rs12 symbols
src/apis/o_auth_applications_api.rs12 symbols
src/validators/actix.rs11 symbols
src/apis/sessions_api.rs11 symbols
src/apis/organization_memberships_api.rs11 symbols
src/apis/jwt_templates_api.rs11 symbols
src/apis/email_sms_templates_api.rs11 symbols
src/apis/saml_connections_beta_api.rs10 symbols

For agents

$ claude mcp add clerk-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page