A simple and lightweight community-made Bun-first client for the Buy Me A Coffee API with Node.js compatibility.
- Bun-first developer experience
- TypeScript typings included
- Supporters, subscriptions, and extras endpoints
- Pagination and subscription status filters
- By-id lookup methods for documented read endpoints
- Supports Bun and Node.js
bun add buymeacoffee.jsnpm install buymeacoffee.jsimport BMC from "buymeacoffee.js";
const client = new BMC(process.env.BMC_ACCESS_TOKEN!);
const supporters = await client.Supporters();
const activeSubscriptions = await client.Subscriptions({ status: "active" });
const supporter = await client.Supporter(245731);
const extra = await client.Extra(30);import BMC from "buymeacoffee.js";
const client = new BMC(process.env.BMC_ACCESS_TOKEN!);
const supporters = await client.Supporters();
const supportersPageTwo = await client.Supporters({ page: 2 });
const supporter = await client.Supporter(245731);
const subscriptions = await client.Subscriptions();
const activeSubscriptions = await client.Subscriptions({ status: "active" });
const inactiveSubscriptionsPageTwo = await client.Subscriptions({
page: 2,
status: "inactive",
});
const subscription = await client.Subscription(10647);
const extras = await client.Extras();
const extrasPageTwo = await client.Extras({ page: 2 });
const extra = await client.Extra(30);import BMC, { BMCError } from "buymeacoffee.js";
const client = new BMC(process.env.BMC_ACCESS_TOKEN!);
try {
await client.Subscriptions({ status: "active" });
} catch (error) {
if (error instanceof BMCError) {
console.error(error.status, error.endpoint, error.responseData);
}
}| Method | Description |
|---|---|
Supporters() |
Get the first page of supporters |
Supporters({ page }) |
Get a specific supporters page |
Supporter(id) |
Get a supporter by ID |
Subscriptions() |
Get the first page of subscriptions |
Subscriptions({ page, status }) |
Filter subscriptions by page and status |
Subscription(id) |
Get a subscription by ID |
Extras() |
Get the first page of extras |
Extras({ page }) |
Get a specific extras page |
Extra(id) |
Get an extra purchase by ID |
This project now uses Bun as the primary package manager, test runner, and local workflow.
bun install
bun run lint
bun test
bun run buildIf you need a Node.js-only install for compatibility checks, npm install and npm run build still work.
The published package now includes declaration files for TypeScript consumers.
Check out the official and complete documentation here.
Join to the official Buy Me a Coffee Discord community server!
Join to my growing tech community and get the latest updates!
Contributions are welcome, create a pull request to this repo and I will review
your code. Please consider to submit your pull request to the dev branch. Thank you!
Read the project's contributing guide for more info.
For any questions, suggestions, ideas, or simply you want to share your experience in using this project, feel free to share and discuss it to the community!
Please report any issues and bugs by creating a new issue here, also make sure you're reporting an issue that doesn't exist. Any help to improve the project would be appreciated. Thanks! πβ¨
Like this project? Leave a star! βββββ
Want to support my work and get some perks? Become a sponsor! π
Or, you just love what I do? Buy me a coffee! β
Recognized my open-source contributions? Nominate me as GitHub Star! π«
Read the project's code of conduct.
This project is licensed under MIT License.
This project is created by Waren Gonzaga, with the help of awesome contributors.
π»πβ by Waren Gonzaga | YHWH π - Without Him, none of this exists, even me.

