Package managers & CDNs
Every way to add a Sponsorkit SDK to a project, per language and package manager, including browser imports from a CDN.
Each section below covers one language. The commands assume a published release.
JavaScript / TypeScript#
One package, @sponsorkit/sdk, with no runtime dependencies. It ships ESM and CommonJS builds and its own
TypeScript types, so there is no @types package to add. It is on npm.
npm install @sponsorkit/sdkpnpm add @sponsorkit/sdkyarn add @sponsorkit/sdkbun add @sponsorkit/sdkdeno add npm:@sponsorkit/sdkImport from the entry point that matches where your code runs:
| Entry point | For | Sign-in | Storage |
|---|---|---|---|
@sponsorkit/sdk | Browsers (and any runtime in mock mode) | Popup, redirect fallback | localStorage |
@sponsorkit/sdk/node | Node, Bun, Deno: CLIs and desktop apps | Loopback, paste-back | Per-user config directory |
@sponsorkit/sdk/server | Backends and Cloudflare Workers | None: verifySession() only | None |
@sponsorkit/sdk/elements | Plain HTML pages | <sponsorkit-button>, <sponsorkit-badge> | localStorage |
The node entry uses Node built-ins (node:http, node:fs, node:child_process), so under Deno it asks for
network, environment, file and subprocess permissions. Deno can also import it without deno add:
import { Sponsorkit } from "npm:@sponsorkit/sdk@1.0.0/node";.
Browsers without a bundler#
The browser entry points only import their own files, so a CDN that mirrors npm can serve them as native ES modules. Pin an exact version in the URL:
<script type="module">
import { Sponsorkit } from "https://esm.sh/@sponsorkit/sdk@1.0.0";
const sk = new Sponsorkit({ github: "octocat", openCollective: "my-collective" });
const fc = await sk.getFinancialContribution();
if (fc.active().length === 0) document.querySelector("#sponsor-banner").hidden = false;
document.querySelector("#sign-in").onclick = () => sk.signIn(); // popup: call it from the click
</script><script type="module">
import { Sponsorkit } from "https://cdn.jsdelivr.net/npm/@sponsorkit/sdk@1.0.0/dist/index.js";
const sk = new Sponsorkit({ github: "octocat", openCollective: "my-collective" });
const fc = await sk.getFinancialContribution();
if (fc.active().length === 0) document.querySelector("#sponsor-banner").hidden = false;
document.querySelector("#sign-in").onclick = () => sk.signIn(); // popup: call it from the click
</script>The web components register themselves when their module loads:
<script type="module" src="https://cdn.jsdelivr.net/npm/@sponsorkit/sdk@1.0.0/dist/elements.js"></script>
<sponsorkit-button github="octocat" amount="500" frequency="monthly">Sponsor</sponsorkit-button>
<sponsorkit-badge github="octocat"></sponsorkit-badge>With esm.sh, the same module is https://esm.sh/@sponsorkit/sdk@1.0.0/elements. CDNs only serve published
versions.
.NET#
The Sponsorkit NuGet package targets netstandard2.0 and net8.0. On .NET 8 and later it has no dependencies;
the netstandard2.0 build depends on System.Text.Json. It is on NuGet.
dotnet add package Sponsorkit<ItemGroup>
<PackageReference Include="Sponsorkit" Version="1.0.0" />
</ItemGroup><!-- Directory.Packages.props -->
<ItemGroup>
<PackageVersion Include="Sponsorkit" Version="1.0.0" />
</ItemGroup>
<!-- your .csproj -->
<ItemGroup>
<PackageReference Include="Sponsorkit" />
</ItemGroup>dotnet paket add Sponsorkit --project src/MyApp/MyApp.csprojEverything lives in the Sponsorkit namespace; the client class is SponsorkitClient.
Python#
The sponsorkit distribution supports Python 3.10 and later and depends only on httpx. It ships type hints
(py.typed). It is on PyPI.
python -m pip install sponsorkituv add sponsorkitpoetry add sponsorkit[project]
dependencies = [
"sponsorkit>=0.2,<0.3",
]Sponsorkit is a library, so you never install it with pipx. Declare it as a dependency of your own tool; when
your users run pipx install your-tool, it comes along. To try a script without creating a project,
uv run --with sponsorkit python my_cli.py installs it into a throwaway environment.
Go#
The module path is github.com/ffMathy/sponsorkit/sdks/go and the package name is sponsorkit. It needs
Go 1.23 or later (its go.mod says go 1.23) and uses only the standard library.
go get github.com/ffMathy/sponsorkit/sdks/goimport sponsorkit "github.com/ffMathy/sponsorkit/sdks/go"The alias is optional, since the package is already named sponsorkit, but it makes the import read clearly. Go
fetches the module from GitHub through the module proxy, so there is no separate registry. Releases are tags
named sdks/go/vX.Y.Z; see versions & pinning.
Rust#
The sponsorkit crate needs Rust 1.85 or later (it uses the 2024 edition) and a Tokio runtime. It is
on crates.io.
cargo add sponsorkit
cargo add tokio --features macros,rt-multi-thread[dependencies]
sponsorkit = "1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }- Features. The crate has no Cargo features of its own, so there is nothing to turn on or off.
- TLS. HTTPS goes through
reqwestwithrustls, so the crate doesn't link OpenSSL and needs no system libraries. - Tokio. The SDK uses Tokio for timers, the loopback listener and cancellation, and works on the
current-thread and multi-thread runtimes.
#[tokio::main]needs themacrosfeature, plusrt-multi-threadfor the default multi-thread flavour.