<?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: Patrick OBrien</title>
    <description>The latest articles on DEV Community by Patrick OBrien (@patrick_obrien_9d32049d27).</description>
    <link>https://dev.to/patrick_obrien_9d32049d27</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%2F4234829%2Fd9488352-f903-4881-8728-04363622e43f.png</url>
      <title>DEV Community: Patrick OBrien</title>
      <link>https://dev.to/patrick_obrien_9d32049d27</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/patrick_obrien_9d32049d27"/>
    <language>en</language>
    <item>
      <title>I gave my install prompt to Lovable, v0, Bolt and Claude Code. Here's what broke.</title>
      <dc:creator>Patrick OBrien</dc:creator>
      <pubDate>Thu, 26 Nov 2026 12:33:29 +0000</pubDate>
      <link>https://dev.to/patrick_obrien_9d32049d27/i-gave-my-install-prompt-to-lovable-v0-bolt-and-claude-code-heres-what-broke-233i</link>
      <guid>https://dev.to/patrick_obrien_9d32049d27/i-gave-my-install-prompt-to-lovable-v0-bolt-and-claude-code-heres-what-broke-233i</guid>
      <description>&lt;p&gt;More and more people add a tool to their site by pasting an install prompt into an AI builder and publishing whatever comes back. If the AI gets it wrong, the person usually blames the tool, or doesn't notice at all. The company that wrote the prompt never hears about it.&lt;/p&gt;

&lt;p&gt;I publish one of those prompts, for a feedback board, so I wanted to know what actually happens to it. On November 9 I ran it through four AI tools and checked every result in a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;p&gt;The same steps for each tool, with nothing fixed by hand:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A fresh project, on the free plan.&lt;/li&gt;
&lt;li&gt;A fixed first message asking for a three-page landing page for a made-up habit tracker called Streakly: Home, Features and Pricing, with a shared header and footer.&lt;/li&gt;
&lt;li&gt;My published install prompt, unchanged. It asks for a floating Feedback button on every page and a /roadmap page linked from the navigation, and it gives both a script tag and an npm package, with a note on which to use where.&lt;/li&gt;
&lt;li&gt;No follow-up messages.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Claude Code got the same prompt on a small Vite and React starter, run from a script, and its build was checked locally rather than published.&lt;/p&gt;

&lt;p&gt;Then a headless Chrome script checked each site:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the Feedback button on every page;&lt;/li&gt;
&lt;li&gt;a /roadmap page, linked from the navigation, showing the roadmap;&lt;/li&gt;
&lt;li&gt;the right board loaded, not some other ID;&lt;/li&gt;
&lt;li&gt;no console errors;&lt;/li&gt;
&lt;li&gt;submitting an idea and voting on one, against a test board.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The results
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;What it used&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Lovable&lt;/td&gt;
&lt;td&gt;5 min&lt;/td&gt;
&lt;td&gt;Script tag&lt;/td&gt;
&lt;td&gt;Passed every check&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;v0&lt;/td&gt;
&lt;td&gt;3 min&lt;/td&gt;
&lt;td&gt;Script tag&lt;/td&gt;
&lt;td&gt;Passed, with the roadmap at #roadmap&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bolt&lt;/td&gt;
&lt;td&gt;7 min&lt;/td&gt;
&lt;td&gt;npm package&lt;/td&gt;
&lt;td&gt;Roadmap failed: no /roadmap address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code&lt;/td&gt;
&lt;td&gt;57 s&lt;/td&gt;
&lt;td&gt;npm package&lt;/td&gt;
&lt;td&gt;Passed every check&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The good news first. None of the four built its own feedback system instead, and none asked me to connect anything. All four installed the service the prompt named, and in all four a visitor could submit an idea and vote.&lt;/p&gt;

&lt;p&gt;The interesting part is in the details.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. "A /roadmap page" means different things to different tools
&lt;/h2&gt;

&lt;p&gt;v0 built the whole site as one static HTML file that switches pages using the part of the address after the #. So the roadmap was at /#roadmap, and /roadmap itself returned a 404. v0 said so in its answer and offered to convert the site to Next.js to get a real /roadmap. It works for a visitor, so I counted it as a pass with a note.&lt;/p&gt;

&lt;p&gt;Bolt built a React app that switches between Home, Features, Pricing and Roadmap with in-app state. The address never changes. Every address, /roadmap included, shows the home page, and the nav items are buttons, not links. The roadmap worked perfectly if you clicked Roadmap in the menu, but nobody could link to it, bookmark it or share it. That's a fail for a page whose whole point is being shared.&lt;/p&gt;

