<?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: Isaac Sunday</title>
    <description>The latest articles on DEV Community by Isaac Sunday (@dilutedev).</description>
    <link>https://dev.to/dilutedev</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%2F3614271%2Fd4409dbd-90ab-460f-93ad-053d61d3c2db.png</url>
      <title>DEV Community: Isaac Sunday</title>
      <link>https://dev.to/dilutedev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dilutedev"/>
    <language>en</language>
    <item>
      <title>Two agents, one PASS, and a loop every eight seconds: notes from building baton</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Sun, 22 Nov 2026 23:29:49 +0000</pubDate>
      <link>https://dev.to/dilutedev/two-agents-one-pass-and-a-loop-every-eight-seconds-notes-from-building-baton-heb</link>
      <guid>https://dev.to/dilutedev/two-agents-one-pass-and-a-loop-every-eight-seconds-notes-from-building-baton-heb</guid>
      <description>&lt;p&gt;baton is a tool I've been building for two months. You talk to one Claude Code session, the conductor, and it runs a team of other agents for you: a researcher, a planner, a principal engineer, an implementer and a reviewer. Every goal starts with a proposal I approve. After that the team delivers it as reviewed commits on one branch, and the session stops with a one-page guide before anything gets pushed.&lt;/p&gt;

&lt;p&gt;This post is about what went wrong along the way. Most of the code in baton isn't there to make agents smarter. It exists because agents skipped a step, waited on something that was never going to finish, or burned money in a way I only noticed afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Version one: agents typing into each other's terminals
&lt;/h2&gt;

&lt;p&gt;The first version was a tmux script. Each role ran in its own pane, and a handoff meant typing a prompt into the next pane. Within a week I'd swapped tmux for herdr (a multiplexer that can tell you whether an agent pane is idle or working) and swapped a markdown backlog for kata, an issue tracker with a CLI and a &lt;code&gt;--blocked-by&lt;/code&gt; dependency graph. Handoffs became kata comments, and a script called &lt;code&gt;baton-handoff&lt;/code&gt; typed the next prompt into the target pane.&lt;/p&gt;

&lt;p&gt;Treating a terminal as an API produced bugs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Handoffs interrupted busy agents.&lt;/strong&gt; If the reviewer was mid-review and the implementer finished a second item, the new prompt landed in the middle of a turn. The fix was a queue per role (&lt;code&gt;.dispatch-state/&amp;lt;role&amp;gt;.queue&lt;/code&gt;), with bounces pushed to the front and state changes serialized by an &lt;code&gt;mkdir&lt;/code&gt; lock.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/clear&lt;/code&gt; raced the payload.&lt;/strong&gt; Before switching a pane to a new item I cleared its context with &lt;code&gt;/clear&lt;/code&gt;, then typed the prompt. They went out back to back, so sometimes the pane received &lt;code&gt;/clearBody: ...&lt;/code&gt; as a single line. The item was marked as delivered even though nothing had started. Now the courier waits for the pane to go idle after &lt;code&gt;/clear&lt;/code&gt;, and it only counts a handoff as delivered once herdr reports the pane as &lt;em&gt;working&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sandboxes ate the handoffs.&lt;/strong&gt; &lt;code&gt;baton-handoff&lt;/code&gt; ran inside the calling agent's shell while that agent was still mid-turn. Codex's sandbox can't reach herdr's socket and kills detached child processes, so handoffs from a Codex pane silently went nowhere. The fix was to move delivery out of the agents entirely. &lt;code&gt;baton-handoff&lt;/code&gt; now only appends to a queue, and a separate &lt;code&gt;baton-courier&lt;/code&gt; process, started by &lt;code&gt;baton start&lt;/code&gt; outside every sandbox, delivers whatever is at the head of the queue.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By that point I had a small distributed system whose transport was keystrokes, and no single piece of it was the hard part. The hard part was getting agents to follow a process.&lt;/p&gt;

&lt;h2&gt;
  
  
  The loop
&lt;/h2&gt;

&lt;p&gt;On 13 October the implementer and the reviewer passed one backlog item back and forth, a handoff every 6 to 12 seconds, until I noticed. Every review the reviewer wrote said &lt;strong&gt;PASS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's what happened. The item was small, so the conductor skipped the researcher and principal and sent it straight to the implementer. That was allowed. But the feature workflow depended on two bookkeeping commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;baton-item start &amp;lt;item&amp;gt;                      # record the commit the item starts from
baton-item complete &amp;lt;item&amp;gt; "&amp;lt;verification&amp;gt;"  # record the commit the item ends at
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an item went through the full pipeline, &lt;code&gt;start&lt;/code&gt; ran at dispatch. On the shortcut path nobody ran it, and the implementer never ran &lt;code&gt;complete&lt;/code&gt; either. So when the reviewer's PASS went through the gate, the gate refused it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;verify_item&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;local&lt;/span&gt; &lt;span class="nv"&gt;item&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$1"&lt;/span&gt; &lt;span class="nv"&gt;history&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${2:-unchanged}"&lt;/span&gt; completed reviewed
  &lt;span class="nv"&gt;completed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(item_value "&lt;/span&gt;&lt;span class="nv"&gt;$item&lt;/span&gt;&lt;span class="s2"&gt;" completed_commit)"&lt;/span&gt;
  &lt;span class="nv"&gt;reviewed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(item_value "&lt;/span&gt;&lt;span class="nv"&gt;$item&lt;/span&gt;&lt;span class="s2"&gt;" reviewed_commit)"&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; -n &lt;span class="s2"&gt;"$completed"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"item $item has no completed commit recorded"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$(item_value "&lt;/span&gt;&lt;span class="nv"&gt;$item&lt;/span&gt;&lt;span class="s2"&gt;" verdict)"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; PASS &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"item $item has no recorded PASS for its latest completed commit"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$reviewed"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"$completed"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"item $item was reviewed at ${reviewed:0:12}, not its completed commit ${completed:0:12}"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="o"&gt;}&lt;/span&gt;
  ...
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The failed gate turned the reviewer's handoff into &lt;code&gt;status: blocked, route: implementer&lt;/code&gt;, with no reason attached. The implementer saw "blocked", looked at its work, decided it was done, and handed off "done" again. The reviewer reviewed again, passed again, got blocked again. Each agent behaved correctly given what it could see, and no rule in either prompt said "if this keeps happening, stop".&lt;/p&gt;

&lt;p&gt;Fixing it was worse than the loop itself. The implementer ran &lt;code&gt;baton-item start&lt;/code&gt; &lt;em&gt;after&lt;/em&gt; the work was already committed, so the recorded start was HEAD. Then &lt;code&gt;complete&lt;/code&gt; refused with "item has no commit on the session branch yet", which was true, because start and HEAD were the same commit. There was no way to back-date a start, and the implementer (correctly) wouldn't hand-edit the state files. In the end it made one small, real follow-up commit on top so &lt;code&gt;complete&lt;/code&gt; had something to record. Dozens of kata comments had piled up on the item before anyone stepped in.&lt;/p&gt;

