frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Stripe-no-webhooks – Sync your Stripe data to your Postgres DB

https://github.com/pretzelai/stripe-no-webhooks
20•prasoonds•2h ago
Hey HN, stripe-no-webhooks is an open-source library that syncs your Stripe payments data to your own Postgres database: https://github.com/pretzelai/stripe-no-webhooks.

Here's a demo video: https://youtu.be/cyEgW7wElcs

Why is this useful? (1) You don't have to figure out which webhooks you need or write listeners for each one. The library handles all of that. This follows the approach of libraries like dj-stripe in the Django world (https://dj-stripe.dev/). (2) Stripe's API has a 100 rpm rate limit. If you're checking subscription status frequently or building internal tools, you'll hit it. Querying your own Postgres doesn't have this problem. (3) You can give an AI agent read access to the stripe.* schema to debug payment issues—failed charges, refunds, whatever—without handing over Stripe dashboard access. (4) You can join Stripe data with your own tables for custom analytics, LTV calculations, etc.

It creates a webhook endpoint in your Stripe account to forward webhooks to your backend where a webhook listener stores all the data into a new stripe.* schema. You define your plans in TypeScript, run a sync command, and the library takes care of creating Stripe products and prices, handling webhooks, and keeping your database in sync. We also let you backfill your Stripe data for existing accounts.

It supports pre-paid usage credits, account wallets and usage-based billing. It also lets you generate a pricing table component that you can customize. You can access the user information using the simple API the library provides:

  billing.subscriptions.get({ userId });
  billing.credits.consume({ userId, key: "api_calls", amount: 1 });
  billing.usage.record({ userId, key: "ai_model_tokens_input", amount: 4726 });
Effectively, you don't have to deal with either the Stripe dashboard or the Stripe API/SDK any more if you don't want to. The library gives you a nice abstraction on top of Stripe that should cover ~most subscription payment use-cases.

Let's see how it works with a quick example. Say you have a billing plan like Cursor (the IDE) used to have: $20/mo, you get 500 API completions + 2000 tab completions, you can buy additional API credits, and any additional usage is billed as overage.

You define your plan in TypeScript:

  {
    name: "Pro",
    description: "Cursor Pro plan",
    price: [{ amount: 2000, currency: "usd", interval: "month" }],
    features: {
      api_completion: {
        pricePerCredit: 1,              // 1 cent per unit
        trackUsage: true,               // Enable usage billing
        credits: { allocation: 500 },
        displayName: "API Completions",
      },
      tab_completion: {
        credits: { allocation: 2000 },
        displayName: "Tab Completions",
      },
    },
  }
Then on the CLI, you run the `init` command which creates the DB tables + some API handlers. Run `sync` to sync the plans to your Stripe account and create a webhook endpoint. When a subscription is created, the library automatically grants the 500 API completion credits and 2000 tab completion credits to the user. Renewals and up/downgrades are handled sanely.

Consume code would look like this:

  await billing.credits.consume({
    userId: user.id,
    key: "api_completion",
    amount: 1,
  });
And if they want to allow manual top-ups by the user:

  await billing.credits.topUp({
    userId: user.id,
    key: "api_completion",
    amount: 500,     // buy 500 credits, charges $5.00
  });
Similarly, we have APIs for wallets and usage.

This would be a lot of work to implement by yourself on top of Stripe. You need to keep track of all of these entitlements in your own DB and deal with renewals, expiry, ad-hoc grants, etc. It's definitely doable, especially with AI coding, but you'll probably end up building something fragile and hard to maintain.

This is just a high-level overview of what the library is capable of. It also supports seat-level credits, monetary wallets (with micro-cent precision), auto top-ups, robust failure recovery, tax collection, invoices, and an out-of-the-box pricing table.

I vibe-coded a little toy app for testing: https://snw-test.vercel.app. There's no validation so feel free to sign up with a dummy email, then subscribe to a plan with a test card: 4242 4242 4242 4242, any future expiry, any 3-digit CVV.

Screenshot: https://imgur.com/a/demo-screenshot-Rh6Ucqx

Feel free to try it out! If you end up using this library, please report any bugs on the repo. If you're having trouble / want to chat, I'm happy to help - my contact is in my HN profile.

Comments

prasoonds•1h ago
Hi HN, library creator here.

I've linked a demo app linked in the post to try this out:

<https://snw-test.vercel.app>

It uses Clerk for auth and Clerk seems to be having problems:

<https://downdetector.com/status/clerk-inc/>

So if you're having any issues loading the app, you may have to wait a bit!

hbcondo714•1h ago
Thanks for sharing this! I had done a PWA that displays some revenue forecasting[1] based on Stripe Subscriptions but I found their APIs can be slow[2]. Having that data synced up in a db sounds like a good enhancement so will definitely look into this more.

[1] https://github.com/hbcondo/revenut-app

[2] https://github.com/stripe/stripe-dotnet/issues/2284#issuecom...

prasoonds•1h ago
Yes, this is one of the bigger use-cases for this library. Lots of folks want custom analytics on their Stripe data and this provides a nice way to do just that.

Let me know how you find it! Happy to implement any fixes and PRs welcome!

tonyx•1h ago
This is really cool. How do you handle changes of pricing with something like this?
prasoonds•1h ago
Great question. Basically, you would change your billing.config.ts and update the price.