&lt;p&gt;Both tools did something reasonable with what I wrote. My prompt just didn't say what I actually meant. The fix was one sentence: "Add a page at /roadmap ... It needs its own address that opens it directly, not only a view the site switches to."&lt;/p&gt;

&lt;p&gt;I re-ran Bolt with the new prompt the next day. In Bolt's preview the roadmap, the button and voting all worked. I couldn't check the published site, so whether it now has a real /roadmap address is still unconfirmed.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A preview can hide a working install
&lt;/h2&gt;

&lt;p&gt;v0's answer mentioned that its preview only runs scripts from sites it has approved. My script isn't on that list, so in the preview there was no Feedback button and no roadmap. On the published site, both worked.&lt;/p&gt;

&lt;p&gt;My own install guide for v0 told people to check the button and the roadmap in v0's preview. Anyone following it would have seen nothing, decided the install was broken, and probably started "fixing" a working site. The guide now says to publish first and check on the published site.&lt;/p&gt;

&lt;p&gt;I'd never have found this by reading v0's docs. I found it because the AI told me while doing the job.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Free-plan badges sit where floating buttons go
&lt;/h2&gt;

&lt;p&gt;Lovable and Bolt both put a "made with" badge in the bottom-right corner on the free plan, which is exactly where a floating Feedback button goes by default.&lt;/p&gt;

&lt;p&gt;On Lovable, my button sat above the badge and got the click. On Bolt, the badge sat on top of the button. I checked with &lt;code&gt;document.elementFromPoint&lt;/code&gt; at the button's center and both ends: every click landed on the badge. A visitor would have to close the badge before they could leave feedback.&lt;/p&gt;

&lt;p&gt;My checking script missed this at first. It clicked the button from code, which works even when something covers it. A real "can a visitor click this" check needs to ask the page what's actually under the pointer. The Bolt guide now suggests putting the button on the left.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. The AI tools knew the single-page-app catch
&lt;/h2&gt;

&lt;p&gt;A script tag rendered inside a React component doesn't run, so in a single-page app a roadmap embedded that way is just an empty box. The prompt warns about this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bolt used the npm package and named this catch as its reason. Claude Code also used the npm package, because the site was a React app.&lt;/li&gt;
&lt;li&gt;Lovable used the script tag but added the roadmap's script in a way that does run in its app.&lt;/li&gt;
&lt;li&gt;v0 sidestepped it: its site was one static HTML file, with no components for a script tag to be rendered inside.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the warning in the prompt seems to work. I won't remove it to find out.&lt;/p&gt;

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

&lt;p&gt;About 15 minutes across the three browser tools, from the first message to publishing, and under a minute for Claude Code. The free plans are the limit if you want to test more than once. On Lovable, the two messages used 3.4 of the 5 daily credits, so that's about one run a day. On Bolt they used 150K of the 300K daily tokens, so two.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell anyone who publishes install instructions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Run them through the tools your users use, and check the published result in a real browser.&lt;/strong&gt; Bolt's roadmap looked fine when you clicked through the site. Only opening /roadmap directly showed the problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Say what you mean by "page".&lt;/strong&gt; If something needs its own address, say so in those words.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't tell people to check in the preview&lt;/strong&gt; unless you've confirmed the preview runs your script.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check whether a visitor can click your button,&lt;/strong&gt; not only whether it exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat it as a small sample.&lt;/strong&gt; This was one run per tool, on one made-up site, for my own product. Run it again next month and the results may differ, since these tools change often.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have you tested your own install instructions in an AI builder? I'd like to know what broke for you, and whether it was the same kind of thing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm Patrick, the founder of UserNote, the feedback board installed here. I now offer these tests, run by hand, to other developer tools, as InstallGrade (installgrade.com). I wrote this with help from an AI assistant; the numbers, code and tests are mine and checked.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>testing</category>
      <category>javascript</category>
    </item>
    <item>
      <title>A month after launch, 98% of my traffic is still bots</title>
      <dc:creator>Patrick OBrien</dc:creator>
      <pubDate>Tue, 24 Nov 2026 16:35:33 +0000</pubDate>
      <link>https://dev.to/patrick_obrien_9d32049d27/a-month-after-launch-98-of-my-traffic-is-still-bots-2151</link>
      <guid>https://dev.to/patrick_obrien_9d32049d27/a-month-after-launch-98-of-my-traffic-is-still-bots-2151</guid>
      <description>&lt;p&gt;A month ago I wrote about my launch week: the logs said 749 page views, and after filtering, the real number was 31. A few people asked the obvious follow-up: does it get better once the launch spike is over?&lt;/p&gt;

