Tested TypeScript modules for webhooks, idempotent APIs and AI agent payments.

The parts of your application you don't want to build twice. AI can write the code; you still have to trust it. Each module ships with tests for the failure cases (duplicates, retries, crashes, outages) run against a real PostgreSQL, plus docs, a changelog and a threat model. You get the source, you read it, you own it.

The modules

Featured

Agent Payments

Charge AI agents per request over HTTP 402: MPP (Stripe) and x402 on one route, charged exactly once, refunded when your handler fails.

Agents can now pay per API call: you answer 402, they pay, they retry with proof. The SDKs give you the 402. You still own what happens around the money: the agent that retries after a lost response, the duplicate request, the handler that fails after the card was charged, the crash between charging and answering. This is that layer, for both MPP (Stripe) and x402.

  • One 402 for both protocols: MPP with Stripe Shared Payment Tokens, and x402
  • Charged exactly once per payment; retries get the stored response
  • Refunded or never settled when your handler fails; crash-safe ledger
  • A paying fetch for your agents, with per-request and total budgets
Read the full details · $49One-time · v1.0.0 · all v1.x updates included
const paywall = createPaywall({
  store: new PostgresStore(pool),
  mpp: { secret, methods: [stripeMethod(stripe)] },
  x402: { facilitator, accepts: [usdcOnBase] },
});

export const POST = paywall.protect(
  { price: { amount: "0.02", currency: "usd" } },
  async (req, { payment }) => {
    // runs once per payment
    return Response.json(await work(req));
  });

// agent side: never more than $5
createPayingFetch({ budget, mpp: { stripe } });

Reliable Webhooks

Receive webhooks without losing, duplicating or double-processing them.

A webhook handler looks like twenty lines until the same Stripe event arrives twice, your database blips during a deploy, or a worker is killed halfway through fulfilling an order. This is the part you would otherwise design, write and test yourself: verify, store, acknowledge, process, retry, dead-letter.

  • Signature verification for Stripe, GitHub and any HMAC scheme
  • Idempotency enforced by the database, even under concurrent duplicates
  • Retries with backoff, crash recovery, dead letters and replay
  • Zero runtime dependencies, strict TypeScript, PostgreSQL store included
Read the full details · $49One-time · v1.0.1 · all v1.x updates included
const receiver = createWebhookReceiver({
  provider: stripeProvider({ secret }),
  store: new PostgresStore(pool),
  handlers: {
    "checkout.session.completed":
      async ({ event, idempotencyKey }) => {
        // runs once per event
        await grantAccess(event, idempotencyKey);
      },
  },
});

export const POST = (r: Request) => receiver.handle(r);
await receiver.processDue(); // cron: retries

Idempotent Requests

Make POST endpoints safe to retry: no double charges, no duplicate orders.

Your endpoint charges the card, then the connection drops before the response arrives. The client retries, and your customer pays twice. Double-clicks, mobile networks and load balancer retries do the same. This is the Idempotency-Key handling Stripe built into its API, for yours: lock the key, run once, store the answer, replay it to every retry.

  • Handler runs once per key; retries get the stored response
  • Concurrent duplicates get 409; a key reused for a different request gets 422
  • Keys scoped per user, crash recovery with leases, fails closed
  • Client helper that retries with the same key; zero runtime dependencies
Read the full details · $39One-time · v1.0.0 · all v1.x updates included
export async function POST(request: Request) {
  const user = await requireUser(request);
  return idempotency.handle(
    request, { scope: user.id },
    async (req, { idempotencyKey }) => {
      // runs once per key
      const order =
        await createOrder(req, idempotencyKey);
      return Response.json(order, { status: 201 });
    });
}

// browser: same key on every retry
await idempotentFetch("/api/orders", init, { key });

Outbound Webhooks

Send webhooks to your customers like Stripe does: signed, retried, logged and safe to point anywhere.

When customers ask for webhooks, you inherit a queue, a retry policy, signatures they can verify, secret rotation, a delivery log for support tickets, and an HTTP client that strangers can point at your internal network. Hosted services charge monthly for this. Here it is as code you own, on your Postgres.

  • Standard Webhooks signatures, fan-out, retries over ~3 days
  • SSRF protection on save, before each attempt and inside DNS resolution
  • Auto-disable dead endpoints, zero-downtime secret rotation, encrypted secrets
  • Delivery log, replay, transactional outbox and a ready-made dashboard API
Read the full details · $49One-time · v1.0.0 · all v1.x updates included
const webhooks = createWebhookSender({
  store: new PostgresStore(pool),
  secretCipher: aesGcmCipher(key),
  onEndpointDisabled: emailCustomer,
});

// in your transaction: sent iff it commits
await webhooks.send(
  { tenantId, type: "invoice.paid", data },
  { store: store.using(tx) });

await webhooks.processDue(); // cron: deliver + retry
// customer dashboard API, behind your auth
api.handle(request, { tenantId });

Why not just prompt it, or copy a snippet?

Generating code is cheap now. Knowing it will hold up at 3am during an outage is not.

A model writes the happy path

