Toolkit for generating sponsors images. Supports GitHub Sponsors, Patreon and OpenCollective.
Create .env
file with:
; GitHub provider.
; Token requires the `read:user` and `read:org` scopes.
SPONSORKIT_GITHUB_TOKEN=
SPONSORKIT_GITHUB_LOGIN=
; Patreon provider.
; Create v2 API key at https://www.patreon.com/portal/registration/register-clients
; and use the "Creatorโs Access Token".
SPONSORKIT_PATREON_TOKEN=
; OpenCollective provider.
; Create an API key at https://opencollective.com/applications
SPONSORKIT_OPENCOLLECTIVE_KEY=
; and provide the ID, slug or GitHub handle of your collective.
SPONSORKIT_OPENCOLLECTIVE_ID=
; or
SPONSORKIT_OPENCOLLECTIVE_SLUG=
; or
SPONSORKIT_OPENCOLLECTIVE_GH_HANDLE=
Only one provider is required to be configured.
Run:
npx sponsorkit
Example Setup | GitHub Actions Setup | Generated SVG
Create sponsorkit.config.js
file with:
import { defineConfig, presets } from 'sponsorkit'
export default defineConfig({
// Providers configs
github: {
login: 'antfu',
type: 'user',
},
opencollective: {
// ...
},
patreon: {
// ...
},
// Rendering configs
width: 800,
formats: ['json', 'svg', 'png'],
tiers: [
// Past sponsors, currently only supports GitHub
{
title: 'Past Sponsors',
monthlyDollars: -1,
preset: presets.xs,
},
// Default tier
{
title: 'Backers',
preset: presets.base,
},
{
title: 'Sponsors',
monthlyDollars: 10,
preset: presets.medium,
},
{
title: 'Silver Sponsors',
monthlyDollars: 50,
preset: presets.large,
},
{
title: 'Gold Sponsors',
monthlyDollars: 100,
preset: presets.xl,
},
],
})
Also check the example.
You can also use SponsorKit programmatically:
import { fetchSponsors } from 'sponsorkit'
const sponsors = await fetchSponsors(token, login)
Check the type definition or source code for more utils available.
MIT License ยฉ 2022 Anthony Fu