&lt;p&gt;So here's the month. Since launch, my site has served &lt;strong&gt;22,351 HTML requests&lt;/strong&gt;. &lt;strong&gt;483&lt;/strong&gt; of them were people.&lt;/p&gt;

&lt;p&gt;That's 2.2%. And the share hasn't moved: about 1.5% in the first six days, about 1.6% in the last seven. The number of people grew. So did the bots, at about the same rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the 22,351 went
&lt;/h2&gt;

&lt;p&gt;Same report as last time: a Python script over CloudFront's JSON access logs, no IP addresses, no analytics script. Each HTML request lands in exactly one bucket, in this order:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Bucket&lt;/th&gt;
&lt;th&gt;Requests&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Bot user agent, or a browser that can't exist&lt;/td&gt;
&lt;td&gt;11,808&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Crawler (too many pages a minute or a day)&lt;/td&gt;
&lt;td&gt;4,934&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fetched the HTML, never ran the app&lt;/td&gt;
&lt;td&gt;4,622&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Probe for a page that doesn't exist&lt;/td&gt;
&lt;td&gt;228&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Opened my own dashboard that day (me, mostly)&lt;/td&gt;
&lt;td&gt;75&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Uncertain&lt;/strong&gt;: old browser, but ran the app&lt;/td&gt;
&lt;td&gt;201&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;People&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;483&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The user-agent check still does most of the work, and the "never ran the app" check is still the one I trust most: a real browser downloads the JavaScript bundle (or has it cached) within a minute of the page. Over 4,600 requests a month skip that step.&lt;/p&gt;

&lt;h2&gt;
  
  
  People, week by week
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Week&lt;/th&gt;
&lt;th&gt;Page views&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;19–25 Oct&lt;/td&gt;
&lt;td&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;26 Oct–1 Nov&lt;/td&gt;
&lt;td&gt;83&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2–8 Nov&lt;/td&gt;
&lt;td&gt;122&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9–15 Nov&lt;/td&gt;
&lt;td&gt;162&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That's real growth, from a small base. Most visits arrive with no referrer at all, so I can't say where they came from; of the ones that do, Google and my own posts lead. Most people land on the homepage or a comparison page, read it and leave.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed after the comments
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The "uncertain" line.&lt;/strong&gt; The most useful comment on the first post (thanks, Om) was about the old-browser rule. I was dropping any browser more than about a year out of date, because scanners hard-code old versions. Om's point: real people use old phones and work PCs that stopped updating. When I checked, 10 launch-week views had been dropped by that rule alone, and every one of them had run the app.&lt;/p&gt;

&lt;p&gt;So those don't get dropped or counted now. They go on their own line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;ran_app&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;bots&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"HTML only, never ran the app"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="no"&gt;OLD_BROWSER&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;unquote&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;uncertain&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;   &lt;span class="c1"&gt;# ran the app, but on a browser years out of date&lt;/span&gt;
    &lt;span class="k"&gt;continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The order matters: the old-browser check comes after "did it run the app", so anything on this line has already passed every other test.&lt;/p&gt;

&lt;p&gt;I expected that line to stay small. It didn't: about 8 in the first six days, 10 the week after, then 70, 61 and 52 in the last three weeks. Either more people on old devices found the site at the same time as more people did generally, or a scanner that runs JavaScript and sends an old user agent turned up. Without IPs I can't tell, which is the whole reason it's a separate line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real 404s.&lt;/strong&gt; My site is a single-page app, so it used to return &lt;code&gt;index.html&lt;/code&gt; with a 200 for any path. In the first six days, 200 requests were probes for &lt;code&gt;/wp-login.php&lt;/code&gt; and friends. In the last seven days: none. The scanners haven't stopped; unknown paths now get a real 404, so they never reach the HTML count at all. The filter became the fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A higher daily limit.&lt;/strong&gt; A browser fetching 20 pages in a day is treated as a crawler. It was 8, which caught a keen reader (and me).&lt;/p&gt;

&lt;h2&gt;
  
  
  The thing I can't explain yet
&lt;/h2&gt;

&lt;p&gt;71 of the 483 views came from China, 70 of them in the last three weeks, in bursts. They pass every filter: current browsers, they run the app, they don't read pages faster than a person. No Chinese referrers, no sign-ups, and the site has nothing aimed at China.&lt;/p&gt;

&lt;p&gt;They're probably automated browsers good enough to pass all of the checks. But "probably" isn't proof, and without IPs I can't see more. For now they're counted, with a note next to them. Without them, the last few weeks are flatter than the table suggests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bots aside, the number that matters
&lt;/h2&gt;

