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.
SPONSORHUB_GITHUB_TOKEN=
SPONSORHUB_GITHUB_LOGIN=
; Patreon provider.
; Create v2 API key at https://www.patreon.com/portal/registration/register-clients
; and use the "Creator’s Access Token".
SPONSORHUB_PATREON_TOKEN=
; OpenCollective provider.
; Create an API key at https://opencollective.com/applications
SPONSORHUB_OPENCOLLECTIVE_KEY=
; and provide the ID, slug or GitHub handle of your account.
SPONSORHUB_OPENCOLLECTIVE_ID=
; or
SPONSORHUB_OPENCOLLECTIVE_SLUG=
; or
SPONSORHUB_OPENCOLLECTIVE_GH_HANDLE=
; If it is a personal account, set it to `person`. Otherwise not set or set to `collective`
SPONSORHUB_OPENCOLLECTIVE_TYPE=
Only one provider is required to be configured.
Run:
npx SPONSORHUB
Example Setup | GitHub Actions Setup | Generated SVG
Create sponsorhub.config.js
file with:
import { defineConfig, presets } from 'SPONSORHUB'
export default defineConfig({
// Providers configs
github: {
login: 'nyxb',
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 SponsorHub programmatically:
import { fetchSponsors } from 'sponsorhub'
const sponsors = await fetchSponsors(token, login)
Check the type definition or source code for more utils available.
MIT License © 2023 Dennis Ollhoff aka nyxb