&lt;p&gt;The incident report lists seven lessons. The one that changed how I build everything since is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A rule that lives only in a prompt is eventually skipped.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The conductor prompt said to run &lt;code&gt;start&lt;/code&gt; at dispatch, and the conductor skipped it on a path the prompt didn't spell out. So the next big feature (the proposal phase) put its rules into &lt;code&gt;baton-handoff&lt;/code&gt; itself. During a proposal, a handoff to the implementer exits with code 3 and the message "the proposal phase builds nothing". A second critique in the same round is refused. Since the refusal happens in the agent's own shell, the agent sees the reason straight away and doesn't need to remember a rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  The evidence ledger
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;baton-item&lt;/code&gt; grew into the most important file in the repo. It's 545 lines of bash that record evidence on disk: the commit an item started from, the commit it was completed at, the commit the reviewer reviewed, and the verdict. Commands refuse whenever that evidence doesn't line up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;start&lt;/code&gt; refuses during the proposal phase, and it refuses if any other item hasn't passed review yet.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;complete&lt;/code&gt; refuses if the branch no longer contains the item's start commit, or if nothing has been committed since the start.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gate&lt;/code&gt; refuses if the branch has moved past the reviewed commit.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;publish&lt;/code&gt; refuses unless the owner has approved the exact tip being pushed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;complete&lt;/code&gt; and &lt;code&gt;publish&lt;/code&gt; both refuse if history that was already pushed has been rewritten:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;require_unrewritten_history&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;local&lt;/span&gt; tip
  &lt;span class="o"&gt;[&lt;/span&gt; -n &lt;span class="s2"&gt;"$remote"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;return&lt;/span&gt; 0
  &lt;span class="nv"&gt;tip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(published_tip || true)"&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; -z &lt;span class="s2"&gt;"$tip"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; git_in merge-base --is-ancestor &lt;span class="s2"&gt;"$tip"&lt;/span&gt; HEAD 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt;
    fail &lt;span class="s2"&gt;"pushed history was rewritten: the published tip ${tip:0:12} is not an ancestor of HEAD ..."&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The error messages are written for the agent that will read them. Each one says what's wrong and what to do next, because an agent that gets a bare "failed" will retry or improvise.&lt;/p&gt;

&lt;p&gt;One rule turned out to be too strict. Review fixes get folded into the commit they belong to (&lt;code&gt;git commit --fixup=&amp;lt;sha&amp;gt;&lt;/code&gt;, then &lt;code&gt;GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash &amp;lt;item start&amp;gt;&lt;/code&gt;), and the reviewer re-checks the result with &lt;code&gt;git range-diff&lt;/code&gt;. That means the PR is a series of commits that each have one purpose, instead of "address review feedback" piled on top. But once I'd restacked the branch onto an updated base, &lt;code&gt;final-start&lt;/code&gt; refused every item, because no reviewed commit was an ancestor of HEAD any more. With no tool to re-point the evidence, the conductor hand-edited the files under &lt;code&gt;items/&lt;/code&gt; three times in one session, guessing at a mapping for a commit that no longer existed.&lt;/p&gt;

&lt;p&gt;The fix was to ask what the check was actually protecting. Before the final review, the ancestry check protects the item reviews. During finalization the final reviewer reads the whole of &lt;code&gt;base..HEAD&lt;/code&gt;, and that review is what gates the push. So &lt;code&gt;final-start&lt;/code&gt; now requires every item to have a PASS on its completed commit, but no longer requires that commit to be on the branch. &lt;code&gt;start&lt;/code&gt; still runs the ancestry check, so a rewrite in the middle of delivery is still caught.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rewriting it as an agent team
&lt;/h2&gt;

&lt;p&gt;On 30 October I deleted most of what I've described so far. Claude Code had shipped agent teams: one session can spawn teammates and talk to them directly with &lt;code&gt;SendMessage&lt;/code&gt;. The courier, &lt;code&gt;baton-handoff&lt;/code&gt;, the pane queues, the Stop hook and Codex/omp support all went. The worktree per session, the kata backlog, the proposal phase and &lt;code&gt;baton-item&lt;/code&gt; stayed.&lt;/p&gt;

&lt;p&gt;That's the part I'd point to if someone asked whether the first version was wasted. The transport was thrown away, but the rules about evidence all carried over.&lt;/p&gt;

&lt;p&gt;The new design moved the cost problem somewhere else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the money went
&lt;/h2&gt;

&lt;p&gt;baton has a &lt;code&gt;baton cost&lt;/code&gt; command that adds up token use per model from a session's transcripts. Every number below comes from looking at it and asking why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The conductor read code.&lt;/strong&gt; Each conductor turn re-reads its entire context at Opus prices, and anything it reads stays in that context for every later turn. A file it reads early in a session gets paid for again on every turn until the session ends. Now the conductor never reads code or diffs beyond &lt;code&gt;git diff --stat&lt;/code&gt;. When it has a question about code, it asks a cheap teammate (a reviewer on Haiku, or Sonnet if it needs judgement), which answers in three lines. Teammates message the conductor only at defined check-ins, and idle notices get no reply, because each message wakes the most expensive model in the session.&lt;/p&gt;

&lt;p&gt;Even a small CLI quirk added up. kata's close command needs &lt;code&gt;--evidence&lt;/code&gt; and a message of at least 40 characters. Without them every session spent two or three conductor turns retrying the close. The fix was a single line in the prompt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Teammates were reused across items.&lt;/strong&gt; One implementer that carried over across five backlog items reached a median context of 324k tokens, and that one agent accounted for 12.7% of a day's usage. Now teammates stay warm within an item for its review rounds, and every new item gets a fresh one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every teammate compiled Rust from scratch.&lt;/strong&gt; Each one built into its own target dir and then cleaned it to save disk. In one session the target dirs reached 29, 39 and 198 GiB, and every rebuild took minutes per teammate per review round. Now the whole session shares one &lt;code&gt;CARGO_TARGET_DIR&lt;/code&gt; under the session's marker directory, and nobody may clean it. &lt;code&gt;baton remove&lt;/code&gt; already deletes the marker dir, so the cache is cleaned once, when the session ends.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A typo fix took 45 to 60 minutes.&lt;/strong&gt; Every item ran the full test suite twice (once by the implementer, once by the reviewer), finalization ran it twice more, and even trivial items waited for a plan check-in and a full review. Nothing before the reviewer pushed back on over-engineering, so extra work was only caught after someone had built it. Two changes came out of this. Slow suites now run once, in the final review, and each item runs only the fast checks plus the tests that cover the change. And every role works toward "the smallest change that meets the goal": the principal has to trace each part of a design back to an acceptance criterion, and the reviewer flags over-engineering as an important finding.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agents waiting on nothing
&lt;/h2&gt;

&lt;p&gt;This was my favourite failure. Two final reviewers and an implementer each started a test run in the background and ended their turn "waiting for it". Nothing wakes an agent when a background process exits. The conductor, asked for status, told me they were still running. For hours.&lt;/p&gt;

&lt;p&gt;In the same session, a teammate's wait loop used &lt;code&gt;pgrep -f&lt;/code&gt; on a pattern that matched its own command line, so it waited on itself forever. And an implementer ran &lt;code&gt;git reset&lt;/code&gt; to move HEAD so a tool would see a range of commits, which is a great way to lose work.&lt;/p&gt;

&lt;p&gt;The team protocol now has a section on long-running commands. A job that might outlast one tool call gets started detached, with its log, pid and exit code in files, and the agent waits on it in foreground calls in the &lt;em&gt;same&lt;/em&gt; turn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nohup bash -c &lt;span class="s1"&gt;'&amp;lt;command&amp;gt; &amp;gt;"$BATON_MARKER_DIR/jobs/&amp;lt;name&amp;gt;.log" 2&amp;gt;&amp;amp;1; echo $? &amp;gt;"$BATON_MARKER_DIR/jobs/&amp;lt;name&amp;gt;.exit"'&lt;/span&gt; \
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$!&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="s2"&gt;"$BATON_MARKER_DIR/jobs/&amp;lt;name&amp;gt;.pid"&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;seq 100&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; -f &lt;span class="s2"&gt;"$BATON_MARKER_DIR/jobs/&amp;lt;name&amp;gt;.exit"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; ! &lt;span class="nb"&gt;kill&lt;/span&gt; -0 &lt;span class="s2"&gt;"$(cat "&lt;/span&gt;&lt;span class="nv"&gt;$BATON_MARKER_DIR&lt;/span&gt;/jobs/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;.pid&lt;span class="s2"&gt;")"&lt;/span&gt; 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;break&lt;/span&gt;
  sleep 5
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the process is gone and there's no exit file, the job was killed, and the agent has to say so instead of waiting. Suites that only fit one run per machine (a browser end-to-end suite, say) run under &lt;code&gt;flock&lt;/code&gt; so runs from different sessions queue up. A test failure only counts as "environmental" if it also fails on the session's base commit, checked out with &lt;code&gt;git archive&lt;/code&gt; into a temp dir, never by moving HEAD.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule file nobody read
&lt;/h2&gt;

&lt;p&gt;In one session in a client's Rust backend, the team ignored the repository's comment rules completely. The repo had an 80-line &lt;code&gt;.claude/rules/01-comments.md&lt;/code&gt;. The only way rules reached the team was a "house rules" brief written by a Haiku teammate, and it had cut those 80 lines down to half a line.&lt;/p&gt;

&lt;p&gt;Summaries are lossy, and a cheap model summarizing rules loses the very details the rules exist to state. Now baton finds the rule files itself (&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt; and &lt;code&gt;CONTRIBUTING.md&lt;/code&gt; at any depth, &lt;code&gt;.claude/rules&lt;/code&gt;, &lt;code&gt;.cursor/rules&lt;/code&gt;, Copilot instructions, and untracked ones in the original checkout) and lists their paths in the conductor's prompt. The brief is only an index. Teammates read every applicable file in full before touching a matching path, the implementer checks its diff against them before the pre-commit check-in, and the reviewer treats any violation as a blocker.&lt;/p&gt;

&lt;p&gt;Even listing the files had a bug. Tracked files like &lt;code&gt;.claude/rules/01-comments.md&lt;/code&gt; showed up twice, once from my checkout and once from the worktree, because under &lt;code&gt;en_US.UTF-8&lt;/code&gt; &lt;code&gt;sort&lt;/code&gt; and &lt;code&gt;comm&lt;/code&gt; disagree on how to order paths that start with a dot, so &lt;code&gt;comm&lt;/code&gt; reported tracked files as untracked. Sorting and comparing under &lt;code&gt;LC_ALL=C&lt;/code&gt; keeps them in step.&lt;/p&gt;

&lt;h2&gt;
  
  
  My own tests lied too
&lt;/h2&gt;

&lt;p&gt;Last week I found that 16 negative assertions in baton's test suite had never been able to fail:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;set&lt;/span&gt; -e
! grep -q &lt;span class="s2"&gt;"should not appear"&lt;/span&gt; output.txt   &lt;span class="c"&gt;# passes whether or not the line is there&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;bash's &lt;code&gt;set -e&lt;/code&gt; does not exit on a command whose status is inverted with &lt;code&gt;!&lt;/code&gt;. It's in the manual, and I'd still written 16 of these. Each one now ends in &lt;code&gt;|| exit 1&lt;/code&gt;. It was humbling to find this while writing a tool whose whole point is not trusting a claim that something passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell someone building this
&lt;/h2&gt;

&lt;p&gt;The agents are good at the work. Process is where they fall down: running a bookkeeping step on a path nobody spelled out, noticing they're in a loop, remembering a background job, telling a real failure from an environmental one. Every one of those got fixed the same way. The check moved out of the prompt and into a tool that refuses, with an error message written for whoever reads it next.&lt;/p&gt;

&lt;p&gt;Then measure. Most of the cost changes in this post came from reading &lt;code&gt;baton cost&lt;/code&gt; after a session and asking which agent spent what, and on what. None of them came from guessing beforehand.&lt;/p&gt;

&lt;p&gt;baton is on GitHub at &lt;a href="https://github.com/dilutedev/baton" rel="noopener noreferrer"&gt;dilutedev/baton&lt;/a&gt;. The incident report quoted above is in &lt;code&gt;reports/&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>costopt</category>
      <category>devtools</category>
      <category>llm</category>
    </item>
    <item>
      <title>I couldn't afford a new Mac, so I rented a 64 GB server and turned my MacBook into a thin client</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Fri, 06 Nov 2026 23:09:37 +0000</pubDate>
      <link>https://dev.to/dilutedev/i-couldnt-afford-a-new-mac-so-i-rented-a-64-gb-server-and-turned-my-macbook-into-a-thin-client-2j4n</link>
      <guid>https://dev.to/dilutedev/i-couldnt-afford-a-new-mac-so-i-rented-a-64-gb-server-and-turned-my-macbook-into-a-thin-client-2j4n</guid>
      <description>&lt;p&gt;My MacBook Pro has an M2 Pro and 16 GB of RAM. For a while that was plenty. Then my normal day became: a few Next/Vite dev servers, Docker with Postgres and Redis, a couple of editors, a browser with too many tabs, and AI coding agents running in terminals next to all of it. Memory pressure stayed yellow, the fans came on for no reason, and the disk kept filling up with &lt;code&gt;node_modules&lt;/code&gt;, Docker images and build caches.&lt;/p&gt;

&lt;p&gt;The obvious fix was a new Mac with more memory. The honest problem: I can't afford one right now. A higher-spec MacBook costs a lot of money up front. A dedicated server costs a monthly fee I can actually fit into a budget.&lt;/p&gt;

&lt;p&gt;So I tried something else: keep the Mac, but stop asking it to do the heavy work.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The server:&lt;/strong&gt; a Hetzner AX41 from their server auction / dedicated line.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AMD Ryzen 5 3600 (6 cores, 12 threads)&lt;/li&gt;
&lt;li&gt;64 GB RAM&lt;/li&gt;
&lt;li&gt;2 × 512 GB NVMe in RAID 1&lt;/li&gt;
&lt;li&gt;Ubuntu 26.04&lt;/li&gt;
&lt;li&gt;Costs me &lt;strong&gt;€57&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Mac:&lt;/strong&gt; the same 16 GB M2 Pro, now mostly running a terminal, a browser and an editor.&lt;/p&gt;

&lt;p&gt;Everything that eats memory or disk lives on the server now: repos, dependencies, Docker, dev servers, databases and the agents.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it's wired together
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tailscale for everything private
&lt;/h3&gt;

&lt;p&gt;The server is on my tailnet as &lt;code&gt;hause-dev&lt;/code&gt;. The firewall (ufw) denies everything incoming by default. The only public ports are 80 and 443 for Caddy. SSH, mosh, Samba and my other dev services only accept connections over the &lt;code&gt;tailscale0&lt;/code&gt; interface.&lt;/p&gt;

&lt;p&gt;That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ssh hause&lt;/code&gt; works from my Mac, and nothing on the public internet can even try it.&lt;/li&gt;
&lt;li&gt;If I start a dev server with &lt;code&gt;--host&lt;/code&gt; (or &lt;code&gt;-H 0.0.0.0&lt;/code&gt; for Next), I open &lt;code&gt;http://hause-dev:3002&lt;/code&gt; on my Mac and it just works. The rest of the internet can't see it.&lt;/li&gt;
&lt;li&gt;If a server only binds to localhost, an SSH tunnel does the job: &lt;code&gt;ssh -N -L 3002:localhost:3002 hause&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Docker runs remotely, but feels local
&lt;/h3&gt;

&lt;p&gt;I don't run Docker on the Mac anymore. The Docker CLI on my Mac uses a context that points at the server over SSH:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker context create hause --docker &lt;span class="s2"&gt;"host=ssh://hause"&lt;/span&gt;
docker context use hause
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;docker ps&lt;/code&gt;, &lt;code&gt;docker compose up&lt;/code&gt; and so on all run on the server. For a GUI I use Gantry, a native macOS Docker app, pointed at the same SSH host. My Mac no longer carries a Linux VM eating several GB of RAM.&lt;/p&gt;

&lt;h3&gt;
  
  
  The server's files show up in Finder
&lt;/h3&gt;

&lt;p&gt;Sometimes I just want to drag a file in or open an image without thinking about &lt;code&gt;scp&lt;/code&gt;. So the server shares my code folder over Samba (SMB), the same protocol macOS uses for network drives. Samba only listens on the Tailscale interface, so the share isn't reachable from anywhere else.&lt;/p&gt;

&lt;p&gt;On the Mac it's built in: in Finder, press ⌘K, enter &lt;code&gt;smb://hause-dev&lt;/code&gt;, and save the password to Keychain. The server then shows up under Locations in the sidebar like any other drive. I added it to Login Items so it reconnects when I log in.&lt;/p&gt;

&lt;p&gt;It's not for heavy work. Running &lt;code&gt;npm install&lt;/code&gt; or &lt;code&gt;git&lt;/code&gt; over a network share at 135 ms would be miserable, so those still happen over SSH on the server itself. The share is for browsing, previewing and dragging files around.&lt;/p&gt;

&lt;h3&gt;
  
  
  Moving years of repos without losing anything
&lt;/h3&gt;

&lt;p&gt;This was the scariest part. I had a lot of projects in &lt;code&gt;~/code&lt;/code&gt;, some with uncommitted work, gitignored &lt;code&gt;.env&lt;/code&gt; files, and branches that only existed locally.&lt;/p&gt;

&lt;p&gt;Instead of trusting &lt;code&gt;rsync&lt;/code&gt; and hoping, I:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copied every repo across, including the gitignored files that mattered.&lt;/li&gt;
&lt;li&gt;Hashed every file on both machines and compared the trees.&lt;/li&gt;
&lt;li&gt;Found commits that existed on the Mac but not on the server, and imported them (there were 35 I would have lost).&lt;/li&gt;
&lt;li&gt;Archived old projects I don't touch anymore into &lt;code&gt;~/archive&lt;/code&gt; on the server instead of deleting them.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Only after everything matched did I start cleaning up the Mac.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I deliberately did &lt;em&gt;not&lt;/em&gt; move
&lt;/h3&gt;

&lt;p&gt;Credentials. Cloud logins, API keys, SSH private keys, AWS and Kubernetes configs, CLI auth tokens: none of it got copied. Every tool on the server got logged into fresh. It's slower, but it means the server only has the access I deliberately gave it, and I know exactly what that is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shell and tools
&lt;/h3&gt;

&lt;p&gt;The server got the same zsh setup, CLI tools and dotfiles as my Mac, so SSHing in feels like home. My server's SSH key got added to the other machines I manage, so I can hop from the server to them just like I used to from the Mac.&lt;/p&gt;

&lt;h2&gt;
  
  
  su.hause.dev: a tiny admin panel with passkeys
&lt;/h2&gt;

&lt;p&gt;Once all my dev servers lived somewhere I couldn't see, I wanted a quick way to check on them from any device. So I built &lt;strong&gt;su.hause.dev&lt;/strong&gt;: a small Go binary that shows the server's live process list, memory and CPU, and lets me quit runaway processes.&lt;/p&gt;

&lt;p&gt;Repo: &lt;strong&gt;&lt;a href="https://github.com/dilutedev/hause.dev" rel="noopener noreferrer"&gt;https://github.com/dilutedev/hause.dev&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Some decisions I'm happy with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Passkeys only.&lt;/strong&gt; No passwords. The first device signs in through a one-time setup link printed to the server logs. New devices choose "Request access", show a code, and an already-signed-in device approves it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recent passkey check for anything dangerous.&lt;/strong&gt; Quitting a process or adding and removing devices needs a passkey check from the last 10 minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It can't kill what matters.&lt;/strong&gt; init, systemd services, sshd, tailscaled, Caddy, Docker and the panel itself are shown, but can't be stopped from the UI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Least privilege.&lt;/strong&gt; It runs as its own system user whose only sudo right is &lt;code&gt;/usr/bin/kill&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everything is logged.&lt;/strong&gt; Every sign-in, device change and signal goes to the systemd journal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same repo also holds the hause.dev landing page and the deploy scripts (systemd unit, sudoers rule, Caddy site, install script).&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;The Mac feels new again.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disk space:&lt;/strong&gt; free space on the Mac went from &lt;strong&gt;126 GB to 271 GB&lt;/strong&gt; after moving repos, Docker and old caches off it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No more choosing between apps.&lt;/strong&gt; 64 GB means I can run all my projects' dev servers, databases and agents at once without closing things.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The trade-offs (it's not perfect)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Latency.&lt;/strong&gt; My round trip to the server is about 135 ms. Plain SSH typing feels it. mosh helps a lot, and editors with remote support (that run the language server on the server) hide most of it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No internet, no dev environment.&lt;/strong&gt; On a plane or bad Wi‑Fi, I'm stuck with whatever is still on the Mac.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Ryzen 5 3600 isn't an M-series chip.&lt;/strong&gt; Single-core speed is slower than my M2 Pro. I'm trading speed per core for lots of memory and cores that are never fighting my browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monthly cost.&lt;/strong&gt; Over enough years, a server costs as much as a new laptop would.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native Mac/iOS work still needs a Mac.&lt;/strong&gt; Xcode builds don't move to Linux.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you can afford a MacBook with 32 or 64 GB of RAM and you want everything local and offline, that's probably the better choice. This is the right choice for me &lt;em&gt;right now&lt;/em&gt;, because it turned a big expense I couldn't make into a small one I can.&lt;/p&gt;

&lt;h2&gt;
  
  
  Was it worth it?
&lt;/h2&gt;

&lt;p&gt;Yes, and it was genuinely fun! :)&lt;/p&gt;

