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
16•prasoonds•1h 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•53m 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•37m 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•47m ago
This is really cool. How do you handle changes of pricing with something like this?
prasoonds•27m 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.

I want a phone I can fix, and Fairphone's growth shows the world does too

https://www.androidcentral.com/phones/i-want-a-phone-i-can-actually-fix-and-fairphones-record-gro...
1•NoboruWataya•28s ago•0 comments

FBI releases surveillance video in Guthrie case recovered from Nest cam back end

https://twitter.com/FBIDirectorKash/status/2021281103454072983/photo/1
1•tokyobreakfast•1m ago•0 comments

Jeffrey Epstein's digital cleanup crew

https://www.theverge.com/report/876081/jeffrey-epstein-files-seo-google-digital-footprint-emails
3•imartin2k•2m ago•0 comments

Real-time Reddit sentiment tracker for stock trading

https://www.wsbsentiment.com/
1•shawnmfarnum•2m ago•1 comments

Trump's War on History

https://www.motherjones.com/politics/2026/02/america-freedom-task-force-250-trump-anniversary-his...
2•leotravis10•2m ago•0 comments

Quitting .NET after 22 years

https://www.thatsoftwaredude.com/content/14253/quitting-dot-net-after-22-years
1•Waltz1•3m ago•0 comments

Is human collaboration the answer to the skill formation risks by AI?

https://www.gethopp.app/blog/pair-prompting
1•iparaskev•7m ago•0 comments

Microsoft Should Watch the Expanse

https://idiallo.com/blog/microsoft-should-watch-the-expanse
1•nomdep•7m ago•0 comments

Show HN: Cosmic CLI – Build, deploy, and manage apps from your terminal with AI

https://github.com/cosmicjs/cli
1•tonyspiro•8m ago•0 comments

AgentLogs: Open-source observability for AI coding agents

https://github.com/agentlogs/agentlogs
1•tosh•8m ago•0 comments

WordCatcher

https://wordwalker.ca/games/word-catcher/
1•petedrinnan•9m ago•0 comments

Breakthrough pancreatic cancer therapy blocks tumor resistance in mice

https://www.pnas.org/doi/10.1073/pnas.2523039122
1•DpdC•9m ago•0 comments

Show HN: Multimodal perception system for real-time conversation

https://raven.tavuslabs.org
2•mert_gerdan•11m ago•1 comments

Heuristics for lab robotics, and where its future may go

https://www.owlposting.com/p/heuristics-for-lab-robotics-and-where
1•abhishaike•11m ago•0 comments

Show HN: Traction – Security readiness framework for scaling SaaS teams

https://traction.fyi
1•ERROR_0x06•12m ago•0 comments

Crossview v3.5.0 – New auth modes (header / none), no DB required for proxy auth

https://github.com/corpobit/crossview
1•moeidheidari•12m ago•1 comments

Show HN: Tasty A.F. – Turn Any Online Recipe into a 3x5 Notecard

https://tastyaf.recipes
1•adammfrank•13m ago•0 comments

Photoswitching for chromocontrol of TRPC4/5 channel functions in live tissues

https://www.nature.com/articles/s41589-025-02085-x
2•PaulHoule•13m ago•0 comments

This feels so reminiscent of the whimsical times in tech

https://www.tryroro.com/code
2•songqipu•15m ago•1 comments

Hello, Dada

https://smallcultfollowing.com/babysteps/blog/2026/02/09/hello-dada/
2•ibobev•16m ago•0 comments

Expectation and Copysets

https://buttondown.com/jaffray/archive/expectation-and-copysets/
2•ibobev•16m ago•0 comments

LLMCode Lab – Compare up to 5 LLMs side-by-side, then fuse the best answers

https://LLMCode.ai
2•cmeshare•17m ago•2 comments

BurgerDisk Tests

https://www.colino.net/wordpress/archives/2026/02/08/burgerdisk-tests/
2•ibobev•17m ago•0 comments

In praise of the dad joke (2023)

https://wit.substack.com/p/the-familiar-patter-of-the-paterfamilias
2•NaOH•18m ago•0 comments

Looking for feedback from someone who hired technical freelancers earlier

2•yusufhgmail•18m ago•0 comments

Update on Update [video]

https://www.youtube.com/watch?v=M-ZLz8Wg34s
2•tosh•18m ago•0 comments

USDA's reputation suffers after revisions in US corn acres

https://www.reuters.com/business/usdas-reputation-suffers-after-massive-revisions-us-corn-acres-2...
3•DustinEchoes•19m ago•0 comments

Updating the Expiring Secure Boot Certificates Is Sure to Go Without a Hitch

https://pcper.com/2026/02/updating-the-expiring-secure-boot-certificates-is-sure-to-go-without-a-...
2•speckx•19m ago•0 comments

'We feel it in our bones': Can a machine ever love you?

https://www.bbc.com/future/article/20260209-can-a-machine-ever-love-you
4•devonnull•21m ago•0 comments

Google hit by European publishers' complaint to EU over AI Overviews

https://www.reuters.com/world/european-publishers-council-files-eu-antitrust-complaint-about-goog...
4•thm•22m ago•0 comments