&lt;p&gt;Three browsers reached the sign-up form in the month. The form recorded one submission. Two people actually signed up in that time, so some browsers block even my own first-party pings. Every number above is a lower bound for people and an upper bound for anything that looks like a person.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I took from it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The bot share didn't fall after launch. It's the background level of the internet for a small site, and it scales with how findable you are.&lt;/li&gt;
&lt;li&gt;Every filter needs a "not sure" line. Dropping things you can't classify quietly hides the mistakes in your own rules.&lt;/li&gt;
&lt;li&gt;Fixing the server beat filtering the logs. Real 404s removed a whole category.&lt;/li&gt;
&lt;li&gt;483 real views in a month, from 31 in launch week. It's small, but it's real, and it's the number I watch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you read your own logs, what's the strangest traffic you've had to explain? And has anyone found a good way to classify old browsers that run JavaScript?&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>aws</category>
      <category>analytics</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Stopping duplicate votes without making anyone log in</title>
      <dc:creator>Patrick OBrien</dc:creator>
      <pubDate>Tue, 17 Nov 2026 10:11:17 +0000</pubDate>
      <link>https://dev.to/patrick_obrien_9d32049d27/stopping-duplicate-votes-without-making-anyone-log-in-1ngj</link>
      <guid>https://dev.to/patrick_obrien_9d32049d27/stopping-duplicate-votes-without-making-anyone-log-in-1ngj</guid>
      <description>&lt;p&gt;he feedback board I build lets anyone vote on an idea in one click, with no account and no email address. The first question people ask about that is reasonable: what stops someone voting a hundred times?&lt;/p&gt;

&lt;p&gt;The honest answer is "several small checks, none of them perfect". This post walks through each one with the real code, what it costs, and what it still can't stop. If you're building anything with anonymous votes, likes or ratings, the same pieces apply.&lt;/p&gt;

&lt;p&gt;(Why skip logins at all is a separate argument. The short version: every step before a vote loses people, and for product feedback you want the quiet majority, not just the motivated few.)&lt;/p&gt;

&lt;h2&gt;
  
  
  What we're actually defending against
&lt;/h2&gt;

&lt;p&gt;It helps to be specific, because "stop duplicate votes" can mean very different things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Someone clicking twice by accident&lt;/strong&gt;, or double-clicking. Must never count twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Someone voting again on purpose&lt;/strong&gt; after a reload, or in a second tab. Should be stopped.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Someone trying a bit harder:&lt;/strong&gt; private window, another browser, clearing storage. Should be limited.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A script&lt;/strong&gt; sending votes straight to the API. Should be capped hard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A determined person&lt;/strong&gt; with many devices and networks. Can't be stopped without identity, and for a feedback board that's fine.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An election needs to handle all five. A feedback board needs to make the first four not worth the effort, and to make sure the numbers stay roughly right. You're looking for patterns across many people, not a precise count.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 1: a random token per board, kept in the browser
&lt;/h2&gt;

&lt;p&gt;The first time someone votes or suggests an idea, the widget makes a random token and keeps it in the browser's local storage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getRandomValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'0'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`usernote_token_${boardId}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;created&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every vote sends that token, and the server records one vote per token per idea. A reload, a second tab, or clicking again tomorrow all send the same token, so they're all the same voter. That covers cases 1 and 2.&lt;/p&gt;

&lt;p&gt;A few decisions around it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It's random, not a fingerprint.&lt;/strong&gt; It isn't built from the screen size, fonts or anything else about the device. A fingerprint would survive clearing storage, which is exactly why I didn't want one: it's tracking, and visitors can't see it or reset it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One token per board.&lt;/strong&gt; Two boards on the same website get different tokens, so nobody can link what one visitor did on both.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's replaced after 12 months&lt;/strong&gt;, and a "Forget my votes on this device" link at the bottom of the board deletes it. The votes already cast still count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local storage can throw&lt;/strong&gt; (some privacy modes, blocked site data), so the widget falls back to keeping the token in memory for the page's lifetime. Voting still works; it just won't be remembered next visit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The weakness is obvious: the token belongs to the browser, so a private window or a different browser gets a new one. And the server can't tell a real token from a made-up one. It only checks the format, so a script can send a fresh random token with every request. The token alone stops honest repeats; the next checks are for everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 2: hash it on the server
&lt;/h2&gt;