&lt;p&gt;I ended up with a faster Mac, a server I understand top to bottom, and a little panel on my phone that tells me what's eating my RAM.&lt;/p&gt;

&lt;p&gt;If you're stuck on an underpowered laptop and can't upgrade yet, a rented box plus Tailscale might be enough to make it feel new.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>productivity</category>
      <category>selfhosted</category>
      <category>linux</category>
    </item>
    <item>
      <title>Why You Should Never Trust the Frontend for Server-Side Verification</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Sat, 03 Oct 2026 19:04:56 +0000</pubDate>
      <link>https://dev.to/dilutedev/why-you-should-never-trust-the-frontend-for-server-side-verification-230n</link>
      <guid>https://dev.to/dilutedev/why-you-should-never-trust-the-frontend-for-server-side-verification-230n</guid>
      <description>&lt;p&gt;Earlier today, I was booking a train ticket online. The platform required NIN (National Identification Number) verification before letting me continue. I entered a valid NIN. The verification call failed with a 500 and a generic &lt;code&gt;SOMETHING_WENT_WRONG&lt;/code&gt;. Not an invalid-NIN error — an actual server failure. Tried again. Same result.&lt;/p&gt;

&lt;p&gt;Curious, I opened Chrome DevTools to see what was actually happening on the wire.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I found
&lt;/h2&gt;

&lt;p&gt;The flow looked roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend --&amp;gt; POST /verify-nin-details?ninNumber=xxxx
Server   --&amp;gt; { status, message, result, errorMessages }
Frontend --&amp;gt; reads response, decides locally whether to proceed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That third step is the whole problem. The server returns a JSON blob describing what happened, and the frontend reads it and makes the call — entirely on its own — about whether verification succeeded. There's no session flag set server-side. No token issued on success. The "verified" state exists only as a JSON object sitting in the browser for as long as the page is open.&lt;/p&gt;

&lt;p&gt;Once you can see the shape of a successful response — trivial, since it's sitting right there in the app's own JS — Chrome's &lt;strong&gt;Local Overrides&lt;/strong&gt; feature (Network tab → right-click a request → &lt;em&gt;Override content&lt;/em&gt;, intended for testing how your frontend handles different responses) will happily serve a response matching that shape instead of the real one. The frontend has no way to tell the difference. It just believes whatever JSON it receives.&lt;/p&gt;

&lt;p&gt;Nothing was actually verified server-side. My browser told my own frontend code a story, and the frontend believed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  This isn't a "hack"
&lt;/h2&gt;

&lt;p&gt;Chrome is doing exactly what it's built to do — Local Overrides exists so you can test your &lt;em&gt;own&lt;/em&gt; frontend's error handling without hammering a real backend. The actual vulnerability is architectural: whenever a security-relevant decision (identity verified, payment confirmed, KYC passed) is made by client-side JS &lt;em&gt;reading a response&lt;/em&gt;, rather than by the server maintaining and re-checking that state itself, the decision is only as trustworthy as the user's browser. Which is to say, not trustworthy at all.&lt;/p&gt;

&lt;p&gt;Anyone who opens DevTools, runs a proxy like mitmproxy or Charles, or writes a two-line &lt;code&gt;fetch&lt;/code&gt; monkeypatch can do this:&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;origFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;fetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;origFetch&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;args&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="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'verify-nin-details'&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;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Response&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;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;verified&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;errorMessages&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;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'application/json'&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;return&lt;/span&gt; &lt;span class="n"&gt;res&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;No special tooling required, no account access needed — just a browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual fix
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Verification state belongs server-side.&lt;/strong&gt; On success, the server should set a session flag or issue a short-lived signed token — something it can independently validate later, not something the client reports back to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-check before anything irreversible.&lt;/strong&gt; Before confirming a booking, issuing a ticket, or unlocking an account, the server should check &lt;em&gt;its own record&lt;/em&gt; of the verification, not trust that the frontend reached a particular UI state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client-side response handling should only drive UX.&lt;/strong&gt; What the user sees next — success screen, retry button, error message — can live in the frontend. Whether an action is &lt;em&gt;authorized&lt;/em&gt; can never live there.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This pattern shows up constantly: age gates, KYC flows, payment "confirmed" states, feature unlocks behind a paywall — any place where "the frontend got a nice response" is quietly being treated as proof that something happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I didn't do
&lt;/h2&gt;

