<?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: Denver Shan</title>
    <description>The latest articles on DEV Community by Denver Shan (@denver_shan).</description>
    <link>https://dev.to/denver_shan</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%2F229137%2F8716bdf7-9a9f-4f36-a989-244e7261a8b9.jpg</url>
      <title>DEV Community: Denver Shan</title>
      <link>https://dev.to/denver_shan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/denver_shan"/>
    <language>en</language>
    <item>
      <title>I got tired of waiting for APIs to be ready, so I built a mock server that runs on my laptop</title>
      <dc:creator>Denver Shan</dc:creator>
      <pubDate>Thu, 12 Nov 2026 07:03:59 +0000</pubDate>
      <link>https://dev.to/denver_shan/i-got-tired-of-waiting-for-apis-to-be-ready-so-i-built-a-mock-server-that-runs-on-my-laptop-53m6</link>
      <guid>https://dev.to/denver_shan/i-got-tired-of-waiting-for-apis-to-be-ready-so-i-built-a-mock-server-that-runs-on-my-laptop-53m6</guid>
      <description>&lt;p&gt;Every project I work on hits the same wall: the front end is ready, but the API it calls isn't. Or it is, but it's slow, shared with five other teams, or it only fails in production. So I'd write a quick fake server, throw it away, and write another one next month.&lt;/p&gt;

&lt;p&gt;At some point I stopped and built the thing I kept rebuilding. It's called &lt;strong&gt;Zyvra&lt;/strong&gt;, and it's a mock API server that runs on your own computer.&lt;/p&gt;

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

&lt;p&gt;You create a mock service (it listens on its own local port), add an endpoint like &lt;code&gt;GET /products&lt;/code&gt;, and give it a response. Your app points at it instead of the real API. That part is easy and every tool does it. The parts I wanted were these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rules.&lt;/strong&gt; The answer can depend on the request: path, query, headers or body. &lt;code&gt;amount &amp;gt; 1000&lt;/code&gt; returns "in review", a known test card returns "declined".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stored state.&lt;/strong&gt; &lt;code&gt;POST /orders&lt;/code&gt; creates an order and &lt;code&gt;GET /orders/{id}&lt;/code&gt; finds it again, even after a restart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failures on purpose.&lt;/strong&gt; Slow responses, 503s, dropped connections, rate limits with &lt;code&gt;Retry-After&lt;/code&gt;. You can apply them to every 3rd request, or only when a request sends a header like &lt;code&gt;x-chaos: slow&lt;/code&gt;, so a failing test fails the same way every time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhooks.&lt;/strong&gt; After an endpoint answers, it can call another service two seconds later, like the real thing does.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAPI import.&lt;/strong&gt; Point it at a spec and you get an endpoint per operation with the spec's examples. When the spec changes you re-import, and the rules you added aren't touched.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also has an API client and a test runner built in, so the same project works for poking at an API by hand and for running checks in CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://www.zyvra.dev/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
zyvra init my-project
zyvra up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(On Windows: &lt;code&gt;irm https://www.zyvra.dev/install.ps1 | iex&lt;/code&gt;.) It opens a dashboard in your browser. Nothing leaves your machine, there's no account, and a project is just YAML files in a folder, so it goes into Git with your code.&lt;/p&gt;

&lt;p&gt;In CI it's one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;zyvra run &lt;span class="s2"&gt;"Checkout flow"&lt;/span&gt; --with-mocks --junit report.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exit code is 1 if anything fails, and the JUnit file shows up as test results in GitHub Actions or GitLab CI.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it's honest about its limits
&lt;/h2&gt;

&lt;p&gt;It's one person on one computer. There are no cloud workspaces or team permissions, and sharing happens through Git. If you want a public URL for a mock that people outside your network can hit, a hosted service is a better fit. And it's new, so expect rough edges.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you want more
&lt;/h2&gt;

&lt;p&gt;I wrote short guides for the things people usually search for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.zyvra.dev/mock-api" rel="noopener noreferrer"&gt;Mock API server on your own computer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zyvra.dev/mock-api-from-openapi" rel="noopener noreferrer"&gt;Create a mock API from an OpenAPI spec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zyvra.dev/api-fault-injection" rel="noopener noreferrer"&gt;Test API failures: slow, flaky and down&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zyvra.dev/api-testing-in-ci" rel="noopener noreferrer"&gt;Run API tests in GitHub Actions and GitLab CI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.zyvra.dev/mock-api-tools" rel="noopener noreferrer"&gt;Mock API tools compared&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd really like to hear what breaks, or what you'd want a mock server to do that none of them do. Tell me in the comments.&lt;/p&gt;

</description>
      <category>api</category>
      <category>testing</category>
      <category>webdev</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