It produces a webhook handler or a payment endpoint in seconds. It won't tell you what happens when the same event arrives twice, when a client retries a charge after a timeout, or when your database is down mid-request. Our modules ship with tests for exactly those cases.

Snippets don't get maintained

Every module has a version, a changelog, stated Node and framework support, and an update policy. When something changes you get a new release, not a stale gist.

You can inspect it before you pay

Product pages list what's in the package, what it requires, how failures are handled and what was checked for security. The engineering is the sales pitch.

Guides

How each problem works and what breaks in production, with sources. Useful whether or not you buy anything.

Use it from your coding agent

Give Claude Code, Cursor or any MCP client the catalog: it can search the modules against your problem, read their full documentation and hand you a purchase link. Read-only, no account needed.

claude mcp add --transport http softreuse https://softreuse.com/mcp

Other clients: add https://softreuse.com/mcp as a Streamable HTTP server. Without MCP, point your assistant at llms.txt, llms-full.txt or catalog.json.

Every module includes

  • Full TypeScript source, strict mode
  • Automated test suite you can run
  • Runnable examples
  • Install, configure and troubleshoot docs
  • Changelog and semantic versions
  • Threat model and secure defaults
  • Commercial licence for your own projects
  • All updates within the major version
  • 14-day refund if it doesn't work as documented

Read the Softreuse Product Standard →

Who it's for

A good fit

  • Developers and small teams shipping a SaaS on Node and TypeScript
  • You'd rather read a few hundred lines of tested code than design this yourself
  • You want to own the source, not add a hosted dependency

Not a fit

  • You need a hosted service or a dashboard
  • Your backend isn't JavaScript or TypeScript
  • You want a catalog of dozens of modules: we ship few, done properly

Pricing

Agent Payments

$49 $79Launch price, ends Jan 9, 2027 once, excl. VAT/tax

No subscription. Spend $49 instead of building and testing this infrastructure yourself. Includes every v1.x release, the commercial licence for your own projects, and a 14-day refund if it doesn't work as documented.

See what's included

Reliable Webhooks

$49 $79Launch price, ends Jan 9, 2027 once, excl. VAT/tax

No subscription. Spend $49 instead of building and testing this infrastructure yourself. Includes every v1.x release, the commercial licence for your own projects, and a 14-day refund if it doesn't work as documented.

See what's included

Idempotent Requests

$39 $59Launch price, ends Jan 9, 2027 once, excl. VAT/tax

No subscription. Spend $39 instead of building and testing this infrastructure yourself. Includes every v1.x release, the commercial licence for your own projects, and a 14-day refund if it doesn't work as documented.

See what's included

Outbound Webhooks

$49 $69Launch price, ends Jan 9, 2027 once, excl. VAT/tax

No subscription. Spend $49 instead of building and testing this infrastructure yourself. Includes every v1.x release, the commercial licence for your own projects, and a 14-day refund if it doesn't work as documented.

See what's included

Questions

Why not just ask an AI to write this?

You can, and for many things you should. The hard part isn't the first draft, it's the cases nobody prompts for: the same request arriving ten times at once, a process killed halfway through, a database outage at the wrong moment. Every module comes with tests for those cases, run against a real PostgreSQL database, plus a written threat model. You still review the code. You just start from something that has already been tested against production failure modes.

What exactly do I get after paying?

A .zip with the full TypeScript source, tests, runnable examples, SQL migration, architecture and security docs, a changelog and the licence. It's available in your Softreuse account the moment Stripe confirms payment, and you can download it again any time.

What does the licence allow?

Use it in unlimited projects you or your company own, commercial or not, and modify it freely. You can't resell or redistribute it as a standalone product or library. The full text is on the product page and inside the package.

Which versions does my purchase cover?

Every release of the major version you bought. Buy v1 and you get all v1.x updates (fixes and backwards-compatible features) for free. A future v2 with breaking changes would be a separate paid release; v1 stays yours either way.

Will it work with my stack?

Every module targets Node.js 20 or newer and TypeScript, has zero runtime dependencies and uses Web-standard Request/Response, so it works in Next.js route handlers, Hono, Bun and Deno, and in node:http or Express through an included adapter. Modules that persist state ship a PostgreSQL store; any other database works by implementing a small store interface that comes with a contract test suite. They are not for non-JavaScript runtimes.

What if it doesn't work for me?

Email support@softreuse.com. If it doesn't work as documented and we can't fix it, you get a full refund within 14 days of purchase. No forms, no hoops.

Is checkout secure? Do you see my card?

Payment happens on Stripe's hosted checkout page. Your card details never touch Softreuse servers. Access is granted only after Stripe confirms the payment to us by a signed server-to-server message.

Do you charge VAT or sales tax?

Listed prices exclude VAT and sales tax. Where it applies, tax is calculated at checkout from your billing address and added to the price before you pay. If you buy as a business, you can enter your company name and VAT number at checkout. Stripe sends a receipt and an invoice for every purchase.

Stop re-solving the boring parts.

Read the code description, the security notes and the changelog before you decide.

Browse the modules