&lt;p&gt;I'm deliberately not including the platform name, the exact endpoint, or the full response payload here — the point isn't "here's how to get through someone's identity check," it's the trust-boundary lesson. I reported the underlying bug (valid NIN → 500) to the platform directly, since that's worth fixing on its own merits regardless of the architecture question.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;If your server returns data describing what happened, and your frontend is the one deciding what that data means for authorization — you don't have server-side verification. You have a browser-side opinion that the server happened to suggest once.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>javascript</category>
      <category>backend</category>
    </item>
    <item>
      <title>How I Built a Soccer Coach Contact Extractor for Messy Athletics Websites</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Tue, 24 Mar 2026 12:21:43 +0000</pubDate>
      <link>https://dev.to/dilutedev/how-i-built-a-soccer-coach-contact-extractor-for-messy-athletics-websites-41hh</link>
      <guid>https://dev.to/dilutedev/how-i-built-a-soccer-coach-contact-extractor-for-messy-athletics-websites-41hh</guid>
      <description>&lt;h1&gt;
  
  
  Most athletics websites look simple until you try to extract structured data from them at scale.
&lt;/h1&gt;

&lt;p&gt;Coach pages are especially messy. One school gives you a clean staff directory with &lt;code&gt;mailto:&lt;/code&gt; links. Another hides emails behind Cloudflare. Another puts names on the roster page and the actual contact info on a separate bio page. Another sends back an empty shell and expects JavaScript to do the rest.&lt;/p&gt;

&lt;p&gt;That is what this project solves.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;football-soccer-emails&lt;/code&gt; is a TypeScript-based extractor that pulls soccer and football coach contact information from athletics websites and turns it into structured records. It supports direct URLs, public Google Sheets, and an Apify workflow for batch runs.&lt;/p&gt;

&lt;p&gt;The reason I built it this way is simple: I tried a version of this problem around 2017 or 2018 using heuristics only, and it was roughly 40% accurate. That was about as far as rules alone would take me. With LLMs and a multi-stage extraction flow, this same class of problem can now get into the 90%+ range.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Core Idea
&lt;/h2&gt;

&lt;p&gt;The project does not rely on one extraction method. It has three:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;heuristic&lt;/code&gt;: free, pattern-based extraction for static sites&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;llm&lt;/code&gt;: AI-assisted extraction through OpenRouter&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;firecrawl&lt;/code&gt;: structured extraction through Firecrawl&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That matters because athletics sites are not consistent enough for a one-size-fits-all scraper. Some pages are easy and should be handled with deterministic parsing. Some are messy but still understandable to an LLM. Some are JavaScript-heavy enough that you want a different extraction path entirely.&lt;/p&gt;

&lt;p&gt;The main pipeline stays simple. It resolves input URLs, builds the selected extractor, fetches HTML when needed, and pushes normalized coach records into the output dataset. The interface is stable even when the extraction strategy changes underneath it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What It Extracts
&lt;/h2&gt;

&lt;p&gt;For each coach, the system tries to capture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;first name&lt;/li&gt;
&lt;li&gt;last name&lt;/li&gt;
&lt;li&gt;title or position&lt;/li&gt;
&lt;li&gt;email&lt;/li&gt;
&lt;li&gt;phone number&lt;/li&gt;
&lt;li&gt;school&lt;/li&gt;
&lt;li&gt;division or conference&lt;/li&gt;
&lt;li&gt;source URL&lt;/li&gt;
&lt;li&gt;profile URL&lt;/li&gt;
&lt;li&gt;confidence levels for name, email, and phone&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those confidence levels are useful because not all matches are equal. A &lt;code&gt;mailto:&lt;/code&gt; link is very different from an email pulled out of weak body text. I wanted the output to show that difference instead of hiding it.&lt;/p&gt;

&lt;p&gt;In the repo, I used a 71-URL comparison batch to sanity-check cost and mode tradeoffs. The heuristic path was still useful, but it left too many messy pages unresolved. The LLM path closed most of that gap and was the difference between a pipeline that felt partly usable and one that could realistically clear 90%+ accuracy on this kind of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the Heuristic Layer Still Matters
&lt;/h2&gt;

&lt;p&gt;It is easy to tell this story like the LLM replaced everything. That is not what happened.&lt;/p&gt;

&lt;p&gt;The heuristic layer still matters because it is fast, free, and trustworthy on obvious patterns. If a page gives me a &lt;code&gt;mailto:&lt;/code&gt; link, a &lt;code&gt;tel:&lt;/code&gt; link, or a Cloudflare-protected email I can decode directly, I would rather use that than ask a model to interpret it.&lt;/p&gt;

&lt;p&gt;The heuristic extractor is layered on purpose. It checks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;mailto:&lt;/code&gt; links&lt;/li&gt;
&lt;li&gt;Cloudflare email protection&lt;/li&gt;
&lt;li&gt;custom data attributes&lt;/li&gt;
&lt;li&gt;JavaScript variable patterns&lt;/li&gt;
&lt;li&gt;reversed text and simple obfuscation&lt;/li&gt;
&lt;li&gt;plain body text&lt;/li&gt;
&lt;li&gt;script tags&lt;/li&gt;
&lt;li&gt;raw HTML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That list only exists because sports sites do weird things. The funny part is how often a page that looks like a soccer directory is also, somewhere in the HTML, a baseball page, a basketball page, and two hidden mobile layouts at the same time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Part That Actually Improved Accuracy
&lt;/h2&gt;

&lt;p&gt;The biggest improvement was not just "use an LLM." It was combining multiple passes.&lt;/p&gt;

&lt;p&gt;If the extractor finds a coach on a roster page but does not find an email, it can follow the coach’s profile URL and try again in &lt;code&gt;profile&lt;/code&gt; mode. That matters because many athletics sites split their data across two layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;roster page: names and titles&lt;/li&gt;
&lt;li&gt;profile page: bio, phone, and email&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without that follow-up pass, you miss a lot of good data. With it, the extractor can keep the roster context and fill in the missing fields from the profile page.&lt;/p&gt;

&lt;p&gt;There is also a guardrail I like here: if a model returns a profile URL on the wrong domain, the code rewrites it back onto the source site. That keeps the pipeline grounded in the actual athletics site instead of trusting a hallucinated cross-domain link.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling the Messy Cases
&lt;/h2&gt;

&lt;p&gt;The project includes a few defensive pieces that came directly from running into bad pages over and over.&lt;/p&gt;

&lt;p&gt;One is SPA detection. If the HTML looks like a React, Vue, or Angular shell instead of a real document, the heuristic extractor can fail explicitly instead of pretending there was just no data.&lt;/p&gt;

&lt;p&gt;Another is hidden-content filtering. Athletics sites often include hidden sections for other sports, old layouts, or alternate mobile markup. If you do not filter that out, you can easily extract the wrong staff from the right page.&lt;/p&gt;

&lt;p&gt;The fetch layer also uses TLS client fingerprinting instead of a plain default fetch stack. That helps with sites that behave differently when the client looks too synthetic.&lt;/p&gt;

&lt;p&gt;None of that is glamorous, but it is the difference between a toy scraper and something you can run in bulk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Built Around Spreadsheets, Not Just Code
&lt;/h2&gt;

&lt;p&gt;I also wanted the workflow to be usable by someone who is not living in the codebase.&lt;/p&gt;

&lt;p&gt;That sounds small, but it changes the project from "a scraper" into something an operator can actually use.&lt;/p&gt;

&lt;p&gt;The project accepts input in three ways:&lt;/p&gt;

&lt;p&gt;The project accepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;direct URL lists&lt;/li&gt;
&lt;li&gt;public Google Sheets&lt;/li&gt;
&lt;li&gt;spreadsheet-driven workflows through Apify and Apps Script&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That means the operating model can stay simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Put coach-page URLs into a sheet.&lt;/li&gt;
&lt;li&gt;Run the extractor in the mode you want.&lt;/li&gt;
&lt;li&gt;Get back structured coach records.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why This Project Matters to Me
&lt;/h2&gt;

&lt;p&gt;What I like about this build is that it settled a question I had back in 2017: could this problem ever be solved well without writing endless custom scraping rules?&lt;/p&gt;

&lt;p&gt;Not in a vague "agentic" marketing sense. Not as magic. Just as a better way to handle messy, inconsistent data that used to force you into an endless loop of brittle rules.&lt;/p&gt;

&lt;p&gt;The old version of this idea topped out around 40% because heuristics had to do everything. This version works because heuristics do the obvious work, LLMs handle ambiguity, and the pipeline follows up when the first pass is incomplete.&lt;/p&gt;

&lt;p&gt;The next step is making that routing automatic so the system can decide, page by page, when cheap rules are enough and when a stronger extractor is worth using.&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>typescript</category>
      <category>llm</category>
      <category>ai</category>
    </item>
    <item>
      <title>Never Miss a Reservation Again: Building an Automated Restaurant Booking Bot</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Sat, 22 Nov 2025 16:33:32 +0000</pubDate>
      <link>https://dev.to/dilutedev/never-miss-a-reservation-again-building-an-automated-restaurant-booking-bot-1mag</link>
      <guid>https://dev.to/dilutedev/never-miss-a-reservation-again-building-an-automated-restaurant-booking-bot-1mag</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;We've all been there. That new restaurant everyone's talking about just opened reservations for next month, and within seconds, every slot is gone. You refresh frantically, check multiple times a day, and still end up empty-handed. The most sought-after restaurants in major cities can book up in literal seconds, making it nearly impossible to secure a table through traditional means.&lt;/p&gt;

&lt;p&gt;What if you could automate the entire process?&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing the Reservation Bot
&lt;/h2&gt;

&lt;p&gt;I built an automated reservation system that monitors restaurant availability across major booking platforms and instantly grabs reservations the moment they become available. Think of it as having a tireless assistant who checks for tables 24/7 and books them the instant they appear.&lt;/p&gt;

&lt;h3&gt;
  
  
  What It Does
&lt;/h3&gt;

&lt;p&gt;The bot handles the entire reservation workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Platform Support&lt;/strong&gt; - Works with both OpenTable and Resy, the two dominant restaurant reservation platforms&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart Monitoring&lt;/strong&gt; - Continuously checks for availability based on your preferences (date, time, party size)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant Booking&lt;/strong&gt; - Automatically secures reservations when spots open up, faster than any human could&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account Management&lt;/strong&gt; - Securely stores your dining platform credentials for seamless bookings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reservation Dashboard&lt;/strong&gt; - View, manage, and cancel all your reservations from a single interface&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How It Works
&lt;/h3&gt;

&lt;p&gt;The system is surprisingly straightforward from a user perspective:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Connect Your Accounts&lt;/strong&gt; - Add your OpenTable and/or Resy login credentials&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search for Venues&lt;/strong&gt; - Browse and select restaurants you want to book&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set Up Inquiries&lt;/strong&gt; - Specify your preferences (dates, times, party size)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let It Run&lt;/strong&gt; - The bot monitors availability and books automatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Behind the scenes, the bot uses scheduled tasks that run continuously, checking for availability and executing reservations the moment a table becomes available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Architecture
&lt;/h2&gt;

&lt;p&gt;For those interested in the technical details, here's what powers the system:&lt;/p&gt;

