<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: spoke</title>
    <description>The latest articles on DEV Community by spoke (@spoke94).</description>
    <link>https://dev.to/spoke94</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4117481%2Fff118062-c919-4f7d-a667-dc31306cb025.png</url>
      <title>DEV Community: spoke</title>
      <link>https://dev.to/spoke94</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spoke94"/>
    <language>en</language>
    <item>
      <title>I built a local CLI to regression-test Stripe webhooks with real event fixtures</title>
      <dc:creator>spoke</dc:creator>
      <pubDate>Wed, 09 Sep 2026 12:12:49 +0000</pubDate>
      <link>https://dev.to/spoke94/i-built-a-local-cli-to-regression-test-stripe-webhooks-with-real-event-fixtures-2ge8</link>
      <guid>https://dev.to/spoke94/i-built-a-local-cli-to-regression-test-stripe-webhooks-with-real-event-fixtures-2ge8</guid>
      <description>&lt;p&gt;I've been working on a small open-source CLI called &lt;strong&gt;Spoke Hooks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The idea came from a simple problem: I wanted a way to preserve real production-shaped webhook events as regression fixtures instead of relying only on generated or happy-path test payloads.&lt;/p&gt;

&lt;p&gt;The cases worth preserving are often the ones that involve retries, duplicates, slightly different payload structures, or business-specific data.&lt;/p&gt;

&lt;p&gt;So I wanted a workflow that treats real webhook events more like regression fixtures.&lt;/p&gt;

&lt;h2&gt;
  
  
  The workflow
&lt;/h2&gt;

&lt;p&gt;Install the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; @spoke-labs/hooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx spoke-hooks init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add a Stripe event payload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx spoke-hooks add stripe-event.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then record the current behavior of your webhook handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx spoke-hooks baseline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After changing your code, replay the same event:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx spoke-hooks &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the HTTP status or response body changes, the test fails.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Expected: { status: 200, body: { received: true } }
Actual:   { status: 500, body: { received: true } }

FAIL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLI exits with a non-zero status, so the same test can be used in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does right now
&lt;/h2&gt;

&lt;p&gt;The current scope is intentionally small:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stripe&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;Express&lt;/li&gt;
&lt;li&gt;local HTTP replay&lt;/li&gt;
&lt;li&gt;JSON fixtures stored in the repo&lt;/li&gt;
&lt;li&gt;HTTP status comparison&lt;/li&gt;
&lt;li&gt;response body comparison&lt;/li&gt;
&lt;li&gt;timeout / request failure handling&lt;/li&gt;
&lt;li&gt;CI-friendly exit codes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is no hosted backend, account, dashboard, or cloud storage.&lt;/p&gt;

&lt;p&gt;The fixtures stay inside your project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why baseline instead of only asserting 200?
&lt;/h2&gt;

&lt;p&gt;The part I’m experimenting with is treating the current behavior of a real event as a baseline.&lt;/p&gt;

&lt;p&gt;So instead of writing every expected response manually, the flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;real event
   ↓
current handler behavior
   ↓
baseline
   ↓
code change
   ↓
replay same event
   ↓
compare
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s basically a lightweight behavioral regression test for webhook handlers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I’m trying to learn
&lt;/h2&gt;

&lt;p&gt;The CLI itself is working and is already published on npm, but I’m more interested in whether this workflow actually fits how people maintain webhook integrations.&lt;/p&gt;

&lt;p&gt;If you work with Stripe webhooks, I’d especially like feedback on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Do you keep real webhook payloads as fixtures today?&lt;/li&gt;
&lt;li&gt;Would a baseline + replay workflow be useful in your CI?&lt;/li&gt;
&lt;li&gt;What would make this annoying to use in a real project?&lt;/li&gt;
&lt;li&gt;Is comparing status + response body enough to start with?&lt;/li&gt;
&lt;li&gt;Would production-event capture and sanitization be the valuable part, or not really?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Spoke94/spoke-hooks" rel="noopener noreferrer"&gt;Spoke Hooks on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; @spoke-labs/hooks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’m keeping the scope small for now and trying to validate the workflow before building anything bigger.&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>node</category>
      <category>opensource</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