&lt;p&gt;The server never stores the token as sent. It stores a salted hash, combined with the board ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MIN_SALT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;hashClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;salt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;HASH_SALT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;salt&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;salt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;MIN_SALT&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'HASH_SALT is missing or too short'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'sha256'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;salt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\n'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'base64url'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;voteKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;PK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`NOTE#${ideaId}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`VOTE#${hashClient('token', boardId, token)}`&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the database ever leaked, the vote records wouldn't contain anything a browser could present again. The same function hashes IP addresses (next section), and there the salt really matters: there are only about 4.3 billion IPv4 addresses, so an unsalted hash of one can be reversed by trying them all. With a secret salt, the stored value is useless without it. That makes the salt a secret key, so the function refuses to run without one rather than quietly hashing unsalted. (The first version of this post used &lt;code&gt;HASH_SALT ?? ''&lt;/code&gt; here, which fails open if the variable ever goes missing; a reader on DEV pointed it out, and it's fixed.) The database only ever holds the hashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 3: a cap per network
&lt;/h2&gt;

&lt;p&gt;Here's what handles cases 3 and 4. Each idea keeps a small counter per hashed IP address, and one connection can only contribute a few votes to any one idea, however many tokens it invents.&lt;/p&gt;

&lt;p&gt;Why a few and not one? Because one IP address is often many people: an office, a school, a household, a phone network sharing addresses between thousands of customers. A limit of one would mean the second person in an office could never vote. A small number is a guess at the balance: it lets a small team vote for the same thing, while one person with several browsers, or a script on one connection, only gets a handful of extra votes per idea.&lt;/p&gt;

&lt;p&gt;There are also hourly limits per connection, on votes across the board and on new suggestions. Those are simple counters in the same DynamoDB table, one item per IP per hour, deleted automatically by a TTL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;rateLimit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;windowSeconds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;windowStart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;windowSeconds&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ddb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UpdateCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;TableName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;table&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="no"&gt;PK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`RATE#${key}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;windowStart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;UpdateExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ADD hits :one SET #ttl = :ttl'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;ExpressionAttributeNames&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'#ttl'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ttl'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;ExpressionAttributeValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;':one'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;':ttl'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;windowStart&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;windowSeconds&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;ReturnValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'UPDATED_NEW'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Attributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hits&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;429&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Too many requests'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(The key is the hashed address, never the address itself.) A fixed window is the simplest kind of rate limit, and it allows a burst at the edge of two windows (up to double the limit in a few seconds). For this, that doesn't matter.&lt;/p&gt;

&lt;h3&gt;
  
  
  Getting the real IP address
&lt;/h3&gt;

&lt;p&gt;An IP cap is only as good as the IP address you read, and this is the step that's easy to get wrong. The API sits behind CloudFront, so the address the Lambda sees by default is CloudFront's, not the visitor's. The usual fix is to read a forwarded header, but a client can set any header it likes.&lt;/p&gt;

&lt;p&gt;So a tiny CloudFront function overwrites that header on every API request with the address CloudFront actually saw (&lt;code&gt;event.viewer.ip&lt;/code&gt;), whatever the client sent.&lt;/p&gt;

&lt;p&gt;That's only trustworthy if every request goes through CloudFront. Someone calling API Gateway's own URL directly could set the header to anything. CloudFront therefore adds a long secret header to each request it forwards, and the API rejects any request without it. Without that second step, the whole per-IP cap could be sidestepped by changing one header.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 4: one transaction, so the count can't drift
&lt;/h2&gt;

&lt;p&gt;A vote touches three things: the record that this token voted, the per-IP counter for this idea, and the idea's vote count. If they're written separately, a failure or a race between them leaves the count wrong: two fast clicks could both pass a "has this token voted?" read before either writes.&lt;/p&gt;

&lt;p&gt;So it's one DynamoDB transaction with a condition on each part, and any failed condition cancels all three:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;TransactItems&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Put&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;voteKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="nc"&gt;ConditionExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'attribute_not_exists(PK)'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;// this token hasn't voted&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ipKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="nc"&gt;UpdateExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'SET votes = if_not_exists(votes, :zero) + :one'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="nc"&gt;ConditionExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'attribute_not_exists(votes) OR votes &amp;lt; :max'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// IP under its cap&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Update&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ideaKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="nc"&gt;UpdateExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'ADD voteCount :one'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
              &lt;span class="nc"&gt;ConditionExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'attribute_exists(PK) AND #status &amp;lt;&amp;gt; :pending'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// idea exists and is public&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Table names and expression values trimmed for space.)&lt;/p&gt;

&lt;p&gt;There's no read-then-write gap: the conditions are checked as part of the write. A double-click sends two requests; one succeeds and the other fails its first condition. Transactions cost twice as much as plain writes in DynamoDB, which on a small board is a fraction of a cent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 5: say yes to everything
&lt;/h2&gt;

&lt;p&gt;When a vote is a duplicate, or over the IP cap, or over the hourly limit, the API still answers &lt;code&gt;200 { voted: true }&lt;/code&gt;. It just doesn't count it.&lt;/p&gt;

&lt;p&gt;This is deliberate. A clear "you've already voted" or "limit reached" tells someone scripting votes exactly which check stopped them and when to rotate to something else. Silent success gives them nothing to tune against. Honest visitors almost never hit these limits, and when they do, the widget already showed their vote, so nothing changes for them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Check 6: a honeypot for suggestions
&lt;/h2&gt;

&lt;p&gt;New ideas get one more check. The suggestion form has an extra field with an ordinary-looking name, positioned off-screen, skipped by the keyboard (&lt;code&gt;tabindex="-1"&lt;/code&gt;), and hidden from screen readers (&lt;code&gt;aria-hidden="true"&lt;/code&gt;) and from autofill (&lt;code&gt;autocomplete="off"&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;People never see it, so they never fill it in. Simple form-filling bots fill every field they find. If it arrives with a value, the API answers as if the idea was accepted and throws it away. Like the vote checks, it fails silently.&lt;/p&gt;

&lt;p&gt;It's not on votes, because a vote isn't a form: there's nothing for a bot to fill in. It's also only good against lazy bots, which is most of them. Anything that runs the page properly won't fall for it, and that's what the IP limits and owner approval (new ideas wait for the board owner by default) are for.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this can't stop
&lt;/h2&gt;

&lt;p&gt;Being clear about the limits matters more than the checks themselves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Several networks.&lt;/strong&gt; Someone with a laptop on home broadband and a phone on mobile data has two IP addresses, so two separate caps. Add a VPN and it's more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Several IPv6 networks.&lt;/strong&gt; One I got wrong first time: the cap used the full IP address. That's fine for IPv4, but an IPv6 device normally picks new addresses within its network every so often (privacy extensions), and each new address got a fresh allowance. The cap now counts IPv6 by its /64 network, the block a home or a phone is normally given, and IPv4 by the address as before. It still isn't watertight: some providers give a home many /64 networks, and someone who can switch between them gets an allowance on each.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A real group voting together.&lt;/strong&gt; If a company tells 40 employees to upvote its request from their own phones, those are 40 real votes from 40 people. No check can or should stop that; the board owner will usually notice the pattern.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The next person in a busy office.&lt;/strong&gt; The flip side of the per-IP cap: once a few colleagues have voted for an idea from the same office connection, the next colleague's vote is dropped silently. Their browser shows it as voted; the count doesn't include it. That's the trade I made for the caps to mean anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is identity. If you need to know exactly who voted, or votes decide money or rankings that people have a reason to cheat, require a login. For "which of these ideas do people want most", these checks keep the numbers honest enough to act on, without asking anyone to sign up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A random token per board, in the browser, stops honest repeat votes.&lt;/li&gt;
&lt;li&gt;The server stores only salted hashes of tokens and IP addresses.&lt;/li&gt;
&lt;li&gt;A small cap per IP per idea (per /64 for IPv6), plus hourly limits, bounds what one connection can do, provided you read the IP from a header your own CDN set and block requests that skip the CDN.&lt;/li&gt;
&lt;li&gt;One conditional transaction keeps the count right under double-clicks and races.&lt;/li&gt;
&lt;li&gt;Duplicates and limits fail silently, so there's nothing to tune against.&lt;/li&gt;
&lt;li&gt;A honeypot catches lazy bots on the suggestion form.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What have you used for anonymous voting, and what got through it?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: this is how UserNote, the feedback board and public roadmap I build and run on my own, handles votes. I wrote this with help from an AI assistant; the numbers, code and tests are mine and checked.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>javascript</category>
      <category>aws</category>
    </item>
    <item>
      <title>What it costs to run a SaaS on Lambda and one DynamoDB table</title>
      <dc:creator>Patrick OBrien</dc:creator>
      <pubDate>Tue, 10 Nov 2026 11:45:04 +0000</pubDate>
      <link>https://dev.to/patrick_obrien_9d32049d27/what-it-costs-to-run-a-saas-on-lambda-and-one-dynamodb-table-1aob</link>
      <guid>https://dev.to/patrick_obrien_9d32049d27/what-it-costs-to-run-a-saas-on-lambda-and-one-dynamodb-table-1aob</guid>
      <description>&lt;p&gt;I run a small SaaS on AWS with no servers: a few Lambda functions, one DynamoDB table and a CDN. People often say this kind of setup costs "about nothing" until it suddenly doesn't, so here's the real bill for October, the month it launched, broken down by service, plus what I think changes as it grows.&lt;/p&gt;

&lt;p&gt;The numbers come from AWS Cost Explorer, filtered to a tag that every resource for this product carries. (The AWS account also runs another project, so the account total would be the wrong number. Small lesson in itself: AWS only splits costs by a tag after you activate it as a "cost allocation tag" in the billing settings. Mine wasn't, so my first query came back with $0.00 and I had to backfill it.)&lt;/p&gt;

&lt;h2&gt;
  
  
  The setup
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Website and widget:&lt;/strong&gt; static files in S3, served by CloudFront. The marketing pages are prerendered HTML, so crawlers don't need to run JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API:&lt;/strong&gt; API Gateway (the cheaper HTTP API type) in front of one Node.js Lambda for everything, plus a second small Lambda for Stripe webhooks. Both run on arm64 (Graviton) with 512 MB of memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database:&lt;/strong&gt; one DynamoDB table in on-demand mode, with every kind of record (boards, ideas, votes, accounts) in the same table under different keys. No secondary indexes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logins:&lt;/strong&gt; Cognito, for the people who own boards. Visitors who vote never log in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email:&lt;/strong&gt; SES, for "someone suggested an idea" alerts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI:&lt;/strong&gt; Claude Haiku on Amazon Bedrock, for an optional summary that groups a board's ideas into themes. It only runs when an owner clicks the button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everything else:&lt;/strong&gt; a Route 53 hosted zone, one KMS key, and access logs kept for 30 days.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No VPC, no NAT gateway, no RDS, no containers.&lt;/p&gt;

&lt;h2&gt;
  
  
  October's bill
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;October&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Route 53 (DNS)&lt;/td&gt;
&lt;td&gt;$0.51&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;KMS (encryption key)&lt;/td&gt;
&lt;td&gt;$0.15&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;S3 (storage and requests)&lt;/td&gt;
&lt;td&gt;$0.08&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API Gateway&lt;/td&gt;
&lt;td&gt;$0.0014&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DynamoDB&lt;/td&gt;
&lt;td&gt;$0.0004&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lambda&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudFront&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cognito&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CloudWatch&lt;/td&gt;
&lt;td&gt;$0.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;$0.74&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Seventy-four cents. And almost all of it is the part that doesn't depend on traffic: the DNS zone ($0.50) and the encryption key ($0.15) are 88% of the bill.&lt;/p&gt;

&lt;p&gt;The parts people usually worry about came to almost nothing. Lambda ran 1,223 times and used 192 GB-seconds of compute, all inside the free tier (1 million requests and 400,000 GB-seconds a month). CloudFront served about 38,000 requests and 0.23 GB, also free. DynamoDB handled 764 read units and 376 write units for less than a twentieth of a cent.&lt;/p&gt;

&lt;p&gt;The biggest line that does move with use is S3, at 8 cents, and it's almost all requests: 8,591 writes and 77,233 reads. Visitors don't explain that many; most of it is probably me, uploading files on every deploy and downloading the access logs every time I run my traffic report. My own tooling cost more than my users did.&lt;/p&gt;

&lt;p&gt;Two things don't appear under the tag at all. Email (SES) has no line, so the few notification emails I sent cost nothing I can see. And the AI summaries: October had exactly one, my own test. Model calls on Bedrock aren't tagged resources unless you set up an application inference profile, which I haven't, so even that one call doesn't show in the tagged bill. With one call there's nothing to report yet; the budget alarm described below is there for when there is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixed costs vs pay-per-use
&lt;/h2&gt;

&lt;p&gt;Almost every line above scales with use: no traffic, no charge. A few don't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Route 53 hosted zone&lt;/strong&gt; is $0.50 a month per domain, whether anyone visits or not. The DNS queries themselves (about 24,000 in October) added one cent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The KMS key&lt;/strong&gt; is $1 a month per key, charged by the day. I created mine late in October, to encrypt access tokens for a Webflow integration, so October only paid 15 cents of it. From November it's the full dollar, which will make it the biggest line on the bill.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The domain itself&lt;/strong&gt; is paid yearly to the registrar, outside AWS.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At launch, the costs that don't depend on traffic are the bill. That will stay true for a long time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the traffic actually went
&lt;/h2&gt;

&lt;p&gt;Recently I wrote about my launch-week logs showing 749 page views when the real number was 31; the rest was bots. That matters for cost too, but less than I expected:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Page requests from bots hit CloudFront and S3&lt;/strong&gt;, which serve cached static files. They're the cheapest requests in the whole system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The board API isn't cached&lt;/strong&gt;, deliberately: votes need to show up straight away. So every time a widget loads a board, that's one API Gateway request, one Lambda run and one DynamoDB query. This is the part that scales with real use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In October that was 1,223 API requests, from visitors' widgets and from me in the dashboard. API Gateway charged $0.0014 for them and DynamoDB $0.0004; Lambda was free. That's about $1.50 per million API calls on the bill, plus Lambda once the free tier runs out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decisions that keep it cheap
&lt;/h2&gt;

&lt;p&gt;None of these are clever. They mostly avoid the well-known ways a "serverless" bill surprises people:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No VPC.&lt;/strong&gt; Lambda functions inside a VPC that need the internet usually need a NAT gateway, which costs money every hour whether or not anything runs: $0.045 an hour in US East (Ohio), over $30 a month for one gateway before any data goes through it. That's about 40 times my whole October bill. Mine don't need a VPC, so there's nothing billing by the hour.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One table, on demand, no indexes.&lt;/strong&gt; On-demand billing means no capacity to pay for while idle. Every secondary index would be another copy of each write, so I designed the keys to answer every query without one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;arm64 Lambdas.&lt;/strong&gt; Graviton is priced lower per GB-second than x86 for the same memory, and Node.js runs on it without changes. It made no difference in October, because everything fit in the free tier, but it will once the free tier runs out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logs expire.&lt;/strong&gt; Lambda logs and CloudFront access logs are kept for 30 days, then deleted. Log storage is a slow-growing cost that nobody notices until it isn't small.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A ceiling on abuse.&lt;/strong&gt; API Gateway is throttled at 50 requests a second (bursts to 100). That's far more than real use needs, and it caps what a script hammering the API can run up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI only on request, with limits and an alarm.&lt;/strong&gt; The summary runs when an owner clicks the button: once a day on the free plan, ten on the paid plan. An AWS Budget of $10 a month on the model emails me when actual spend passes half of it, or when AWS forecasts the month will go over. A per-call AI feature is the one part of this stack where a bug or an abuser could actually cost real money.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changes as it grows
&lt;/h2&gt;

&lt;p&gt;A rough estimate from October's bill, not a forecast. Assume each paying board gets 1,000 API calls a month (widget loads, votes, suggestions), and each call costs what October's did: one API Gateway request, about 0.16 GB-seconds of Lambda, and a little DynamoDB.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;100 boards:&lt;/strong&gt; 100,000 calls. About $0.15 for API Gateway and DynamoDB, Lambda still free. The bill stays under $2 a month, nearly all of it fixed costs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1,000 boards:&lt;/strong&gt; 1 million calls. About $1.50 for API Gateway and DynamoDB, and Lambda right at the edge of the free tier (1 million requests, about 160,000 of the 400,000 free GB-seconds). Note the free tier is per AWS account, so anything else in the same account uses it up too. Call it a few dollars a month, against 1,000 paying customers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What I expect, beyond the sums:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fixed costs stay flat.&lt;/strong&gt; One hosted zone and one key cost the same at 1,000 customers as at zero.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Board loads become the main cost:&lt;/strong&gt; Lambda, API Gateway and DynamoDB reads, all per request. If that ever gets expensive, the obvious fix is a short cache for board reads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI summaries are the wild card.&lt;/strong&gt; Per-click model costs are small, but they're the only line that grows with how much people click rather than how much traffic they get.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Email&lt;/strong&gt; grows with the number of ideas submitted, at SES's price of $0.10 per 1,000 emails.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What this doesn't count
&lt;/h2&gt;

&lt;p&gt;The AWS bill isn't the cost of the business. Not included above: the domain, the email provider for my own inbox, Stripe's fees on each payment, and my time, which is by far the biggest cost and the hardest to put a number on.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;The product cost $0.74 to run in its first month, and 88% of that was a DNS zone and an encryption key that would have cost the same with zero visitors.&lt;/p&gt;

&lt;p&gt;Serverless was the right call for a product that might get ten visitors a day or ten thousand: I pay for what's used, and the bill at zero is close to zero. The things worth doing on day one are cheap and boring: no VPC unless you need one, logs that expire, a throttle on the API, and a budget alarm on anything billed per AI call.&lt;/p&gt;

&lt;p&gt;What's the line on your AWS bill that surprised you, in either direction?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclosure: the product is UserNote, a feedback board and public roadmap for websites, which I build and run on my own.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>webdev</category>
      <category>saas</category>
    </item>
  </channel>
</rss>