&lt;h3&gt;
  
  
  Backend Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go (Golang)&lt;/strong&gt; with the Fiber web framework for high-performance HTTP handling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PostgreSQL&lt;/strong&gt; for reliable data persistence&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redis&lt;/strong&gt; for caching and fast lookups&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated scheduling&lt;/strong&gt; via cron jobs for continuous monitoring&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Secure authentication&lt;/strong&gt; with OAuth integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Proxy support&lt;/strong&gt; for account-level IP rotation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrent processing&lt;/strong&gt; to handle multiple inquiries simultaneously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-time logging&lt;/strong&gt; to track booking attempts and successes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The architecture is designed for speed and reliability. When a reservation slot opens up, milliseconds matter. The system can detect and book faster than manual clicking could ever achieve.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases
&lt;/h2&gt;

&lt;p&gt;This bot excels in scenarios where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;New restaurant launches&lt;/strong&gt; - Be first in line when reservations open&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Last-minute cancellations&lt;/strong&gt; - Catch tables that become available unexpectedly&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hard-to-book venues&lt;/strong&gt; - Secure spots at consistently sold-out restaurants&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Special occasions&lt;/strong&gt; - Never miss that anniversary dinner reservation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexible schedules&lt;/strong&gt; - Let the bot find any available slot within your preferred range&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A Note on Responsible Use
&lt;/h2&gt;

&lt;p&gt;This tool is designed to help individuals secure reservations for personal dining experiences. It's important to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only book reservations you actually intend to use&lt;/li&gt;
&lt;li&gt;Cancel promptly if your plans change&lt;/li&gt;
&lt;li&gt;Respect restaurant booking policies&lt;/li&gt;
&lt;li&gt;Use responsibly and ethically&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to level the playing field for regular diners, not to enable scalping or commercial resale of reservations.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;p&gt;The system has successfully automated thousands of reservation bookings across OpenTable and Resy platforms. What used to require constant manual checking and lightning-fast reflexes now happens automatically in the background.&lt;/p&gt;

&lt;p&gt;For popular restaurants that book up instantly, this can mean the difference between never getting a table and dining regularly at your favorite spots.&lt;/p&gt;

&lt;p&gt;The combination of real-time monitoring, instant execution, and multi-platform support makes this one of the most comprehensive restaurant reservation automation tools available.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tech Stack Summary:&lt;/strong&gt; Go, Fiber, PostgreSQL, Redis, OAuth&lt;br&gt;
&lt;strong&gt;Platforms Supported:&lt;/strong&gt; OpenTable, Resy&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built for food enthusiasts who refuse to miss out on their next great dining experience.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>automation</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Building a Fast Web Scraper Without Puppeteer: A Live Coding Challenge</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Mon, 17 Nov 2025 08:39:28 +0000</pubDate>
      <link>https://dev.to/dilutedev/building-a-fast-web-scraper-without-puppeteer-a-live-coding-challenge-2apg</link>
      <guid>https://dev.to/dilutedev/building-a-fast-web-scraper-without-puppeteer-a-live-coding-challenge-2apg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;How I built a production-grade scraper for NC public notices using Cheerio and TLS fingerprinting instead of headless browsers&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Challenge
&lt;/h2&gt;

&lt;p&gt;During a live coding interview, I was tasked with building a scraper for &lt;a href="https://www.ncnotices.com/" rel="noopener noreferrer"&gt;ncnotices.com&lt;/a&gt;, a North Carolina public notices database. The catch? I had limited time and needed to handle a complex ASP.NET application with state management, pagination, and CAPTCHA protection.&lt;/p&gt;

&lt;p&gt;The interviewer mentioned their team used Puppeteer for their existing scraper. I chose a different path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Not Puppeteer?
&lt;/h2&gt;

&lt;p&gt;Don't get me wrong - Puppeteer is fantastic for many use cases. But for this task, it felt like bringing a tank to a knife fight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resource overhead&lt;/strong&gt;: Running a headless Chrome instance uses 100-200MB of RAM per instance&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slower execution&lt;/strong&gt;: Browser startup alone takes 1-2 seconds&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complexity&lt;/strong&gt;: Managing browser lifecycles, waiting for selectors, handling browser crashes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since ncnotices.com renders server-side (classic ASP.NET), I didn't need JavaScript execution. I just needed to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parse HTML efficiently&lt;/li&gt;
&lt;li&gt;Manage cookies and sessions&lt;/li&gt;
&lt;li&gt;Bypass basic bot detection&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Tech Stack
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"cheerio"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^1.1.2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// Fast HTML parsing&lt;/span&gt;
    &lt;span class="s2"&gt;"impit"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^0.7.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// TLS fingerprinting&lt;/span&gt;
    &lt;span class="s2"&gt;"tough-cookie"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^6.0.0"&lt;/span&gt;  &lt;span class="c1"&gt;// Cookie management&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;h3&gt;
  
  
  Key Libraries
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Cheerio&lt;/strong&gt;: jQuery-like HTML parsing that's blazing fast. Perfect for server-rendered content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Impit&lt;/strong&gt;: The secret sauce. This library mimics real browser TLS fingerprints, making requests indistinguishable from actual Chrome/Firefox browsers. Much lighter than Puppeteer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tough-cookie&lt;/strong&gt;: Proper cookie jar implementation for session management.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Technical Challenges
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. ASP.NET ViewState Management
&lt;/h3&gt;

&lt;p&gt;ASP.NET uses &lt;code&gt;__VIEWSTATE&lt;/code&gt; and &lt;code&gt;__VIEWSTATEGENERATOR&lt;/code&gt; tokens for state management. These need to be extracted and sent with each request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="nf"&gt;getStateTokens&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;$&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;CheerioAPI&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;view_state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;view_state_generator&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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;configText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; $&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&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;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"0|hiddenField"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;at&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="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"|"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&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="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;view_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="s2"&gt;"#__VIEWSTATE"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;view_state_generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="s2"&gt;"#__VIEWSTATEGENERATOR"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"value"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;view_state&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;view_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;configText&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;configText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&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;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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="s2"&gt;"__VIEWSTATE"&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="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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;view_state_generator&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;view_state_generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;configText&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;configText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findIndex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&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;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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="s2"&gt;"__VIEWSTATEGENERATOR"&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="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;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;view_state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;view_state_generator&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 tokens can be in hidden fields OR embedded in the response text. I handle both cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Pagination Hell
&lt;/h3&gt;

&lt;p&gt;Classic ASP.NET pagination requires simulating user interactions through POST requests with specific event targets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;queryParams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ctl00&lt;/span&gt;&lt;span class="nv"&gt;$ToolkitScriptManager1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
      &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"ctl00$ContentPlaceHolder1$WSExtendedGridNP1$updateWSGrid|ctl00$ContentPlaceHolder1$WSExtendedGridNP1$GridView1$ctl01$btnNext"&lt;/span&gt;
      &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ctl00$ContentPlaceHolder1$as1$upSearch|ctl00$ContentPlaceHolder1$as1$btnGo"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;__VIEWSTATE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;view_state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;__VIEWSTATEGENERATOR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;view_state_generator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;__ASYNCPOST&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// ... more params&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;Each page requires the previous page's state tokens, creating a chain of requests.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. CAPTCHA Support
&lt;/h3&gt;

&lt;p&gt;The site occasionally shows reCAPTCHA. I built an extensible solver interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ICaptchaSolver&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;solveCaptcha&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;siteKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pageUrl&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;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;This allows plugging in any CAPTCHA solving service (2captcha, Anti-Captcha, etc.) without modifying the scraper logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Session Management
&lt;/h3&gt;

&lt;p&gt;The scraper maintains cookies across requests using tough-cookie:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&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;Impit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"chrome"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;proxyUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;proxyUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;ignoreTlsErrors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;cookieJar&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;CookieJar&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;h2&gt;
  
  
  The Complete Flow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;searchKeyword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;NCSearchItem&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hasNext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;setPreset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Simulate form fill on first request&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getSearchConfig&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;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;NCSearchItem&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="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;do&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;currentItems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;view_state_generator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;view_state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;has_next&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;executeSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setPreset&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&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;currentItems&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;hasNext&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;has_next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;view_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view_state&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;view_state_generator&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view_state_generator&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;setPreset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hasNext&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="n"&gt;items&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;ol&gt;
&lt;li&gt;Get initial config and state tokens&lt;/li&gt;
&lt;li&gt;Execute search with form simulation&lt;/li&gt;
&lt;li&gt;Extract results and pagination state&lt;/li&gt;
&lt;li&gt;Continue until no more pages&lt;/li&gt;
&lt;li&gt;Return all items&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Performance Comparison
&lt;/h2&gt;

&lt;p&gt;Let's crunch the numbers for a realistic scenario: scraping 100 public notices across 10 paginated search result pages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Puppeteer Approach
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser startup:        1,500ms (one-time cost)
10 search page loads:  10 × 300ms = 3,000ms
100 detail page loads: 100 × 300ms = 30,000ms
───────────────────────────────────────────
Total time:            ~34.5 seconds
Memory usage:          ~150MB per instance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  This Approach (Cheerio + Impit)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP client init:      50ms (one-time cost)
10 search requests:    10 × 100ms = 1,000ms
100 detail requests:   100 × 100ms = 10,000ms
───────────────────────────────────────────
Total time:            ~11 seconds
Memory usage:          ~10MB per instance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result: 3.1x faster execution time, 15x lower memory footprint&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scalability on 8GB RAM
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Concurrent Instances&lt;/th&gt;
&lt;th&gt;Theoretical Throughput&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Puppeteer&lt;/td&gt;
&lt;td&gt;~50 instances&lt;/td&gt;
&lt;td&gt;~145 notices/sec&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cheerio + Impit&lt;/td&gt;
&lt;td&gt;~800 instances&lt;/td&gt;
&lt;td&gt;~7,270 notices/sec&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;50x better concurrency&lt;/strong&gt; - though realistically limited by network bandwidth and rate limiting rather than memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Choose the right tool&lt;/strong&gt;: Puppeteer is amazing, but not always necessary&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand the target&lt;/strong&gt;: Server-side rendering = no JavaScript needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLS fingerprinting matters&lt;/strong&gt;: Impit makes requests look legitimate&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State management is crucial&lt;/strong&gt;: ASP.NET apps require careful token handling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build for extensibility&lt;/strong&gt;: The CAPTCHA solver interface allows easy integration&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Outcome
&lt;/h2&gt;

&lt;p&gt;I completed this scraper 2 hours after the interview ended and sent it to the interviewer. While I didn't get the job (they chose another candidate), the interviewer specifically mentioned:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"You are clearly very smart and have a lot of expertise. I will put you at the top of my list for the future."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sometimes the best outcome isn't getting the job - it's building something you're proud of and demonstrating genuine problem-solving skills.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It Yourself
&lt;/h2&gt;

&lt;p&gt;The full source code demonstrates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean TypeScript architecture&lt;/li&gt;
&lt;li&gt;Comprehensive type definitions&lt;/li&gt;
&lt;li&gt;Testable design with dependency injection&lt;/li&gt;
&lt;li&gt;Production-ready error handling
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;scraper&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;NCNotices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"http://your-proxy:8888"&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;results&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;scraper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;searchKeyword&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"foreclosure"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;for&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;searchItem&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;results&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;detail&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;scraper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;searchItem&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;detail&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;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Web scraping isn't about using the most popular tools - it's about understanding your target, choosing the right approach, and building maintainable solutions. Sometimes a lightweight HTTP client with good HTML parsing beats a full browser automation framework.&lt;/p&gt;