Then, you run the `sync` command - it matches prices by a composite key: `productId:amount:currency:interval`. Since the amount has changed, it won't find a match for the old price. So, it will create a new price in Stripe and update the Price ID. Your new customers automatically get the new price in the Pricing Table component.

Your old subscriptions stay on the old price - which is still active in Stripe. We haven't added support for migrating these customers to the new price yet but it's in the roadmap!

I would like to add that we've tried making the porcelain / user API for the library to best fit today's commonly uses SaaS pricing models so most actions usually do what you would expect (like this price update) but, it's hard to strike a balance between customizability and the _just works_ factor.

The Singularity will occur on a Tuesday

https://campedersen.com/singularity
321•ecto•2h ago•186 comments

The Switch to Linux and the Beginning of My Self-Hosting Journey

https://hazemkrimi.tech/blog/linux-self-hosting-journey/
28•kingcrimson1000•1h ago•0 comments

Show HN: Showboat and Rodney, so agents can demo what they've built

https://simonwillison.net/2026/Feb/10/showboat-and-rodney/
54•simonw•2h ago•27 comments

Simplifying Vulkan one subsystem at a time

https://www.khronos.org/blog/simplifying-vulkan-one-subsystem-at-a-time
163•amazari•6h ago•73 comments

Launch HN: Livedocs (YC W22) – An AI-native notebook for data analysis

https://livedocs.com
27•arsalanb•1h ago•7 comments

Mathematicians disagree on the essential structure of the complex numbers

https://www.infinitelymore.xyz/p/complex-numbers-essential-structure
78•FillMaths•3h ago•74 comments

Show HN: Rowboat – AI coworker that turns your work into a knowledge graph (OSS)

https://github.com/rowboatlabs/rowboat
60•segmenta•3h ago•16 comments

Clean-room implementation of Half-Life 2 on the Quake 1 engine

https://code.idtech.space/fn/hl2
258•klaussilveira•8h ago•50 comments

Ex-GitHub CEO launches a new developer platform for AI agents

https://entire.io/blog/hello-entire-world/
108•meetpateltech•4h ago•91 comments

China's Data Center Boom: A View from Zhangjiakou (2025)

https://sinocities.substack.com/p/chinas-data-center-boom-a-view-from
8•fzliu•41m ago•2 comments

Markdown CLI viewer with VI keybindings

https://github.com/taf2/mdvi
24•taf2•2h ago•7 comments

Qwen-Image-2.0: Professional infographics, exquisite photorealism

https://qwen.ai/blog?id=qwen-image-2.0
292•meetpateltech•10h ago•145 comments

Google handed ICE student journalist's bank and credit card numbers

https://theintercept.com/2026/02/10/google-ice-subpoena-student-journalist/
296•lehi•2h ago•114 comments

Show HN: Stripe-no-webhooks – Sync your Stripe data to your Postgres DB

https://github.com/pretzelai/stripe-no-webhooks
20•prasoonds•2h ago•5 comments

The Evolution of Bengt Betjänt

https://andonlabs.com/blog/evolution-of-bengt
8•lukaspetersson•16h ago•0 comments

Show HN: I made paperboat.website, a platform for friends and creativity

https://paperboat.website/home/
35•yethiel•3h ago•22 comments

Oxide raises $200M Series C

https://oxide.computer/blog/our-200m-series-c
405•igrunert•5h ago•203 comments

Frontier AI agents violate ethical constraints 30–50% of time, pressured by KPIs

https://arxiv.org/abs/2512.20798
501•tiny-automates•16h ago•324 comments

Show HN: I built a macOS tool for network engineers – it's called NetViews

https://www.netviews.app
123•n1sni•14h ago•39 comments

A brief history of oral peptides

https://seangeiger.substack.com/p/a-brief-history-of-oral-peptides
14•odedfalik•22h ago•4 comments

Show HN: Multimodal perception system for real-time conversation

https://raven.tavuslabs.org
10•mert_gerdan•1h ago•1 comments

I started programming when I was 7. I'm 50 now and the thing I loved has changed

https://www.jamesdrandall.com/posts/the_thing_i_loved_has_changed/
382•jamesrandall•4h ago•334 comments

Parse, Don't Validate (2019)

https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/
182•shirian•5h ago•117 comments

Competition is not market validation

https://www.ablg.io/blog/competition-is-not-validation
5•tonioab•3h ago•0 comments

Show HN: Deadlog – almost drop-in mutex for debugging Go deadlocks

https://github.com/stevenctl/deadlog
6•dirteater_•2h ago•0 comments

Semaglutide improves knee osteoarthritis independant of weight loss

https://www.cell.com/cell-metabolism/abstract/S1550-4131(26)00008-2
141•randycupertino•3h ago•102 comments

Europe's $24T Breakup with Visa and Mastercard Has Begun

https://europeanbusinessmagazine.com/business/europes-24-trillion-breakup-with-visa-and-mastercar...
399•NewCzech•8h ago•364 comments

ClawHub

https://clawhub.ai/
34•druther•2h ago•27 comments

Vercel's CEO offers to cover expenses of 'Jmail'

https://www.threads.com/@qa_test_hq/post/DUkC_zjiGQh
177•vinnyglennon•5h ago•125 comments

Redefining Go Functions

https://pboyd.io/posts/redefining-go-functions/
60•todsacerdoti•5h ago•16 comments