&lt;p&gt;What's your experience with web scraping? Have you faced similar challenges with state management or bot detection? Drop a comment below!&lt;/p&gt;




&lt;h2&gt;
  
  
  P.S. - The Plot Twist
&lt;/h2&gt;

&lt;p&gt;So... did I get the job?&lt;/p&gt;

&lt;p&gt;Spoiler alert: Nope! But hey, I had fun building this and learned a ton in the process. Sometimes the best outcome isn't getting hired - it's the skills you sharpen and the code you're proud to share.&lt;/p&gt;

&lt;p&gt;Plus, I got one of the nicest rejection messages I've ever received:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgra9uluzg1yxfentrom3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgra9uluzg1yxfentrom3.png" alt="Rejection email showing interviewer's appreciation" width="798" height="123"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not bad for a live coding challenge I completed 2 hours after the interview ended. 😄&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Interested in more deep dives on web scraping, TypeScript, and performance optimization? Follow me for more technical breakdowns!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>webscraping</category>
      <category>node</category>
      <category>performance</category>
    </item>
    <item>
      <title>Building a Full-Stack Product Monitoring System: A Technical Deep Dive</title>
      <dc:creator>Isaac Sunday</dc:creator>
      <pubDate>Sun, 16 Nov 2025 22:18:17 +0000</pubDate>
      <link>https://dev.to/dilutedev/building-a-full-stack-product-monitoring-system-a-technical-deep-dive-27j0</link>
      <guid>https://dev.to/dilutedev/building-a-full-stack-product-monitoring-system-a-technical-deep-dive-27j0</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;This is a production-grade, full-stack application designed to monitor product availability on an e-commerce website. The system automatically tracks inventory changes, sends Discord notifications for new products and restocks, and provides a comprehensive admin dashboard for monitoring configuration.&lt;/p&gt;

&lt;p&gt;This technical deep-dive explores the architecture, design decisions, and implementation strategies behind building a scalable monitoring system capable of handling thousands of products with real-time notifications.&lt;/p&gt;

&lt;h2&gt;
  
  
  System Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  High-Level Architecture
&lt;/h3&gt;

&lt;p&gt;The application follows a modern hybrid architecture combining TypeScript and Go microservices:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────┐      ┌─────────────────┐      ┌──────────────────┐
│   React 19      │─────▶│   Fastify       │─────▶│  PostgreSQL 16   │
│   Frontend      │◀─────│   Backend (TS)  │◀─────│    Database      │
│   (Port 80)     │      │   (Port 4000)   │      │   (Port 5432)    │
└─────────────────┘      └─────────────────┘      └──────────────────┘
                               │         │
                               │         └────────▶┌──────────────────┐
                               │                   │  Go Checkout API │
                               │                   │    (Port 8080)   │
                               │                   │  ┌────────────┐  │
                               │                   │  │ TLS Client │  │
                               │                   │  │  Akamai    │  │
                               │                   │  └────────────┘  │
                               │                   └──────────────────┘
                               ▼
                         ┌──────────┐         ┌─────────────┐
                         │  Redis 7 │◀───────▶│   BullMQ    │
                         │(Port 6379)│        │ Job Queues  │
                         └──────────┘         └─────────────┘
                               │
                               ▼
                         ┌──────────┐
                         │  Discord │
                         │ Webhooks │
                         └──────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Architecture Decisions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Go Microservice for Checkout (Critical Decision)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why Go instead of TypeScript?&lt;/strong&gt; The checkout flow requires bypassing sophisticated bot protection (Akamai)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLS Fingerprinting:&lt;/strong&gt; Modern websites fingerprint TLS handshakes to detect bots. Node.js's built-in HTTP client has a static TLS fingerprint that's easily detected and blocked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bogdanfinn/tls-client:&lt;/strong&gt; Go library that allows custom TLS fingerprints mimicking real browsers (Chrome 133 profile)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advanced HTTP/2 Features:&lt;/strong&gt; Precise control over header ordering, pseudo-headers, and connection properties&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hyper Solutions SDK:&lt;/strong&gt; Commercial Akamai bypass solution with sensor data generation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Result:&lt;/strong&gt; Successfully bypasses bot detection while maintaining high performance and reliability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Fastify over Express&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fastify was chosen for its superior performance (up to 2x faster than Express in benchmarks)&lt;/li&gt;
&lt;li&gt;Built-in schema validation with JSON Schema&lt;/li&gt;
&lt;li&gt;Native TypeScript support and excellent plugin ecosystem&lt;/li&gt;
&lt;li&gt;First-class async/await support without middleware complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. BullMQ for Job Processing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reliable job queue with Redis backing for distributed task processing&lt;/li&gt;
&lt;li&gt;Built-in support for retries, delayed jobs, and repeatable patterns&lt;/li&gt;
&lt;li&gt;Priority queues for handling different notification types&lt;/li&gt;
&lt;li&gt;Persistent job storage prevents data loss during restarts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. PostgreSQL with Zapatos&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type-safe database queries without ORM overhead&lt;/li&gt;
&lt;li&gt;Direct SQL when needed with full TypeScript inference&lt;/li&gt;
&lt;li&gt;Automatic type generation from database schema&lt;/li&gt;
&lt;li&gt;Eliminates runtime type mismatches between DB and application&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Redis for Caching and Queue Management&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Low-latency caching for frequently accessed data&lt;/li&gt;
&lt;li&gt;BullMQ job queue backing&lt;/li&gt;
&lt;li&gt;Session storage for authentication&lt;/li&gt;
&lt;li&gt;Pub/sub capabilities for real-time features&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Backend Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Application Structure
&lt;/h3&gt;

&lt;p&gt;The backend follows a clean, modular architecture with separate TypeScript and Go services:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TypeScript Backend:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/backend/
├── config/              # Environment and database configuration
├── controllers/         # Request handlers (thin layer)
├── services/           # Business logic layer
├── routes/             # API route definitions
├── middleware/         # Authentication and validation
├── jobs/               # Background job processing
│   ├── queues.ts      # BullMQ queue setup
│   └── workers.ts     # Job processors
└── server.ts          # Application entry point
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Go Checkout Service:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmd/api/
└── main.go             # Fiber HTTP server (Port 8080)

src/
├── checkout.go         # Main checkout flow orchestration
├── checkout_types.go   # Type definitions
├── akamai.go          # Akamai bot bypass implementation
├── headers.go         # Browser-like header generation
└── card.go            # Credit card validation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dependency Injection Pattern
&lt;/h3&gt;

&lt;p&gt;The application uses a centralized dependency management system to handle database and Redis connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified dependency management pattern&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppDependencies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Pool&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;connect&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;// Initialize connections&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"SELECT 1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ping&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;static&lt;/span&gt; &lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Return requested dependency&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;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single source of truth for shared resources&lt;/li&gt;
&lt;li&gt;Easy testing with mock dependencies&lt;/li&gt;
&lt;li&gt;Graceful connection management and cleanup&lt;/li&gt;
&lt;li&gt;Type-safe dependency access&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication System
&lt;/h3&gt;

&lt;p&gt;JWT-based authentication with bcrypt password hashing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stateless authentication using JWT tokens&lt;/li&gt;
&lt;li&gt;10-round bcrypt hashing for password security&lt;/li&gt;
&lt;li&gt;Cookie-based token storage with httpOnly flag&lt;/li&gt;
&lt;li&gt;Token expiration and refresh patterns&lt;/li&gt;
&lt;li&gt;Protected routes via middleware&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Authentication Flow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User submits credentials&lt;/li&gt;
&lt;li&gt;Password verified against bcrypt hash&lt;/li&gt;
&lt;li&gt;JWT token generated with user claims&lt;/li&gt;
&lt;li&gt;Token stored in httpOnly cookie&lt;/li&gt;
&lt;li&gt;Subsequent requests validated via middleware&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Go Checkout Microservice
&lt;/h3&gt;

&lt;p&gt;The checkout functionality is implemented as a separate Go microservice that communicates with the TypeScript backend via HTTP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture Pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TypeScript backend receives checkout request from user&lt;/li&gt;
&lt;li&gt;Backend validates task and assembles checkout payload&lt;/li&gt;
&lt;li&gt;HTTP request sent to Go service at &lt;code&gt;GO_API_URL&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Go service performs checkout with TLS fingerprinting&lt;/li&gt;
&lt;li&gt;Response returned to TypeScript backend&lt;/li&gt;
&lt;li&gt;Backend updates database and sends notifications&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Key Technologies:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fiber Framework:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High-performance web framework for Go (built on Fastify)&lt;/li&gt;
&lt;li&gt;Minimal API surface: &lt;code&gt;/checkout&lt;/code&gt;, &lt;code&gt;/checkout/:id&lt;/code&gt;, &lt;code&gt;/status&lt;/code&gt;, &lt;code&gt;/health&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Context-based request cancellation support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;TLS Client (bogdanfinn/tls-client):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Custom TLS fingerprinting to mimic Chrome 133&lt;/li&gt;
&lt;li&gt;Randomized TLS extension ordering&lt;/li&gt;
&lt;li&gt;Support for HTTP/2 with precise control&lt;/li&gt;
&lt;li&gt;Cookie jar management with domain-specific cookies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Akamai Bypass Implementation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Akamai client implements a sophisticated multi-step bot detection bypass:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Script Extraction:&lt;/strong&gt; Parse Akamai bot detection script from HTML&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sensor Generation:&lt;/strong&gt; Generate sensor data using Hyper Solutions SDK&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cookie Management:&lt;/strong&gt; Track &lt;code&gt;_abck&lt;/code&gt; and &lt;code&gt;bm_sz&lt;/code&gt; cookies&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SBSD Challenge Handling:&lt;/strong&gt; Detect and solve secondary challenges automatically&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IP Consistency:&lt;/strong&gt; Maintain consistent IP address for session validation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Checkout Flow (src/checkout.go:39-118):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Generate&lt;/span&gt; &lt;span class="n"&gt;visitor&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;visit&lt;/span&gt; &lt;span class="nc"&gt;IDs&lt;/span&gt; &lt;span class="n"&gt;from&lt;/span&gt; &lt;span class="nc"&gt;Oracle&lt;/span&gt; &lt;span class="n"&gt;tracking&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt; &lt;span class="n"&gt;session&lt;/span&gt; &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_abck&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bm_sz&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;AGEVERIFY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="n"&gt;product&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;cart&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="nc"&gt;Akamai&lt;/span&gt; &lt;span class="n"&gt;sensor&lt;/span&gt;
&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Add&lt;/span&gt; &lt;span class="n"&gt;shipping&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="n"&gt;information&lt;/span&gt;
&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Validate&lt;/span&gt; &lt;span class="n"&gt;inventory&lt;/span&gt; &lt;span class="n"&gt;availability&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Update&lt;/span&gt; &lt;span class="n"&gt;cart&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="n"&gt;pricing&lt;/span&gt;
&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Tokenize&lt;/span&gt; &lt;span class="n"&gt;credit&lt;/span&gt; &lt;span class="n"&gt;card&lt;/span&gt; &lt;span class="n"&gt;via&lt;/span&gt; &lt;span class="nc"&gt;CardConnect&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nc"&gt;Submit&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="n"&gt;payment&lt;/span&gt; &lt;span class="n"&gt;details&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Error Handling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Context cancellation for user-initiated aborts&lt;/li&gt;
&lt;li&gt;Automatic retry logic for transient failures&lt;/li&gt;
&lt;li&gt;Comprehensive error messages for debugging&lt;/li&gt;
&lt;li&gt;Graceful fallback when challenges fail&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Security Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Credit card tokenization via CardConnect (PCI compliance)&lt;/li&gt;
&lt;li&gt;Proxy rotation support for IP diversity&lt;/li&gt;
&lt;li&gt;No credential storage (stateless operation)&lt;/li&gt;
&lt;li&gt;Request validation and sanitization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Integration Pattern:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The TypeScript backend integrates via a &lt;code&gt;CheckoutClient&lt;/code&gt; class (src/checkout.ts):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="kc"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CheckoutResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="sb"&gt;`/checkout`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;requestPayload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s1"&gt;'X-Checkout-ID'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;taskId&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;&lt;strong&gt;Benefits of This Hybrid Approach:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript handles business logic, database, and orchestration&lt;/li&gt;
&lt;li&gt;Go handles performance-critical bot bypass operations&lt;/li&gt;
&lt;li&gt;Each service optimized for its specific use case&lt;/li&gt;
&lt;li&gt;Independent scaling and deployment&lt;/li&gt;
&lt;li&gt;Clear separation of concerns&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  API Design
&lt;/h3&gt;

&lt;p&gt;RESTful API with clear resource-based routing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Endpoints:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/api/auth/*&lt;/code&gt; - Authentication (login, register, me)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/filtered-products&lt;/code&gt; - Keyword-based monitoring&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/restock-products&lt;/code&gt; - Product restock tracking&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/webhooks&lt;/code&gt; - Discord webhook management&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/proxies&lt;/code&gt; - Proxy configuration&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/dashboard&lt;/code&gt; - Statistics and activity&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/products&lt;/code&gt; - Product search and details&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/api/user-tasks&lt;/code&gt; - User task management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;API Patterns:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent error handling with proper HTTP status codes&lt;/li&gt;
&lt;li&gt;Request validation using JSON Schema&lt;/li&gt;
&lt;li&gt;Paginated responses for large datasets&lt;/li&gt;
&lt;li&gt;Filtering and search capabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Job Queue System
&lt;/h2&gt;

&lt;h3&gt;
  
  
  BullMQ Integration
&lt;/h3&gt;

&lt;p&gt;The monitoring system uses BullMQ for handling asynchronous jobs with different priorities and schedules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Job Types:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;scrape-all&lt;/strong&gt; (Scheduled)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs every 30 minutes&lt;/li&gt;
&lt;li&gt;Fetches sitemap from target website&lt;/li&gt;
&lt;li&gt;Identifies new products&lt;/li&gt;
&lt;li&gt;Queues individual product scrape jobs&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;scrape-product&lt;/strong&gt; (On-demand)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scrapes individual product details&lt;/li&gt;
&lt;li&gt;Updates product information in database&lt;/li&gt;
&lt;li&gt;Triggers notifications for new products&lt;/li&gt;
&lt;li&gt;Handles keyword matching for filtered alerts&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;monitor-restock&lt;/strong&gt; (Periodic)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checks specific products for stock changes&lt;/li&gt;
&lt;li&gt;Compares current vs previous stock levels&lt;/li&gt;
&lt;li&gt;Triggers restock notifications when inventory increases&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;alert&lt;/strong&gt; (Immediate)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sends Discord webhook notifications&lt;/li&gt;
&lt;li&gt;Handles different notification types&lt;/li&gt;
&lt;li&gt;Manages user-specific alerts&lt;/li&gt;
&lt;li&gt;Supports batch notification delivery&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Worker Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concurrency:&lt;/strong&gt; 100 concurrent jobs for high throughput&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Error Handling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic retry with exponential backoff&lt;/li&gt;
&lt;li&gt;Failed job logging with full context&lt;/li&gt;
&lt;li&gt;Dead letter queue for persistent failures&lt;/li&gt;
&lt;li&gt;Monitoring via Bull Board UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Graceful Shutdown:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Graceful shutdown pattern&lt;/span&gt;
&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SIGTERM'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;worker&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&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;// Finish current jobs&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;disconnect&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;await&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;end&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;h2&gt;
  
  
  Database Design
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Schema Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Core Tables:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;users&lt;/strong&gt; - User accounts and authentication&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;products&lt;/strong&gt; - Product catalog with inventory tracking&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;product_meta&lt;/strong&gt; - Extended product information&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;filtered_products&lt;/strong&gt; - Keyword-based monitoring rules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;restock_products&lt;/strong&gt; - Product restock subscriptions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;user_webhooks&lt;/strong&gt; - Discord webhook configurations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;user_proxies&lt;/strong&gt; - Proxy pool management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;user_tasks&lt;/strong&gt; - Custom user automation tasks&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Migration Strategy
&lt;/h3&gt;

&lt;p&gt;Using dbmate for database migrations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Version-controlled schema changes&lt;/li&gt;
&lt;li&gt;Up/down migration support&lt;/li&gt;
&lt;li&gt;Language-agnostic SQL migrations&lt;/li&gt;
&lt;li&gt;Simple CLI interface&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Workflow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create migration: &lt;code&gt;dbmate new add_feature&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Write up/down SQL&lt;/li&gt;
&lt;li&gt;Apply: &lt;code&gt;dbmate up&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generate types: &lt;code&gt;npx zapatos&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Type-Safe Queries with Zapatos
&lt;/h3&gt;

&lt;p&gt;Zapatos generates TypeScript types directly from the database schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Type-safe queries&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s1"&gt;'products'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;in_stock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conditions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gt&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="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;columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'id'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'price'&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="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Full type inference - no manual typing needed&lt;/span&gt;
&lt;span class="c1"&gt;// products: Array&amp;lt;{ id: string, name: string, price: number }&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compile-time type checking&lt;/li&gt;
&lt;li&gt;Autocomplete for table names and columns&lt;/li&gt;
&lt;li&gt;Zero runtime overhead (generates SQL)&lt;/li&gt;
&lt;li&gt;Catches schema mismatches before deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Web Scraping &amp;amp; Monitoring
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scraping Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Strategy:&lt;/strong&gt; Polite scraping with proxy rotation and rate limiting&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Components:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Sitemap Parsing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetches XML sitemap from target website&lt;/li&gt;
&lt;li&gt;Extracts product URLs&lt;/li&gt;
&lt;li&gt;Identifies new products not in database&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Product Extraction&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses Cheerio for HTML parsing&lt;/li&gt;
&lt;li&gt;Extracts structured product data&lt;/li&gt;
&lt;li&gt;Handles dynamic content and variations&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Proxy Management&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Random proxy selection per request&lt;/li&gt;
&lt;li&gt;Health checking and rotation&lt;/li&gt;
&lt;li&gt;User-specific proxy support&lt;/li&gt;
&lt;li&gt;Fallback to direct requests&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Rate Limiting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configurable delays between requests&lt;/li&gt;
&lt;li&gt;Queue-based throttling&lt;/li&gt;
&lt;li&gt;Respectful of target server resources&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Notification System
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Discord Integration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rich embeds with product images&lt;/li&gt;
&lt;li&gt;Multiple notification types (new products, restocks, filtered)&lt;/li&gt;
&lt;li&gt;User-specific webhook routing&lt;/li&gt;
&lt;li&gt;Batch notification support&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Notification Types:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;New Products&lt;/strong&gt; - All newly discovered products&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filtered Products&lt;/strong&gt; - Keyword-matched products for specific users&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restocks&lt;/strong&gt; - Inventory increase alerts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Whiskey Release&lt;/strong&gt; - Special release notifications&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Frontend Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  React 19 with TypeScript
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technology Stack:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React 19 with latest features&lt;/li&gt;
&lt;li&gt;TypeScript for type safety&lt;/li&gt;
&lt;li&gt;Vite for fast builds and HMR&lt;/li&gt;
&lt;li&gt;React Router for client-side routing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Component Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/frontend/
├── components/         # Reusable UI components
│   └── Card.tsx       # Generic card component
├── pages/             # Route-based page components
│   ├── SignIn.tsx
│   ├── SignUp.tsx
│   ├── Dashboard.tsx
│   ├── NewFilteredProducts.tsx
│   ├── Restocks.tsx
│   ├── Webhooks.tsx
│   ├── Proxies.tsx
│   └── UserTasks.tsx
├── App.tsx            # Root component with routing
└── main.tsx           # Entry point
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  State Management
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Approach:&lt;/strong&gt; Local state with fetch-on-mount pattern&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rationale:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple dashboard application without complex state&lt;/li&gt;
&lt;li&gt;Direct API calls from components&lt;/li&gt;
&lt;li&gt;Minimal state synchronization needs&lt;/li&gt;
&lt;li&gt;Reduced bundle size (no Redux/MobX)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Authentication Flow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Login form submission&lt;/li&gt;
&lt;li&gt;API call with credentials&lt;/li&gt;
&lt;li&gt;JWT token stored in httpOnly cookie&lt;/li&gt;
&lt;li&gt;Protected routes check token validity&lt;/li&gt;
&lt;li&gt;Automatic redirect to login if unauthorized&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  DevOps &amp;amp; Deployment
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Docker Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Multi-Container Setup:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend container (Nginx-served static files)&lt;/li&gt;
&lt;li&gt;Backend container (Node.js/TypeScript application)&lt;/li&gt;
&lt;li&gt;Go API container (Checkout microservice)&lt;/li&gt;
&lt;li&gt;Redis container (cache and job queue)&lt;/li&gt;
&lt;li&gt;PostgreSQL external (managed database)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Docker Compose Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service orchestration&lt;/li&gt;
&lt;li&gt;Health checks for dependencies&lt;/li&gt;
&lt;li&gt;Volume mounting for development&lt;/li&gt;
&lt;li&gt;Environment-based configuration&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Development Workflow
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Local Development:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Terminal 1 - Backend with hot reload&lt;/span&gt;
yarn dev:backend

&lt;span class="c"&gt;# Terminal 2 - Frontend with Vite HMR&lt;/span&gt;
yarn dev:frontend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Docker Development:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start all services&lt;/span&gt;
docker compose up -d

&lt;span class="c"&gt;# View logs&lt;/span&gt;
docker compose logs -f backend

&lt;span class="c"&gt;# Rebuild after changes&lt;/span&gt;
docker compose up -d --build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Security Considerations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Application Security:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT tokens with expiration&lt;/li&gt;
&lt;li&gt;Bcrypt password hashing (10 rounds)&lt;/li&gt;
&lt;li&gt;SQL injection prevention via parameterized queries&lt;/li&gt;
&lt;li&gt;CORS configuration for API protection&lt;/li&gt;
&lt;li&gt;Webhook URL validation&lt;/li&gt;
&lt;li&gt;Input sanitization and validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure Security:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Environment-based secrets (no hardcoded credentials)&lt;/li&gt;
&lt;li&gt;TLS/SSL for database connections&lt;/li&gt;
&lt;li&gt;Redis password authentication&lt;/li&gt;
&lt;li&gt;Docker network isolation&lt;/li&gt;
&lt;li&gt;Read-only volume mounts where appropriate&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Performance Optimizations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Backend Optimizations
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Connection Pooling&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL connection pool for efficient DB access&lt;/li&gt;
&lt;li&gt;Redis connection reuse across requests&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Job Queue Concurrency&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;100 concurrent workers for parallel processing&lt;/li&gt;
&lt;li&gt;Bulk job enqueueing for efficiency&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Database Indexing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Indexed foreign keys&lt;/li&gt;
&lt;li&gt;Composite indexes for common queries&lt;/li&gt;
&lt;li&gt;Unique constraints for fast lookups&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Caching Strategy&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redis caching for frequent queries&lt;/li&gt;
&lt;li&gt;LRU eviction policy&lt;/li&gt;
&lt;li&gt;Configurable TTLs per data type&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Frontend Optimizations
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Build Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vite's optimized bundling&lt;/li&gt;
&lt;li&gt;Tree shaking for smaller bundles&lt;/li&gt;
&lt;li&gt;Code splitting for route-based loading&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Asset Optimization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lazy loading for images&lt;/li&gt;
&lt;li&gt;Minified CSS and JavaScript&lt;/li&gt;
&lt;li&gt;Gzip compression in production&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Testing Strategy
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Test Infrastructure
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Framework:&lt;/strong&gt; Jest with TypeScript support&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separate test database&lt;/li&gt;
&lt;li&gt;Environment-based test configuration&lt;/li&gt;
&lt;li&gt;Long timeout for integration tests&lt;/li&gt;
&lt;li&gt;VM modules for ESM compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Test Types
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unit Tests&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Service layer business logic&lt;/li&gt;
&lt;li&gt;Utility functions&lt;/li&gt;
&lt;li&gt;Data transformations&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Integration Tests&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API endpoint testing&lt;/li&gt;
&lt;li&gt;Database operations&lt;/li&gt;
&lt;li&gt;Job queue processing&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;E2E Tests&lt;/strong&gt; (Future)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User flows&lt;/li&gt;
&lt;li&gt;Authentication scenarios&lt;/li&gt;
&lt;li&gt;Critical paths&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Monitoring &amp;amp; Observability
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Logging
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Structured Logging:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSON-formatted logs&lt;/li&gt;
&lt;li&gt;Contextual metadata (module, timestamp, error traces)&lt;/li&gt;
&lt;li&gt;Different log levels (debug, info, warn, error)&lt;/li&gt;
&lt;li&gt;Production vs development logging strategies&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Job Queue Monitoring
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Bull Board Integration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web UI for queue visualization&lt;/li&gt;
&lt;li&gt;Real-time job status&lt;/li&gt;
&lt;li&gt;Failed job inspection&lt;/li&gt;
&lt;li&gt;Job retry management&lt;/li&gt;
&lt;li&gt;Performance metrics&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Health Checks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Endpoint:&lt;/strong&gt; &lt;code&gt;/health&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database connectivity check&lt;/li&gt;
&lt;li&gt;Redis availability check&lt;/li&gt;
&lt;li&gt;System timestamp&lt;/li&gt;
&lt;li&gt;Quick response for load balancers&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lessons Learned &amp;amp; Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What Worked Well
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Type Safety Everywhere&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zapatos for database types&lt;/li&gt;
&lt;li&gt;TypeScript across frontend and backend&lt;/li&gt;
&lt;li&gt;Fewer runtime errors, better developer experience&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Dependency Injection Pattern&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy testing with mocked dependencies&lt;/li&gt;
&lt;li&gt;Clean resource management&lt;/li&gt;
&lt;li&gt;Single source of truth for connections&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Job Queue Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decoupled processing from API requests&lt;/li&gt;
&lt;li&gt;Reliable with built-in retries&lt;/li&gt;
&lt;li&gt;Scalable horizontal processing&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Docker for Development&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consistent environment across team&lt;/li&gt;
&lt;li&gt;Easy onboarding for new developers&lt;/li&gt;
&lt;li&gt;Production-like local setup&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Challenges &amp;amp; Solutions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Challenge 1: Bot Detection and TLS Fingerprinting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Node.js HTTP clients getting blocked by Akamai bot detection&lt;/li&gt;
&lt;li&gt;Root Cause: Static TLS fingerprints and predictable HTTP/2 characteristics&lt;/li&gt;
&lt;li&gt;Solution: Implemented Go microservice with bogdanfinn/tls-client for dynamic TLS fingerprinting&lt;/li&gt;
&lt;li&gt;Outcome: Successfully bypassed Akamai protection with Chrome 133 browser profile&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 2: Akamai Sensor Data Generation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Complex JavaScript-based bot detection requiring precise sensor payload&lt;/li&gt;
&lt;li&gt;Solution: Integrated Hyper Solutions SDK for commercial-grade Akamai bypass&lt;/li&gt;
&lt;li&gt;Implementation: Real-time sensor generation with context preservation across requests&lt;/li&gt;
&lt;li&gt;Result: Consistent checkout success rate with minimal detection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 3: Multi-Language Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Coordinating TypeScript and Go services with different paradigms&lt;/li&gt;
&lt;li&gt;Solution: Clean HTTP API contract with JSON payloads and typed interfaces&lt;/li&gt;
&lt;li&gt;Benefits: Each language handles what it does best (TS for orchestration, Go for performance)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 4: Rate Limiting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Getting blocked by target website&lt;/li&gt;
&lt;li&gt;Solution: Proxy rotation and intelligent delays&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 5: Database Type Sync&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Manual type definitions going stale&lt;/li&gt;
&lt;li&gt;Solution: Automated type generation with Zapatos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 6: Worker Failures&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Jobs failing silently&lt;/li&gt;
&lt;li&gt;Solution: Comprehensive error logging and Bull Board monitoring&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenge 7: Docker Networking&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Problem: Services unable to communicate&lt;/li&gt;
&lt;li&gt;Solution: Proper network configuration and service discovery&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Planned Features
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Advanced Analytics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Price history tracking&lt;/li&gt;
&lt;li&gt;Stock pattern analysis&lt;/li&gt;
&lt;li&gt;Sell-out time predictions&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Preferences&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Customizable notification frequency&lt;/li&gt;
&lt;li&gt;Product category filters&lt;/li&gt;
&lt;li&gt;Price threshold alerts&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;API Rate Limiting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Per-user rate limits&lt;/li&gt;
&lt;li&gt;API key management&lt;/li&gt;
&lt;li&gt;Usage analytics&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enhanced Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Comprehensive E2E test coverage&lt;/li&gt;
&lt;li&gt;Load testing for scalability&lt;/li&gt;
&lt;li&gt;Automated security scanning&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Scaling Considerations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Horizontal Scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stateless backend for easy replication&lt;/li&gt;
&lt;li&gt;Shared Redis for distributed locking&lt;/li&gt;
&lt;li&gt;Database read replicas for queries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Performance Improvements:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GraphQL for efficient data fetching&lt;/li&gt;
&lt;li&gt;Server-side rendering for faster initial load&lt;/li&gt;
&lt;li&gt;CDN for static asset delivery&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this monitoring system provided valuable insights into creating a production-grade application. The combination of modern technologies (Fastify, React 19, BullMQ, Zapatos, Go) with solid architectural patterns resulted in a maintainable, scalable application.&lt;/p&gt;

&lt;p&gt;Key takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Polyglot architecture works:&lt;/strong&gt; Using TypeScript for business logic and Go for performance-critical operations proved highly effective&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TLS fingerprinting matters:&lt;/strong&gt; Modern bot detection requires sophisticated bypass techniques that standard HTTP libraries can't provide&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type safety reduces bugs:&lt;/strong&gt; Both TypeScript and Go's type systems caught errors at compile time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Job queues are essential:&lt;/strong&gt; Asynchronous processing decouples operations and improves reliability&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker simplifies deployment:&lt;/strong&gt; Multi-service orchestration becomes manageable with proper containerization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commercial SDKs have value:&lt;/strong&gt; Hyper Solutions SDK saved weeks of reverse engineering Akamai protection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and observability are critical:&lt;/strong&gt; Bull Board and structured logging enabled rapid debugging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The system successfully monitors thousands of products, delivers real-time notifications, performs automated checkouts while bypassing sophisticated bot detection, and provides a robust platform for future enhancements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The hybrid TypeScript/Go architecture demonstrates that choosing the right tool for each job—even within the same application—leads to better outcomes than forcing a single technology to handle all requirements.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Tech Stack Summary
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Frontend:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React 19&lt;/li&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;Vite&lt;/li&gt;
&lt;li&gt;React Router&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend (TypeScript):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fastify&lt;/li&gt;
&lt;li&gt;TypeScript&lt;/li&gt;
&lt;li&gt;Node.js&lt;/li&gt;
&lt;li&gt;Zapatos (type-safe DB queries)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend (Go):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fiber (web framework)&lt;/li&gt;
&lt;li&gt;Go 1.24.5&lt;/li&gt;
&lt;li&gt;bogdanfinn/tls-client (TLS fingerprinting)&lt;/li&gt;
&lt;li&gt;Hyper Solutions SDK (Akamai bypass)&lt;/li&gt;
&lt;li&gt;PuerkitoBio/goquery (HTML parsing)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Database &amp;amp; Cache:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL 16&lt;/li&gt;
&lt;li&gt;Redis 7&lt;/li&gt;
&lt;li&gt;Zapatos (type-safe queries)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Job Processing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;BullMQ&lt;/li&gt;
&lt;li&gt;Bull Board (monitoring)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Authentication &amp;amp; Security:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT (jsonwebtoken)&lt;/li&gt;
&lt;li&gt;Bcrypt&lt;/li&gt;
&lt;li&gt;CardConnect (payment tokenization)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker &amp;amp; Docker Compose&lt;/li&gt;
&lt;li&gt;Nginx (frontend serving)&lt;/li&gt;
&lt;li&gt;Multi-service orchestration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Development Tools:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Jest (testing)&lt;/li&gt;
&lt;li&gt;dbmate (migrations)&lt;/li&gt;
&lt;li&gt;tsx (TypeScript execution)&lt;/li&gt;
&lt;li&gt;Go modules (dependency management)&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Author:&lt;/strong&gt; &lt;a href="https://www.github.com/dilutedev" rel="noopener noreferrer"&gt;Isaac Sunday&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Last Updated:&lt;/strong&gt; November 2025&lt;/p&gt;

</description>
      <category>webscraping</category>
      <category>webdev</category>
      <category>antibots</category>
    </item>
  </channel>
</rss>
