<?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: Daisy Auma</title>
    <description>The latest articles on DEV Community by Daisy Auma (@daisyauma).</description>
    <link>https://dev.to/daisyauma</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%2F1223876%2F3f30736b-9125-455e-b2eb-96f2e5bdc848.png</url>
      <title>DEV Community: Daisy Auma</title>
      <link>https://dev.to/daisyauma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daisyauma"/>
    <language>en</language>
    <item>
      <title>My 2026 Year in Code: 110 Commits, Python on Top</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Thu, 03 Dec 2026 13:47:30 +0000</pubDate>
      <link>https://dev.to/daisyauma/my-2026-year-in-code-110-commits-python-on-top-28e2</link>
      <guid>https://dev.to/daisyauma/my-2026-year-in-code-110-commits-python-on-top-28e2</guid>
      <description>&lt;p&gt;&lt;a href="https://git-wrapped.com/2026/Daisy-Faith-Auma" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgit-wrapped.com%2Fapi%2Fgithub%2Fwrapped-card%3Fusername%3DDaisy-Faith-Auma%26theme%3D0" alt="@Daisy-Faith-Auma's GitHub Wrapped 2026" width="1200" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My 2026 in code: 110 commits, with Python on top.&lt;/p&gt;

&lt;p&gt;It's not a huge number, and I'm fine with that. Most of my year went into teaching, writing docs and building &lt;a href="https://www.luxdevhq.ai/" rel="noopener noreferrer"&gt;LuxDevHQ&lt;/a&gt;, so my GitHub only really got going mid-year. Once it did, October was my busiest month, and Wednesdays turned out to be my most productive day.&lt;/p&gt;

&lt;p&gt;My language split sums up the year:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Python 57% + Jupyter 26%&lt;/strong&gt;: my MSc in Data Science at UEL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript 11%&lt;/strong&gt;: side projects, including a Reddit hackathon entry&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A little PLpgSQL and QML&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My longest streak was 4 days. Beating it is my 2027 goal.&lt;/p&gt;

&lt;p&gt;What did your year in code look like? You can get yours at &lt;a href="https://git-wrapped.com" rel="noopener noreferrer"&gt;git-wrapped.com&lt;/a&gt;. Drop your card in the comments.&lt;/p&gt;

</description>
      <category>github</category>
      <category>python</category>
      <category>datascience</category>
      <category>typescript</category>
    </item>
    <item>
      <title>I Gave My GitHub Profile a Glow-Up: Daisies, Docs and a Pixel Bonsai</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Tue, 01 Dec 2026 06:00:00 +0000</pubDate>
      <link>https://dev.to/daisyauma/i-gave-my-github-profile-a-glow-up-daisies-docs-and-a-pixel-bonsai-2fak</link>
      <guid>https://dev.to/daisyauma/i-gave-my-github-profile-a-glow-up-daisies-docs-and-a-pixel-bonsai-2fak</guid>
      <description>&lt;p&gt;&lt;em&gt;How I turned an empty profile into a page that works for recruiters and for my community, with a hand-drawn SVG, a docs-style layout and a tree that grows from my commits.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;For years my GitHub profile said one thing: "Just another girl in tech." No README. Six pinned repos. A contribution graph with more empty squares than I'd like to admit.&lt;/p&gt;

&lt;p&gt;That's a strange look for someone who writes developer docs for a living. My whole job is helping people get from "what is this?" to their first successful request as fast as possible, and my own profile did none of that.&lt;/p&gt;

&lt;p&gt;So I fixed it in one evening. Here's what I built, the tools I used and the code you can copy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;See it live:&lt;/strong&gt; &lt;a href="https://github.com/Daisy-Faith-Auma" rel="noopener noreferrer"&gt;github.com/Daisy-Faith-Auma&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 0: Decide who it's for
&lt;/h2&gt;

&lt;p&gt;Before touching any code, I looked at a few profiles I liked and asked one question: who is this page for?&lt;/p&gt;

&lt;p&gt;For me, the answer was two groups:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Recruiters and hiring managers&lt;/strong&gt;, who want to know what I do, where I've done it and how to reach me, in under a minute.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;My community&lt;/strong&gt; at LuxDevHQ, where 20,000+ people across 16 countries are learning data and AI. They want to see what I'm building and writing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every section on the page had to serve at least one of them. Anything that didn't got cut.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create the special repo
&lt;/h2&gt;

&lt;p&gt;GitHub shows a README on your profile if you create a &lt;strong&gt;public&lt;/strong&gt; repository with &lt;strong&gt;exactly the same name as your username&lt;/strong&gt;. Mine is &lt;code&gt;Daisy-Faith-Auma/Daisy-Faith-Auma&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Tick "Add a README" when you create it, and GitHub will tell you it's a special repository. Anything you put in that &lt;code&gt;README.md&lt;/code&gt; appears at the top of your profile.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Pick a palette and stick to it
&lt;/h2&gt;

&lt;p&gt;The profiles I liked most weren't the ones with the most widgets. They were the ones where everything matched.&lt;/p&gt;

&lt;p&gt;I went with my name: daisy yellow &lt;code&gt;#FFD23F&lt;/code&gt;, pink &lt;code&gt;#FF7EB3&lt;/code&gt; and near-black &lt;code&gt;#0D0D0D&lt;/code&gt;. Every badge, link colour, banner and footer uses only those three, plus white.&lt;/p&gt;

&lt;p&gt;That one decision does more for "cute" than any animation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Draw a custom header
&lt;/h2&gt;

&lt;p&gt;Most profile headers come from generators. I wanted something that was mine, so I drew a header as a hand-written SVG: a black banner, my name, and three daisies on stems that gently sway.&lt;/p&gt;

&lt;p&gt;SVGs in a GitHub README are rendered as images, so a few rules apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No external fonts. Use a system font stack like &lt;code&gt;'Segoe UI', 'Helvetica Neue', Arial, sans-serif&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;No JavaScript. SMIL animations (&lt;code&gt;&amp;lt;animate&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;animateTransform&amp;gt;&lt;/code&gt;) work.&lt;/li&gt;
&lt;li&gt;Keep it in your repo and reference it with a relative path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each daisy is a reusable &lt;code&gt;&amp;lt;symbol&amp;gt;&lt;/code&gt; of twelve rotated ellipses around a yellow circle:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;symbol id="daisy" viewBox="-50 -50 100 100"&amp;gt;
  &amp;lt;g fill="#ffffff"&amp;gt;
    &amp;lt;ellipse cx="0" cy="-26" rx="9" ry="22"/&amp;gt;
    &amp;lt;ellipse cx="0" cy="-26" rx="9" ry="22" transform="rotate(30)"/&amp;gt;
    &amp;lt;!-- ...repeat every 30 degrees up to 330 --&amp;gt;
  &amp;lt;/g&amp;gt;
  &amp;lt;circle r="13" fill="#ffd23f"/&amp;gt;
&amp;lt;/symbol&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the sway is a slow rotation around the bottom of the stem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;g&amp;gt;
  &amp;lt;animateTransform attributeName="transform" type="rotate"
    values="-3 905 320; 3 905 320; -3 905 320"
    dur="5s" repeatCount="indefinite"/&amp;gt;
  &amp;lt;use href="#daisy" x="855" y="150" width="100" height="100"/&amp;gt;
&amp;lt;/g&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in the README:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;align&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"center"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"./assets/daisy-header.svg"&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"100%"&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Hi, I'm Daisy Auma"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Always write real alt text. Screen readers read your profile too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Add a typing line
&lt;/h2&gt;

&lt;p&gt;Under the header, a pink line types out what I do, one phrase at a time. This comes from &lt;a href="https://github.com/DenverCoder1/readme-typing-svg" rel="noopener noreferrer"&gt;readme-typing-svg&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://readme-typing-svg.demolab.com?font=Poppins&amp;amp;weight=600&amp;amp;size=22&amp;amp;color=FF7EB3&amp;amp;center=true&amp;amp;vCenter=true&amp;amp;width=620&amp;amp;lines=I+make+complex+tech+feel+simple;Docs+%2B+DevRel+for+AI+%26+developer+platforms"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separate lines with &lt;code&gt;;&lt;/code&gt; and URL-encode anything unusual (&lt;code&gt;+&lt;/code&gt; for spaces, &lt;code&gt;%2B&lt;/code&gt; for a plus sign, &lt;code&gt;%26&lt;/code&gt; for &amp;amp;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Structure it like docs
&lt;/h2&gt;

&lt;p&gt;This is the part I'm proudest of. Since I'm a technical writer, I laid the profile out like a product docs page:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Docs section&lt;/th&gt;
&lt;th&gt;What it holds on my profile&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Overview&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Two short paragraphs on who I am&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Quickstart&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A terminal-style &lt;code&gt;npx meet-daisy&lt;/code&gt; block with role, community, study and "ask me about"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Changelog&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;My roles, newest first, with a version number for each start date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Featured work&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Five projects with a one-line description each&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;API reference&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;My toolbox, as icons&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Contributing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;How to connect, with a callout for hiring managers and one for the community&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Quickstart is just a fenced code block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="k"&gt;```bash
&lt;/span&gt;$ npx meet-daisy

✿ role        DevRel Engineer · Technical Writer
✿ community   Co-founder &amp;amp; Programme Lead @ LuxDevHQ
✿ ask me      docs strategy, API onboarding, AI/ML
&lt;span class="k"&gt;```
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Changelog is a markdown table where the "version" is the date I started each role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| Version | Where | What shipped |
| :-- | :-- | :-- |
| &lt;span class="sb"&gt;`2025.09`&lt;/span&gt; | &lt;span class="gs"&gt;**Archetype AI**&lt;/span&gt; | Sole technical writer for Newton, a physical AI foundation model |
| &lt;span class="sb"&gt;`2024.05`&lt;/span&gt; | &lt;span class="gs"&gt;**Cloudflare**&lt;/span&gt; | Docs for AI models, plus A/B tests on docs quality |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's a small joke, but it tells a hiring manager something real: this person thinks in docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Icons and badges in your colours
&lt;/h2&gt;

&lt;p&gt;For skills I used &lt;a href="https://skillicons.dev" rel="noopener noreferrer"&gt;skillicons.dev&lt;/a&gt;. One URL, a comma-separated list, and a dark theme:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://skillicons.dev/icons?i=py,ts,js,react,vite,docker,kubernetes,aws&amp;amp;theme=dark"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For social links I used &lt;a href="https://shields.io" rel="noopener noreferrer"&gt;Shields.io&lt;/a&gt; badges. You can set both the background and the logo colour, which is how every badge ends up in pink, black or yellow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;![LinkedIn](https://img.shields.io/badge/LinkedIn-0d0d0d?style=for-the-badge&amp;amp;logo=linkedin&amp;amp;logoColor=ff7eb3)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the "hiring?" box I used GitHub's built-in alert syntax, which needs no images at all:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="ge"&gt;&amp;gt; [!TIP]
&amp;gt; **Hiring for DevRel or technical writing?** See my work on my portfolio.
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Grow a bonsai
&lt;/h2&gt;

&lt;p&gt;The last piece is my favourite. &lt;a href="https://github.com/egorthinks/git-bonsai" rel="noopener noreferrer"&gt;git-bonsai&lt;/a&gt; grows a pixel-art bonsai from your GitHub history. Your username is the seed, so nobody else can ever grow your tree. Account age shapes the trunk, total contributions fill the crown, streaks add blossoms and long gaps leave deadwood.&lt;/p&gt;

&lt;p&gt;Setup is one workflow file in your profile repo, &lt;code&gt;.github/workflows/bonsai.yml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bonsai&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'0 3 * * *'&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;grow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;egorthinks/git-bonsai@v1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it once from the Actions tab, then embed the result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"output/bonsai.gif"&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"320"&lt;/span&gt; &lt;span class="na"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"My git-bonsai"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's the honest part: my tree is small. A thin, slanted trunk and a modest crown. That's what 109 contributions in a year looks like, and most of my work over the last few years happened in company repos and docs platforms, not on my personal GitHub.&lt;/p&gt;

&lt;p&gt;I almost hid it. Then I read the project's README, which describes a bonsai as a decades-long collaboration between a tree and its keeper, where a crooked trunk is biography, not a flaw.&lt;/p&gt;

&lt;p&gt;So it stays. It regrows every morning, and it'll fill out as I commit. I like having a reason to show up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd tell you before you start
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decide your audience first.&lt;/strong&gt; It answers almost every design question.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;One palette beats ten widgets.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid stats cards if your numbers are low.&lt;/strong&gt; Decoration that celebrates you works better than numbers that undersell you.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't put your email in plain sight.&lt;/strong&gt; I point people to LinkedIn instead.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Write alt text for every image.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treat it like docs: ship, then iterate.&lt;/strong&gt; Mine already changed three times on day one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you give your profile a glow-up, send it to me. I'd love to see your tree.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Daisy Auma is a Developer Relations Engineer and Technical Writer, and Co-founder of &lt;a href="https://www.luxdevhq.ai/" rel="noopener noreferrer"&gt;LuxDevHQ&lt;/a&gt;. Find her on &lt;a href="https://linkedin.com/in/daisyfaithauma" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; and &lt;a href="https://youtube.com/@Daisy_codes" rel="noopener noreferrer"&gt;YouTube&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>career</category>
    </item>
    <item>
      <title>Build a Daily Game for Reddit with Devvit, React and Redis</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Fri, 27 Nov 2026 08:47:24 +0000</pubDate>
      <link>https://dev.to/daisyauma/build-a-daily-game-for-reddit-with-devvit-react-and-redis-4cki</link>
      <guid>https://dev.to/daisyauma/build-a-daily-game-for-reddit-with-devvit-react-and-redis-4cki</guid>
      <description>&lt;p&gt;By the end of this tutorial, you'll have a daily game running inside a Reddit post. Players make one guess a day, see how they did against everyone else, and a new round posts itself every morning.&lt;/p&gt;

&lt;p&gt;We'll build it the way I built &lt;a href="https://www.reddit.com/r/TrendlineGame/" rel="noopener noreferrer"&gt;Trendline&lt;/a&gt;, my entry for Reddit's Game of the Day hackathon. In Trendline, you see the first part of a real chart, draw where the line goes next, then see what actually happened next to the crowd's average guess. The full code is on &lt;a href="https://github.com/Daisy-Faith-Auma/trendline" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, and every snippet below comes from it.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpdrjtnln78zein6l93p.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpdrjtnln78zein6l93p.png" alt="Trendline's reveal screen: your guess, the crowd's average and what actually happened" width="800" height="441"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;What we're building toward: a reveal that compares your guess with the crowd's. Player names are blurred.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How a Reddit game works
&lt;/h2&gt;

&lt;p&gt;Think of a Devvit app as a tiny website that lives inside a Reddit post. It has a front end (React, in our case), a small server, and its own Redis database. Reddit hosts all three, so there's nothing to deploy to a cloud provider and no database to set up.&lt;/p&gt;

&lt;p&gt;The post has two views:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The preview&lt;/strong&gt; that people see while scrolling their feed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The expanded game&lt;/strong&gt; that opens when they tap to play&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The server knows which post it's running in and who is playing, so you don't need to build any login.&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Node.js&lt;/strong&gt;, at the version in the template's &lt;code&gt;.nvmrc&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Git&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A Reddit account&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VS Code&lt;/strong&gt; or any editor, with its terminal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Devvit CLI&lt;/strong&gt;, which the template installs for you (I used version 0.15.4)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Step 1: Create the project from Reddit's React template
&lt;/h2&gt;

&lt;p&gt;Reddit maintains a starter project with React, Vite, Hono and TypeScript already wired together. Let's clone it and install its packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/reddit/devvit-template-react my-daily-game
&lt;span class="nb"&gt;cd&lt;/span&gt; my-daily-game
npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see &lt;code&gt;added ... packages&lt;/code&gt; at the end. Warnings about deprecated packages are normal and safe to ignore.&lt;/p&gt;

&lt;p&gt;The template comes with its own git history pointing at Reddit's repository. If you plan to push your game to GitHub, start fresh:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rm -rf .git
git init
git branch -M main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Log in and register the app
&lt;/h2&gt;

&lt;p&gt;Log in to Reddit from the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx devvit login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A browser tab opens. Log in, click &lt;strong&gt;Allow&lt;/strong&gt;, then come back to the terminal.&lt;/p&gt;

&lt;p&gt;Now start a playtest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two things tripped me up here, so let's handle them before they happen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Please finish setting up your developer account."&lt;/strong&gt; Choose &lt;strong&gt;Open developer account page in browser&lt;/strong&gt;, accept the developer terms, then come back and choose &lt;strong&gt;I have finished setting up my developer account; check again&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Your app doesn't exist yet."&lt;/strong&gt; Devvit reads your app's name from &lt;code&gt;devvit.json&lt;/code&gt;. If that name was never registered with Reddit, playtest refuses to run, and &lt;code&gt;npx devvit init&lt;/code&gt; may say the app is already initialized. Register it properly with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;When it's done, &lt;code&gt;npm run dev&lt;/code&gt; should print something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✓ Playtest ready
➜ URL: https://www.reddit.com/r/your_app_dev/?playtest=your-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Devvit creates a private test subreddit for you and installs the app there. Leave this terminal running. Every time you save a file, it rebuilds and uploads, and you refresh the page to see the change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Configure devvit.json
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;devvit.json&lt;/code&gt; tells Reddit what your app contains. Here's Trendline's, with the parts that matter for a daily game:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"https://developers.reddit.com/schema/config-file.v1.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"your-app-name"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"post"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"dir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dist/client"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"entrypoints"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"default"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"inline"&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="nl"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"splash.html"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"game"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"game.html"&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="nl"&gt;"server"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"dir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dist/server"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"index.cjs"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"menu"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"items"&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="nl"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Post today's Trendline"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Create today's Trendline chart post"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"subreddit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"forUserType"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"moderator"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"endpoint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/internal/menu/post-create"&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="nl"&gt;"triggers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"onAppInstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/internal/triggers/on-app-install"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"scheduler"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"tasks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"daily-post"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"endpoint"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/internal/scheduler/daily-post"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"cron"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"5 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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what each part does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;post.entrypoints&lt;/code&gt;&lt;/strong&gt; defines the two views. &lt;code&gt;default&lt;/code&gt; is the preview, shown inline in the feed. &lt;code&gt;game&lt;/code&gt; is the expanded view.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;server&lt;/code&gt;&lt;/strong&gt; points at your built server code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;menu&lt;/code&gt;&lt;/strong&gt; adds a moderator-only menu item to the subreddit, handy for posting a round by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;triggers&lt;/code&gt;&lt;/strong&gt; runs code when the app is installed. We'll use it to create the first post.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;scheduler&lt;/code&gt;&lt;/strong&gt; runs a task on a cron schedule. &lt;code&gt;5 0 * * *&lt;/code&gt; means 00:05 UTC every day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the &lt;code&gt;name&lt;/code&gt; that Devvit registered for you in Step 2.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Store one guess per player in Redis
&lt;/h2&gt;

&lt;p&gt;A daily game needs one rule above all: one guess per player per day. The tricky part is a player double tapping the submit button. Two requests arrive at almost the same moment, both check "has this player played?", both see "no", and both save.&lt;/p&gt;

&lt;p&gt;Redis has an atomic counter that solves this. &lt;code&gt;incrBy&lt;/code&gt; increases a number and returns the new value in one step, so only one request can ever see &lt;code&gt;1&lt;/code&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;keys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;playedFlag&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`day:${day}:played:${userId}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`day:${day}:guess:${userId}`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;sums&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`day:${day}:sums`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`day:${day}:count`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`day:${day}:scores`&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;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;saveGuess&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;userId&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;username&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;guess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&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;streak&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Streak&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="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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="c1"&gt;// incrBy is atomic, so two quick taps can't both count.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt; &lt;span class="o"&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;incrBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;playedFlag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="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="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;first&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;ok&lt;/span&gt;&lt;span class="p"&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;chartForDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;scoreGuess&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&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;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&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;guess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&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;for&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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&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="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;hIncrBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sums&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&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;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;toFraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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="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;incrBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="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;zAdd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scores&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;member&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&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;streak&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;updateStreak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;day&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;ok&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;streak&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;code&gt;redis&lt;/code&gt; is imported from &lt;code&gt;@devvit/web/server&lt;/code&gt;. Every key includes the day, so each round's data stays separate, and old posts keep their own results.&lt;/p&gt;

&lt;p&gt;The last two lines feed the leaderboard and streaks. &lt;code&gt;zAdd&lt;/code&gt; puts the score in a sorted set, which Redis keeps in order for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Build the crowd average from running totals
&lt;/h2&gt;

&lt;p&gt;The obvious way to show the crowd's average is to read every guess and average them. That gets slower with every player.&lt;/p&gt;

&lt;p&gt;Instead, look at the &lt;code&gt;hIncrBy&lt;/code&gt; loop in the code above. Each guess is converted to a position on the chart between 0 and 1, scaled to a whole number, and added to a running total for each point on the line. Together with the player count, that's everything you need:&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;players&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;playerCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;crowd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;players&lt;/span&gt; &lt;span class="o"&gt;&amp;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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sums&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;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hGetAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sums&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;crowd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nf"&gt;fromFraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sums&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;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;players&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;Two Redis reads, however many people have played. The conversion helpers are short:&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;const&lt;/span&gt; &lt;span class="no"&gt;FRACTION_SCALE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;toFraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&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="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMax&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&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="n"&gt;f&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="no"&gt;FRACTION_SCALE&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;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fromFraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scaled&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scaled&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;FRACTION_SCALE&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="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMax&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&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;Storing whole numbers matters because &lt;code&gt;hIncrBy&lt;/code&gt; adds integers. Positions between 0 and 10,000 keep plenty of precision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Serve the game from a Hono API
&lt;/h2&gt;

&lt;p&gt;The server is a Hono app. Routes under &lt;code&gt;/api&lt;/code&gt; are called by your React client. Routes under &lt;code&gt;/internal&lt;/code&gt; are called by Reddit itself, for the menu, triggers and scheduler:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'hono'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;serve&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@hono/node-server'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;getServerPort&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@devvit/web/server'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./routes/api'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;menu&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./routes/menu'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;scheduler&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./routes/scheduler'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;triggers&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./routes/triggers'&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;app&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;Hono&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;internal&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;Hono&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;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/menu'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;menu&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/triggers'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;triggers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/scheduler'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;scheduler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/internal'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;serve&lt;/span&gt;&lt;span class="p"&gt;(&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="n"&gt;app&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="n"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;getServerPort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The game needs two endpoints. &lt;code&gt;/api/init&lt;/code&gt; loads everything the client needs when the post opens. &lt;code&gt;context&lt;/code&gt; tells you which post this is and who is playing:&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="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/init'&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="n"&gt;c&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;try&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;postId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&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;postId&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'No post in context'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&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;day&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;getPostDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;postId&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;username&lt;/span&gt; &lt;span class="o"&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;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getCurrentUsername&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="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&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;reveal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;userId&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;buildReveal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;InitResponse&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;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;publicChart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;chartForDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;players&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;playerCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;loggedIn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;reveal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;streak&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getStreak&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userId&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="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&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;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'init failed'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Could not load the game'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice &lt;code&gt;publicChart&lt;/code&gt;. It sends only the part of the chart the player is allowed to see. The answer stays on the server until they've played, so nobody can find it in the browser's network tab.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/api/guess&lt;/code&gt; validates the guess and saves it:&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="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/guess'&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="n"&gt;c&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;try&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;postId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&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;postId&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;userId&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Log in to play'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;401&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;body&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GuessRequest&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;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;day&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;getPostDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;postId&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;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;chartForDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hiddenValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&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;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;day&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
      &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
      &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
      &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s1"&gt;'number'&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'That guess looks incomplete'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&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;clamped&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMax&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&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;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getCurrentUsername&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="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'anonymous'&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;saved&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;saveGuess&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;clamped&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;saved&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"You've already played this one"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;409&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;reveal&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;buildReveal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userId&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GuessResponse&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;span class="n"&gt;reveal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;reveal&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;streak&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;streak&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;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&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;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'guess failed'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;error&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorResponse&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;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'error'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Could not save your guess'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Never trust the client. The server checks the day, the length of the guess, and that every value is a real number, then clamps values to the chart's range before saving.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Build the React client
&lt;/h2&gt;

&lt;p&gt;The client is two small React apps, one per entrypoint. Each calls &lt;code&gt;/api/init&lt;/code&gt; when it loads.&lt;/p&gt;

&lt;p&gt;The preview in the feed should be light and make sense in two seconds. Its job is to get people to tap. &lt;code&gt;requestExpandedMode&lt;/code&gt; opens the &lt;code&gt;game&lt;/code&gt; entrypoint you defined in &lt;code&gt;devvit.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;requestExpandedMode&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@devvit/web/client'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Splash&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="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;InitResponse&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;loadGame&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;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&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="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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"splash"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"kicker"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nc"&gt;Trendline&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="sb"&gt;` #${data.day + 1}`&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;h1&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;data&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'Where does the line go next?'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;h1&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;data&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Chart&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chart&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt; &lt;span class="n"&gt;onClick&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;requestExpandedMode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nativeEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'game'&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="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;reveal&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="sb"&gt;`You scored ${data.reveal.score}. See the results`&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Draw the rest'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;main&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The button text changes once you've played, so returning players go straight to their results.&lt;/p&gt;

&lt;p&gt;Calling the API from the client is a plain &lt;code&gt;fetch&lt;/code&gt; to a relative path. Devvit routes it to your server:&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;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;request&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;path&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;init&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="nc"&gt;RequestInit&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="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="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="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&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;init&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="n"&gt;init&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&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="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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;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="k"&gt;as&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;ErrorResponse&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nc"&gt;ErrorResponse&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'Something went wrong'&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;body&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;loadGame&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;InitResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/init'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sendGuess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;GuessResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/api/guess'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'POST'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;body&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;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&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;
  
  
  Step 8: Post a new round every day
&lt;/h2&gt;

&lt;p&gt;A daily game needs a daily post. One function creates it and remembers which day it belongs to:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;reddit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'@devvit/web/server'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;chartForDay&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dayNumber&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../../shared/game'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;setPostDay&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'./store'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;createPost&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="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dayNumber&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="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;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;chartForDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&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;post&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;reddit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;submitCustomPost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sb"&gt;`Trendline #${day + 1}: ${chart.title}. Where does the line go next?`&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;await&lt;/span&gt; &lt;span class="nf"&gt;setPostDay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;day&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;post&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;Storing the day against the post ID is what keeps old posts playable. Yesterday's post still loads yesterday's chart.&lt;/p&gt;

&lt;p&gt;The scheduler task from &lt;code&gt;devvit.json&lt;/code&gt; calls it every day:&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Hono&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'hono'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;createPost&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s1"&gt;'../core/post'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;scheduler&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;Hono&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;scheduler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/daily-post'&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="n"&gt;c&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;try&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;post&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;createPost&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="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="sb"&gt;`Daily Trendline post created: ${post.id}`&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="s1"&gt;'success'&lt;/span&gt; &lt;span class="p"&gt;}&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="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&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;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Daily post failed: ${error}`&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;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="s1"&gt;'error'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The menu item and install trigger call the same &lt;code&gt;createPost&lt;/code&gt; function, so there's one place to change if you rename your posts.&lt;/p&gt;

&lt;p&gt;To decide which day it is, count days since a fixed start date in UTC:&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;const&lt;/span&gt; &lt;span class="no"&gt;EPOCH_UTC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;UTC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;25&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="no"&gt;DAY_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;dayNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="no"&gt;EPOCH_UTC&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;DAY_MS&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;Set &lt;code&gt;EPOCH_UTC&lt;/code&gt; to your own launch date. Note that JavaScript months start at 0, so &lt;code&gt;10&lt;/code&gt; is November.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 9: Playtest, deploy and install
&lt;/h2&gt;

&lt;p&gt;While &lt;code&gt;npm run dev&lt;/code&gt; is running, open the playtest URL and play your game. Check the preview, the expanded view, and what happens when you submit twice.&lt;/p&gt;

&lt;p&gt;When you're happy with it, upload a release version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a public subreddit for your game and install the app there:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx devvit install YourSubredditName
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Leave out the &lt;code&gt;r/&lt;/code&gt;. The install trigger creates the first post straight away.&lt;/p&gt;

&lt;p&gt;One thing I didn't expect: Reddit held my app's first posts until I approved them as the subreddit's moderator. New app accounts don't have much history, so check your &lt;strong&gt;Mod Queue&lt;/strong&gt; after each daily post until your app's posts go up on their own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;p&gt;You now have a daily Reddit game with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two views:&lt;/strong&gt; a light preview in the feed and an expanded game&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One guess per player per day,&lt;/strong&gt; enforced with an atomic Redis counter&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A crowd average&lt;/strong&gt; built from running totals, so it stays fast as players grow&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A new post every day&lt;/strong&gt; from the Devvit scheduler, plus a moderator menu item to post by hand&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same pattern works for much more than charts. A daily poll where you guess how the crowd will vote, a prediction game for sports results, or a community challenge that builds up over a week all need the same pieces: one action per player, a shared total, and a fresh post each day.&lt;/p&gt;

&lt;p&gt;The complete code for Trendline is on &lt;a href="https://github.com/Daisy-Faith-Auma/trendline" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, and you can play today's chart at &lt;a href="https://www.reddit.com/r/TrendlineGame/" rel="noopener noreferrer"&gt;r/TrendlineGame&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devvit</category>
      <category>react</category>
      <category>redis</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How I Built a Daily Chart-Guessing Game on Reddit (And Why the Crowd Keeps Winning)</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Thu, 26 Nov 2026 10:12:23 +0000</pubDate>
      <link>https://dev.to/daisyauma/how-i-built-a-daily-chart-guessing-game-on-reddit-and-why-the-crowd-keeps-winning-jag</link>
      <guid>https://dev.to/daisyauma/how-i-built-a-daily-chart-guessing-game-on-reddit-and-why-the-crowd-keeps-winning-jag</guid>
      <description>&lt;p&gt;I built a game, and on day two I scored 0 on it.&lt;/p&gt;

&lt;p&gt;The chart was monthly airline passengers from 1958 to 1960. I could see two years of data, with a clear summer peak each year. I drew the third summer a little higher than the last. The real line came in, and my peak was two months early. My line ended at 562 thousand passengers. The real number was 432.&lt;/p&gt;

&lt;p&gt;Zero out of a hundred. On my own game.&lt;/p&gt;

&lt;p&gt;That game is Trendline, my entry for Reddit's Game of the Day hackathon. Here's how it works, how I built it, and what the first nine players taught me.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Trendline is
&lt;/h2&gt;

&lt;p&gt;Every day, Trendline posts a real chart with the ending hidden. You see the first part of the line, then drag your finger across the empty space to draw where you think it goes next.&lt;/p&gt;

&lt;p&gt;When you lock in your guess, three lines appear:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Yours&lt;/strong&gt;, in orange&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The crowd's average guess&lt;/strong&gt;, built from everyone who played that day&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What actually happened&lt;/strong&gt;, drawn in last&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You get a score out of 100, the crowd's score, and a short fact about the data. The charts are all real public data: CO2 at Mauna Loa, Japan's shrinking population, Ireland's 2015 GDP spike, sunspot cycles, and mobile subscriptions in Kenya.&lt;/p&gt;

&lt;p&gt;You can play it at &lt;a href="https://www.reddit.com/r/TrendlineGame/" rel="noopener noreferrer"&gt;r/TrendlineGame&lt;/a&gt;, and the full code is on &lt;a href="https://github.com/Daisy-Faith-Auma/trendline" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a chart game
&lt;/h2&gt;

&lt;p&gt;I teach data science at LuxDevHQ, and my first lesson is always the same. Before we touch a model, I show a chart and ask everyone to guess what happens next.&lt;/p&gt;

&lt;p&gt;Then we compare the guesses with what actually happened.&lt;/p&gt;

&lt;p&gt;It's the most useful habit in data work: look at the data, commit to a prediction, then check it. When Reddit announced a hackathon for daily games, I wanted to see if that classroom moment could work as one.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Trendline runs on Devvit Web, Reddit's platform for apps that live inside posts. The client is React and TypeScript, the server is a small Hono app, and Redis stores everything the game needs to remember.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real data, not made-up charts
&lt;/h3&gt;

&lt;p&gt;The judges mark down games that feel generic, and a chart game only works if the charts are real. So the data comes from the World Bank, NOAA, NASA's GISTEMP, and a few classic time series datasets.&lt;/p&gt;

&lt;p&gt;A Python script turns that raw data into a TypeScript file the game imports. For each chart it decides how much of the line to show and sets the axis range:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;charts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;lo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'values'&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="nb"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'values'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="nb"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="n"&gt;y_min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;y_min&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;y_min&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;  &lt;span class="c1"&gt;# counts and rates can't go below zero&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'yMin'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y_min&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'decimals'&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="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'yMax'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'decimals'&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The padding matters. If the axis stopped exactly at the highest value, players could guess the ending from the shape of the empty space.&lt;/p&gt;

&lt;p&gt;The hidden part of each chart never reaches the browser until you've played. The server sends only the visible points, so nobody can find the answer in the network tab.&lt;/p&gt;

&lt;h3&gt;
  
  
  Drawing a line with your finger
&lt;/h3&gt;

&lt;p&gt;Drawing sounds simple until someone swipes fast. Pointer events don't fire for every pixel, so a quick swipe can skip several points on the chart and leave gaps in the line.&lt;/p&gt;

&lt;p&gt;The fix is to fill every gap between the last point you touched and the current one:&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;step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;from&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="mi"&gt;1&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;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fromValue&lt;/span&gt;&lt;span class="o"&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="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;fromValue&lt;/span&gt;&lt;span class="o"&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="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;from&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="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="k"&gt;from&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;next&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now any swipe, however fast, produces a complete line. It works the same with a mouse or a finger, which matters on Reddit, since many people play on their phones.&lt;/p&gt;

&lt;h3&gt;
  
  
  The crowd line without storing every guess
&lt;/h3&gt;

&lt;p&gt;The crowd's average is the best part of the reveal, and I didn't want it to get slower as more people played. Reading back every guess to average them would do exactly that.&lt;/p&gt;

&lt;p&gt;Instead, each guess is converted to a position on the chart between 0 and 1, scaled to a whole number, and added to a running total in Redis:&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;for&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;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&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="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;hIncrBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sums&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&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;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;toFraction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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="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;incrBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To draw the crowd line, the server divides each total by the number of players. It costs the same for 10 players or 10,000.&lt;/p&gt;

&lt;p&gt;One guess per player per day is enforced the same way. The server increments a counter for that player and day, and only the first increment counts, so a double tap can't submit twice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scoring across millions and degrees
&lt;/h3&gt;

&lt;p&gt;Scoring has to work for a chart in millions of people and a chart in degrees Celsius. So the error is measured as a share of the chart's height, not in the chart's own units:&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;range&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMax&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&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;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&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="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;yMin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;range&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;meanError&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;actual&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;meanError&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;4&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;That last line is why I scored 0. Missing by a quarter of the chart's height, on average, drops you to the floor. More on that below.&lt;/p&gt;

&lt;h3&gt;
  
  
  One new post every day
&lt;/h3&gt;

&lt;p&gt;A daily game needs a daily post. Devvit has a built-in scheduler, so the app creates the day's post automatically just after midnight UTC. Each post remembers which chart it belongs to, so old posts stay playable.&lt;/p&gt;

&lt;p&gt;One thing I didn't expect: Reddit held the app's posts until I approved them as the subreddit moderator. New app accounts don't have much history, so for now, checking the mod queue is part of the morning routine.&lt;/p&gt;

&lt;h2&gt;
  
  
  What day one showed
&lt;/h2&gt;

&lt;p&gt;The first chart was mobile subscriptions in Kenya, from 1998 to 2024. Players saw the line up to 2007, the year M-PESA launched, and had to draw the rest.&lt;/p&gt;

&lt;p&gt;Nine people played. The crowd's average line scored 82 out of 100. The best single player scored 79.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpdrjtnln78zein6l93p.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnpdrjtnln78zein6l93p.png" alt="Trendline's day one reveal: the crowd's average line, in blue, tracks the real line closely" width="800" height="441"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Day one: my guess in orange, the crowd's average in blue, and what happened in white. Player names are blurred.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Nobody beat the crowd.&lt;/p&gt;

&lt;p&gt;I scored 35. I drew Kenya passing 160 subscriptions per 100 people. The real figure for 2024 was 126.5. The crowd's average landed closer than any one of us.&lt;/p&gt;

&lt;p&gt;That's the idea behind the whole game, and seeing it happen on the very first day was the best possible start.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd change
&lt;/h2&gt;

&lt;p&gt;Then came day two, and my 0.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fediohuowv04kws0d65ka.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fediohuowv04kws0d65ka.png" alt="Trendline's day two reveal: my summer peak arrives two months before the real one" width="800" height="441"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Day two: the right shape, two months early, and a score of 0.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;My line had the right shape. The summer peak was there, it was just early. But the scoring compares each month separately, so an early peak counts as wrong twice: too high before the real peak, then too low when it arrives.&lt;/p&gt;

&lt;p&gt;A score of 0 for a guess with the right pattern feels broken, especially for a first-time player. Scoring that rewards the shape of the line, not just the distance at each point, would be fairer.&lt;/p&gt;

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

&lt;p&gt;If you want to see how good your instincts are, play today's chart at &lt;a href="https://www.reddit.com/r/TrendlineGame/" rel="noopener noreferrer"&gt;r/TrendlineGame&lt;/a&gt;. It takes about 30 seconds and a free Reddit account.&lt;/p&gt;

&lt;p&gt;If you want to build something similar, the full code is on &lt;a href="https://github.com/Daisy-Faith-Auma/trendline" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. The two ideas worth borrowing are the running totals for the crowd average and keeping the answer on the server until the player commits.&lt;/p&gt;

&lt;p&gt;What chart would you want to see next?&lt;/p&gt;

</description>
      <category>devvit</category>
      <category>react</category>
      <category>datascience</category>
      <category>gamedev</category>
    </item>
    <item>
      <title>How We Measured Whether Our Docs Actually Worked</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:15:28 +0000</pubDate>
      <link>https://dev.to/daisyauma/how-we-measured-whether-our-docs-actually-worked-4ean</link>
      <guid>https://dev.to/daisyauma/how-we-measured-whether-our-docs-actually-worked-4ean</guid>
      <description>&lt;p&gt;&lt;em&gt;Page views told us people were reading. They didn't tell us whether anyone succeeded. Here's how I ran A/B tests on API documentation using task completion, time to first successful request, and support ticket volume.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At a large developer platform, I documented a catalog of AI models that developers called through an API. We were shipping pages quickly, and our dashboards looked healthy: traffic was up, bounce rates were fine, and the feedback widget leaned positive.&lt;/p&gt;

&lt;p&gt;But none of that answered the question that actually mattered: when a developer landed on a page, did they get the model working? This article walks through how I turned that question into a set of measurable outcomes and ran controlled experiments on the docs themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the usual docs metrics mislead
&lt;/h2&gt;

&lt;p&gt;Most documentation teams measure attention, not outcomes. The common signals each have a blind spot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Page views&lt;/strong&gt; rise when docs are confusing, because people come back to re-read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time on page&lt;/strong&gt; is ambiguous. Five minutes could mean deep engagement or a developer stuck on step three.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Thumbs up/down widgets&lt;/strong&gt; capture a tiny, self-selected slice of readers, usually the very happy or the very frustrated.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search volume&lt;/strong&gt; tells you what people look for, not whether they found it.
Documentation exists to help someone complete a task. So the metric should be whether they completed it, how quickly, and whether they needed a human to help.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Three metrics that measure outcomes
&lt;/h2&gt;

&lt;p&gt;I settled on one primary metric and two supporting ones. Each maps to a different failure mode.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Question it answers&lt;/th&gt;
&lt;th&gt;How it's defined&lt;/th&gt;
&lt;th&gt;Direction we want&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Task completion rate&lt;/td&gt;
&lt;td&gt;Did the developer finish what they came to do?&lt;/td&gt;
&lt;td&gt;Share of sessions that reach a defined success event (for example, a 200 response from the model endpoint) after viewing the page&lt;/td&gt;
&lt;td&gt;Up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time to first successful request (TTFSR)&lt;/td&gt;
&lt;td&gt;How much friction stood between reading and working?&lt;/td&gt;
&lt;td&gt;Time from first page view to first successful API call by that developer&lt;/td&gt;
&lt;td&gt;Down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Support ticket volume&lt;/td&gt;
&lt;td&gt;Did the docs leave people needing a human?&lt;/td&gt;
&lt;td&gt;Tickets tagged to the documented product, normalised per 1,000 active developers&lt;/td&gt;
&lt;td&gt;Down&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Task completion was the primary metric because it most directly reflects the purpose of the page. TTFSR caught a subtler problem: docs where people eventually succeeded, but only after trial and error. Ticket volume was a lagging guardrail, useful for confirming that a win in the experiment held up in the real world.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define success narrowly.&lt;/strong&gt; "Made an API call" is too loose, because a failed call with a 401 error is still a call. Success should be the specific outcome the page promises.&lt;/p&gt;

&lt;h2&gt;
  
  
  Designing the experiment
&lt;/h2&gt;

&lt;p&gt;An A/B test on docs follows the same logic as one on a product feature, with a few twists.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick one change per test.&lt;/strong&gt; We compared a control page against a variant with a single structural change: a copy-paste quickstart block above the fold, versus the original reference-first layout.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Randomise at the developer level, not the page view.&lt;/strong&gt; If the same person sees version A on Monday and version B on Tuesday, you can't attribute their success to either. Assign by a stable identifier and keep them in their bucket.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Estimate sample size before you start.&lt;/strong&gt; Docs traffic is lumpier than product traffic. Use your baseline completion rate and the smallest lift worth acting on to work out how many developers each arm needs, then commit to that number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix the duration.&lt;/strong&gt; Run for full weeks so weekday and weekend developers are both represented, and don't stop early because the dashboard looks good.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set guardrails.&lt;/strong&gt; We watched ticket volume and page error reports so that a "win" on completion didn't hide a new problem elsewhere.
The hardest part was resisting the urge to change several things at once. A variant that rewrites the intro, adds code samples, and restructures the headings might win, but you won't know why.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Instrumenting the docs
&lt;/h2&gt;

&lt;p&gt;The metrics only work if you can join a docs session to what the developer did next in the product. That means two event streams sharing a key: docs events (page view, variant assigned) and API events (request made, response status).&lt;/p&gt;

&lt;p&gt;Once both land in the same warehouse, the core calculation is a join and a window. Here's a simplified version of the query I used for task completion and TTFSR:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;WITH&lt;/span&gt; &lt;span class="n"&gt;exposures&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;developer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="n"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="nb"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;viewed_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;first_view&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;docs_page_views&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;page_slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'model-quickstart'&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;viewed_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="s1"&gt;'2025-01-06'&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;viewed_at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="s1"&gt;'2025-02-03'&lt;/span&gt;  &lt;span class="c1"&gt;-- four full weeks, Monday to Sunday&lt;/span&gt;
  &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;developer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;variant&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="n"&gt;first_success&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;developer_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
         &lt;span class="nb"&gt;MIN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requested_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;first_ok&lt;/span&gt;
  &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;api_requests&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;
  &lt;span class="k"&gt;JOIN&lt;/span&gt; &lt;span class="n"&gt;exposures&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;developer_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requested_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_view&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;requested_at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;first_view&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="kt"&gt;INTERVAL&lt;/span&gt; &lt;span class="s1"&gt;'24 hours'&lt;/span&gt;
  &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;developer_id&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;variant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="nb"&gt;COUNT&lt;/span&gt;&lt;span class="cm"&gt;(*) AS developers,
       AVG(CASE WHEN f.first_ok IS NOT NULL THEN 1.0 ELSE 0 END) AS completion_rate,
       PERCENTILE_CONT(0.5) WITHIN GROUP (
         ORDER BY EXTRACT(EPOCH FROM f.first_ok - e.first_view)
       ) / 60 AS median_ttfsr_minutes
FROM exposures e
LEFT JOIN first_success f USING (developer_id)
GROUP BY e.variant;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few choices worth calling out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The 24-hour window&lt;/strong&gt; defines what "after reading the docs" means. Too short and you miss developers who read at night and build in the morning; too long and you credit the docs for success that came from elsewhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Median, not mean, for TTFSR.&lt;/strong&gt; A handful of developers who wander off for three days will wreck an average.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ticket volume came from the support system&lt;/strong&gt;, tagged by product area and joined by week, since tickets rarely carry a docs session ID.
If your events live in a product analytics tool such as Amplitude rather than a warehouse, the same logic maps to a two-step funnel (docs page viewed, then successful API request) with a 24-hour conversion window, grouped by the variant property.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;&lt;em&gt;A note on the data: the figures in this section come from a simulated dataset I built to demonstrate the method. They are illustrative, not results from any real company. The dataset and code are linked at the end so you can reproduce every number.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In the simulation, the variant page raised task completion from 41.1% to 47.2% and cut median time to first successful request from 27 to 18 minutes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Control&lt;/th&gt;
&lt;th&gt;Variant&lt;/th&gt;
&lt;th&gt;Change&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Developers in test&lt;/td&gt;
&lt;td&gt;4,000&lt;/td&gt;
&lt;td&gt;4,000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Task completion rate (95% CI)&lt;/td&gt;
&lt;td&gt;41.1% (39.5 to 42.6)&lt;/td&gt;
&lt;td&gt;47.2% (45.7 to 48.7)&lt;/td&gt;
&lt;td&gt;+6.1 pts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Median TTFSR (minutes)&lt;/td&gt;
&lt;td&gt;27.4&lt;/td&gt;
&lt;td&gt;17.8&lt;/td&gt;
&lt;td&gt;-35%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Support tickets per 1,000 active developers (4-week average)&lt;/td&gt;
&lt;td&gt;14.6 before rollout&lt;/td&gt;
&lt;td&gt;11.2 after rollout&lt;/td&gt;
&lt;td&gt;-23%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxpg5ixbqlugbjy5ihmxx.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxpg5ixbqlugbjy5ihmxx.png" alt="Bar chart of task completion rate by variant with 95% confidence intervals: control 41.1%, variant 47.2%" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 1: Task completion within 24 hours of first page view, by variant (simulated data, 95% CI).&lt;/em&gt;&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fby7hxmrmci906izaqy3u.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fby7hxmrmci906izaqy3u.png" alt="Cumulative distribution of time to first successful request; the variant curve sits left of control, medians 18 vs 27 minutes" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 2: Cumulative distribution of time to first successful request (simulated data, log scale).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Both differences are well beyond chance at this sample size: a chi-square test on completion and a Mann-Whitney U test on TTFSR each give p &amp;lt; 0.001. The cumulative distribution in Figure 2 is more useful than the medians alone. The variant curve sits to the left across almost the whole range, so the improvement isn't driven by a few fast developers; most people got there sooner.&lt;/p&gt;

&lt;p&gt;Ticket volume can't be split by variant, because tickets rarely carry a docs session ID. So it's shown as a before-and-after comparison once the variant rolled out to everyone (Figure 3). Treat it as supporting evidence, not proof.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F92qe4h4qfgjgxq76fni8.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F92qe4h4qfgjgxq76fni8.png" alt="Line chart of weekly support tickets per 1,000 active developers, falling from about 14.6 before rollout to about 11.2 after" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 3: Weekly support tickets per 1,000 active developers, four weeks either side of rollout (simulated data).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In real projects, effects are often smaller and noisier than this. A lift of a few points on completion can still be worth shipping if the page sits at the top of a high-traffic onboarding path.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons and pitfalls
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Search engines don't respect your buckets.&lt;/strong&gt; A developer who arrives from search may land on a cached or indexed version. Serve variants server-side and keep URLs identical so search traffic is assigned like everyone else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Novelty effects are real.&lt;/strong&gt; Returning developers sometimes engage more with a page simply because it changed. Look at new and returning developers separately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not every page can be tested.&lt;/strong&gt; Low-traffic reference pages won't reach a meaningful sample in a reasonable time. Save experiments for high-traffic entry points like quickstarts, and use qualitative methods (user interviews, session reviews) elsewhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Product changes contaminate results.&lt;/strong&gt; If the API itself changes mid-test, pause or restart. We coordinated test windows with the engineering release calendar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tickets lag.&lt;/strong&gt; Support volume responds over weeks, not days. Treat it as confirmation after the test, not a decision metric during it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expect most variants to lose.&lt;/strong&gt; The simulated variant here wins cleanly, but real experiments rarely do. Ron Kohavi, who led experimentation at Microsoft, reported that across their controlled experiments only about a third of ideas improved the metric they targeted; a third made no significant difference, and a third made it worse (&lt;a href="https://ai.stanford.edu/~ronnyk/2012-09ACMRecSysNR.pdf" rel="noopener noreferrer"&gt;Kohavi, 2012&lt;/a&gt;). There's no reason to think documentation ideas are luckier. A flat or negative result still pays for itself: it stops you rolling out a "best practice" across hundreds of pages that wouldn't have helped anyone.
## Treat docs like a product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Documentation is often the first product a developer touches, yet it's rarely held to the same evidence standard as the product itself. Measuring outcomes changed how our team prioritised work: we stopped debating opinions about layout and started asking which version helped more people ship.&lt;/p&gt;

&lt;p&gt;If you want to try this on your own docs, start here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick one high-traffic entry page.&lt;/li&gt;
&lt;li&gt;Define a narrow, observable success event.&lt;/li&gt;
&lt;li&gt;Make sure docs sessions and API events share a developer ID.&lt;/li&gt;
&lt;li&gt;Calculate your baseline completion rate and TTFSR before changing anything.&lt;/li&gt;
&lt;li&gt;Test one change, at the developer level, for a fixed number of full weeks.&lt;/li&gt;
&lt;li&gt;Confirm the result against support tickets afterwards.
You don't need a large team to do this. You need a clear definition of success and the discipline to measure it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;The simulated dataset, analysis code and figures for this article are on GitHub: &lt;a href="https://github.com/Daisy-Faith-Auma/docs-ab-testing-simulation" rel="noopener noreferrer"&gt;docs-ab-testing-simulation&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>datascience</category>
      <category>devrel</category>
      <category>documentation</category>
    </item>
    <item>
      <title>How I Built Customer-Specific Documentation in Mintlify</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Tue, 03 Feb 2026 07:25:01 +0000</pubDate>
      <link>https://dev.to/daisyauma/how-i-built-customer-specific-documentation-in-mintlify-4mb6</link>
      <guid>https://dev.to/daisyauma/how-i-built-customer-specific-documentation-in-mintlify-4mb6</guid>
      <description>&lt;p&gt;&lt;em&gt;A practical guide to serving different audiences without maintaining multiple doc sites&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's a challenge I didn't expect when I started documenting an AI platform: different customers need different documentation.&lt;/p&gt;

&lt;p&gt;Some customers want security details, compliance information, and deployment guides. Others want quick starts and code examples. Some customers use specific features that others never touch.&lt;/p&gt;

&lt;p&gt;The obvious solution? Multiple documentation sites. One for each customer type, one for each use case.&lt;/p&gt;

&lt;p&gt;The obvious solution is also a maintenance nightmare.&lt;/p&gt;

&lt;p&gt;Here's how I actually solved it using Mintlify's group-based access control, serving different audiences from a single doc site without losing my mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem: One Product, Many Audiences
&lt;/h2&gt;

&lt;p&gt;When you're documenting a platform with diverse customers, you quickly realize that "one size fits all" documentation doesn't work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The challenges I faced:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different companies needed different content based on their use cases&lt;/li&gt;
&lt;li&gt;Different use cases required different getting-started paths&lt;/li&gt;
&lt;li&gt;Some features were only relevant to specific customer segments&lt;/li&gt;
&lt;li&gt;Maintaining multiple doc sites would mean duplicating shared content across all of them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I needed a way to personalize the documentation experience without creating separate silos.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Primary Solution: Group-Based Access Control
&lt;/h2&gt;

&lt;p&gt;For truly customer-specific content that should only be visible to certain users, Mintlify supports group-based access control. This is the approach I went with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enable authentication (OAuth or JWT)&lt;/li&gt;
&lt;li&gt;Your auth system returns user groups&lt;/li&gt;
&lt;li&gt;Pages can be restricted to specific groups&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example: Restricting a page to specific users&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;---
title: "Advanced Configuration Guide"
groups: ["pro-users"]
---

# Advanced Configuration Guide

This guide covers features available to pro users...

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

&lt;/div&gt;



&lt;p&gt;Users not in the "pro-users" group won't see this page. They'll get a 404 if they try to access it directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: User info returned by your auth system&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"groups"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"pro-users"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"beta-testers"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"expiresAt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1735689600&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This user can access pages tagged with either "pro-users" or "beta-testers" groups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use group-based access:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Paid features that free users shouldn't see&lt;/li&gt;
&lt;li&gt;Beta documentation for early adopters&lt;/li&gt;
&lt;li&gt;Partner-specific integrations&lt;/li&gt;
&lt;li&gt;Customer-specific content based on their plan or use case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach lets me maintain one documentation site while serving completely different content to different customer segments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tabs for Different Audiences
&lt;/h2&gt;

&lt;p&gt;The simplest way to serve multiple audiences on the same page is tabs.&lt;/p&gt;

&lt;p&gt;Mintlify's tab component lets you present alternative content side-by-side, letting readers choose what's relevant to them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: Different code languages&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;&amp;lt;Tabs&amp;gt;
  &amp;lt;Tab title="Python"&amp;gt;
    ```

python
    import requests

    response = requests.get("https://api.example.com/data")
    print(response.json())


    ```
  &amp;lt;/Tab&amp;gt;

  &amp;lt;Tab title="JavaScript"&amp;gt;
    ```

javascript
    fetch("https://api.example.com/data")
      .then(response =&amp;gt; response.json())
      .then(data =&amp;gt; console.log(data));


    ```
  &amp;lt;/Tab&amp;gt;

  &amp;lt;Tab title="cURL"&amp;gt;
    ```

bash
    curl https://api.example.com/data


    ```
  &amp;lt;/Tab&amp;gt;
&amp;lt;/Tabs&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use tabs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content that's parallel (same topic, different approaches)&lt;/li&gt;
&lt;li&gt;Users typically only need one option&lt;/li&gt;
&lt;li&gt;All options should be equally visible/accessible&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When NOT to use tabs:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content that most users need to read entirely&lt;/li&gt;
&lt;li&gt;Options that build on each other&lt;/li&gt;
&lt;li&gt;More than 4-5 alternatives (gets unwieldy)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conditional Navigation Paths
&lt;/h2&gt;

&lt;p&gt;Not all customers need to see all sections of your documentation.&lt;/p&gt;

&lt;p&gt;Mintlify lets you organize navigation in &lt;code&gt;docs.json&lt;/code&gt; to create logical groupings. Combined with authentication and groups, you can show different navigation to different users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example: Organized navigation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"navigation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"groups"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Getting Started"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"quickstart"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"installation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"first-api-call"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Core Features"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"feature-overview"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"basic-usage"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"best-practices"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Advanced"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"custom-integrations"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"api-reference"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"troubleshooting"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The key insight:&lt;/strong&gt; You don't always need to hide content. Sometimes, clear organization is enough.&lt;/p&gt;

&lt;p&gt;Users will naturally gravitate to the sections relevant to them. The content is available to everyone, but the navigation makes it easy to find what's relevant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Public vs. Protected Content
&lt;/h2&gt;

&lt;p&gt;Sometimes you want most of your docs behind authentication, but certain pages public.&lt;/p&gt;

&lt;p&gt;Mintlify makes this straightforward with the &lt;code&gt;public&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make a single page public:&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;---
title: "API Overview"
public: true
---

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Make an entire section public:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"navigation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"groups"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Public Docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"public"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"overview"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"quickstart"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"pricing"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Protected Docs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"api-reference"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"advanced-guides"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"internal-tools"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;My approach:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public: Overview, quickstart, basic concepts (helps with SEO and sales)&lt;/li&gt;
&lt;li&gt;Protected: Detailed API reference, advanced guides, customer-specific content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This gives potential customers enough to evaluate the product while keeping detailed documentation for actual users.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It All Fits Together
&lt;/h2&gt;

&lt;p&gt;Here's how I think about the hierarchy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────────────┐
│              All Documentation               │
├─────────────────────────────────────────────┤
│  Public Pages                                │
│  (Anyone can access)                         │
│  - Overview, quickstart, basic concepts      │
├─────────────────────────────────────────────┤
│  Authenticated Pages                         │
│  (Logged-in users)                           │
│  - Full API reference, guides, tutorials     │
├─────────────────────────────────────────────┤
│  Group-Restricted Pages                      │
│  (Specific user groups)                      │
│  - Pro users: advanced features              │
│  - Beta: upcoming features                   │
│  - Partners: integration guides              │
└─────────────────────────────────────────────┘

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

&lt;/div&gt;



&lt;p&gt;Within each level, I use tabs and clear navigation to help users find what's relevant without hiding content unnecessarily.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Start with organization, not restriction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before adding authentication or group controls, ask: "Can I solve this with better organization?"&lt;/p&gt;

&lt;p&gt;Clear sections and good navigation often eliminate the need for access control. Users self-select into the content they need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Tabs are your friend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Any time you're tempted to create parallel pages (Python vs. JavaScript, beginner vs. advanced), consider tabs first. They keep related content together and reduce maintenance burden.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Don't over-segment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's tempting to create hyper-specific documentation for every customer segment. Resist this urge.&lt;/p&gt;

&lt;p&gt;Every segment you create is content you have to maintain. Start broad and only segment when you have clear evidence that users need it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Test with real users&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The best way to know if your documentation structure works? Watch someone use it.&lt;/p&gt;

&lt;p&gt;Do customers find the content they need? Do new users complete the quickstart? Where do people get stuck?&lt;/p&gt;

&lt;p&gt;User testing reveals gaps that internal review never will.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Result
&lt;/h2&gt;

&lt;p&gt;With this approach, I maintain a single Mintlify documentation site that serves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New users exploring the product (public quickstart)&lt;/li&gt;
&lt;li&gt;Active customers building integrations (authenticated API reference)&lt;/li&gt;
&lt;li&gt;Specific customer segments with unique requirements (group-restricted docs)&lt;/li&gt;
&lt;li&gt;Beta testers trying new features (group-restricted beta docs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No duplicate content. No multiple sites to maintain. One source of truth with flexible presentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.mintlify.com/docs/deploy/authentication-setup" rel="noopener noreferrer"&gt;Mintlify Authentication Setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mintlify.com/docs/settings/navigation" rel="noopener noreferrer"&gt;Mintlify Navigation Configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mintlify.com/docs/content/components/tabs" rel="noopener noreferrer"&gt;Mintlify Tabs Component&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How do you handle customer-specific documentation? I'd love to hear what approaches have worked for you.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>documentation</category>
      <category>devrel</category>
    </item>
    <item>
      <title>The Lonely Side of Being a Solo Technical Writer</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Mon, 02 Feb 2026 08:27:17 +0000</pubDate>
      <link>https://dev.to/daisyauma/the-lonely-side-of-being-a-solo-technical-writer-4pa7</link>
      <guid>https://dev.to/daisyauma/the-lonely-side-of-being-a-solo-technical-writer-4pa7</guid>
      <description>&lt;p&gt;&lt;em&gt;What it's really like to be the only one who does what you do&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I have a great team. Engineers review my documentation for accuracy. Product managers answer my endless questions. My work gets feedback before it ships.&lt;/p&gt;

&lt;p&gt;And yet, being a solo technical writer is still lonely.&lt;/p&gt;

&lt;p&gt;Not lonely in the "no one talks to me" sense. Lonely in the "no one else thinks about what I think about" sense.&lt;/p&gt;

&lt;p&gt;Here's what that actually looks like.&lt;/p&gt;

&lt;h2&gt;
  
  
  No One to Discuss the Craft With
&lt;/h2&gt;

&lt;p&gt;Last week, I spent an hour deciding whether a piece of content should be a tutorial or a conceptual guide.&lt;/p&gt;

&lt;p&gt;Tutorials are step-by-step. Conceptual guides explain the "why." The distinction matters for how users navigate documentation. It affects the structure, the tone, the level of detail.&lt;/p&gt;

&lt;p&gt;I made the decision. It was the right call. But I made it alone.&lt;/p&gt;

&lt;p&gt;Engineers review my docs for technical accuracy. They catch errors, clarify edge cases, and make sure the code examples actually work. That's invaluable.&lt;/p&gt;

&lt;p&gt;But they're not thinking about information architecture. They're not debating whether this content belongs in the quickstart or the API reference. They're not wondering if users will find this page through search or navigation.&lt;/p&gt;

&lt;p&gt;That's my job. And I'm the only one doing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wins That Don't Translate
&lt;/h2&gt;

&lt;p&gt;A few weeks ago, I restructured our documentation sidebar. It took hours — reorganizing pages, fixing broken links, testing navigation paths, making sure users could find what they needed in fewer clicks.&lt;/p&gt;

&lt;p&gt;When I finished, I was genuinely proud. The documentation was meaningfully better.&lt;/p&gt;

&lt;p&gt;I mentioned it in our team Slack. People responded positively — thumbs up, a few nice comments. But I could tell it wasn't a priority for anyone else. And why would it be? They had features to ship, bugs to fix, customers to support.&lt;/p&gt;

&lt;p&gt;The documentation sidebar wasn't keeping anyone else up at night. Just me.&lt;/p&gt;

&lt;p&gt;But it means celebrating alone. The wins that matter most to me are often invisible to everyone else.&lt;/p&gt;

&lt;h2&gt;
  
  
  Carrying the Vision Solo
&lt;/h2&gt;

&lt;p&gt;Here's something I didn't expect about this role: I'm the only one who sees the full picture.&lt;/p&gt;

&lt;p&gt;Engineers know their features deeply. Product managers know the roadmap. Support knows the common questions.&lt;/p&gt;

&lt;p&gt;But I'm the only one who sees how all of it connects in the documentation. I'm the only one thinking about the user's journey from first visit to successful implementation. I'm the only one noticing that we have three pages explaining the same concept slightly differently.&lt;/p&gt;

&lt;p&gt;That's powerful. It's also heavy.&lt;/p&gt;

&lt;p&gt;When documentation has gaps, I feel responsible. When users get confused, I wonder what I missed. There's no one to share that weight with, no peer to say "I noticed that too" or "here's how I'd approach it."&lt;/p&gt;

&lt;h2&gt;
  
  
  Different Mental Models
&lt;/h2&gt;

&lt;p&gt;I think in user journeys. Engineers think in features.&lt;/p&gt;

&lt;p&gt;When a new feature ships, engineers are excited about what it does. I'm thinking about how users will discover it, understand it, and actually use it.&lt;/p&gt;

&lt;p&gt;"What does this feature do?" is an engineering question.&lt;br&gt;
"What problem does this solve for users, and how do we explain it so they succeed?" is a documentation question.&lt;/p&gt;

&lt;p&gt;Both are valid. But they're different languages. And sometimes it feels like I'm the only one speaking mine.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Flip Side: Freedom
&lt;/h2&gt;

&lt;p&gt;I don't want this to sound like complaining. Because honestly? There's a flip side.&lt;/p&gt;

&lt;p&gt;Being the solo technical writer means I own the documentation voice. I set the standards. When I decide we're going to write in a certain style, that's the style. No committee. No endless debates. No death by consensus.&lt;/p&gt;

&lt;p&gt;I can experiment. I can try new approaches. If something doesn't work, I can change it without convincing five people first.&lt;/p&gt;

&lt;p&gt;The autonomy is real. And it's valuable.&lt;/p&gt;

&lt;p&gt;But autonomy and loneliness are two sides of the same coin. You can't have one without accepting some of the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding Your People Outside Work
&lt;/h2&gt;

&lt;p&gt;The thing that's helped most? Finding community outside my company.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.writethedocs.org/slack/" rel="noopener noreferrer"&gt;Write the Docs Slack&lt;/a&gt; has been invaluable. Thousands of technical writers sharing challenges, asking questions, and celebrating wins that actually make sense to each other.&lt;/p&gt;

&lt;p&gt;"I finally got the API reference structure right" gets real excitement there. People understand.&lt;/p&gt;

&lt;p&gt;Twitter and LinkedIn have helped too. Following other technical writers, reading about their processes, realizing that my challenges aren't unique — that's been grounding.&lt;/p&gt;

&lt;p&gt;You don't have to work with other technical writers to have a community of them.&lt;/p&gt;

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

&lt;p&gt;A few things I'd tell someone starting as a solo technical writer:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build relationships with engineers who explain things well.&lt;/strong&gt; Not all engineers communicate the same way. Find the ones who naturally translate complexity into clarity. They'll make your job easier and your documentation better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create your own feedback loops.&lt;/strong&gt; If no one's reviewing your work for documentation quality, find ways to get that feedback. Watch new users navigate your docs. Ask support what questions keep coming up. The feedback exists — you just have to seek it out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Celebrate your own wins.&lt;/strong&gt; No one else will fully understand why that sidebar restructure mattered. Celebrate it anyway. Keep a list of improvements you've made. Look at it when you need a reminder that your work matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Find your community.&lt;/strong&gt; Write the Docs, DevRel communities, Twitter, LinkedIn — the people who understand your work exist. They're just not in your office.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accept the trade-off.&lt;/strong&gt; Autonomy comes with loneliness. Freedom comes with responsibility. You can't have the good parts without accepting the harder parts too.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's Worth It
&lt;/h2&gt;

&lt;p&gt;Being a solo technical writer is lonely sometimes. That's the truth.&lt;/p&gt;

&lt;p&gt;But it's also deeply rewarding. You own something meaningful. You see the direct impact of your work. You build something that helps real people accomplish real things.&lt;/p&gt;

&lt;p&gt;The loneliness isn't a bug. It's just part of the deal.&lt;/p&gt;

&lt;p&gt;And once you accept that, you can build the support systems you need — inside and outside your company — to thrive anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are you a solo technical writer? What's been your experience? I'd love to hear what's worked for you.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devrel</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Writing API Documentation That Developers Actually Read</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Tue, 20 Jan 2026 10:40:47 +0000</pubDate>
      <link>https://dev.to/daisyauma/writing-api-documentation-that-developers-actually-read-2jn5</link>
      <guid>https://dev.to/daisyauma/writing-api-documentation-that-developers-actually-read-2jn5</guid>
      <description>&lt;p&gt;&lt;em&gt;Lessons from documenting AI APIs as a solo technical writer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here's a truth that took me too long to learn: Most API documentation is written for the writer, not the reader.&lt;/p&gt;

&lt;p&gt;We document endpoints in alphabetical order because it's easy to organize. We list every parameter because we want to be thorough. We write comprehensive reference docs and wonder why developers still ask basic questions in support channels.&lt;/p&gt;

&lt;p&gt;As the only technical writer at an AI startup, I've had to rethink how I approach API documentation. Here's what actually works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Start With Use Cases, Not Endpoints
&lt;/h2&gt;

&lt;p&gt;The biggest mistake I made early on was organizing documentation by endpoint.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;POST /users/createGET /users/listPUT /users/update&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Alphabetical. Comprehensive. Completely useless for someone trying to figure out how to get started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What developers actually want to know:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do I analyze a video file?&lt;/li&gt;
&lt;li&gt;How do I monitor sensor data in real-time?&lt;/li&gt;
&lt;li&gt;How do I get my first successful API call working?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I start every API section with a use case. Not "here's what this endpoint does" but "here's what you're trying to accomplish, and here's how."&lt;/p&gt;

&lt;p&gt;The endpoint reference still exists. But it's not the entry point. The use case is.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stripe.com/docs/api" rel="noopener noreferrer"&gt;Stripe's API documentation&lt;/a&gt; is the gold standard here, they lead with use cases like "Accept a payment" before diving into endpoint references.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Quickstart Is Everything
&lt;/h2&gt;

&lt;p&gt;If your quickstart doesn't work, nothing else matters.&lt;/p&gt;

&lt;p&gt;I learned this the hard way when we had a hackathon approaching and our quickstart guide wasn't returning results. The API reference was complete. The conceptual docs were polished. But developers couldn't get past step one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A good quickstart should:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Work in under 5 minutes&lt;/li&gt;
&lt;li&gt;Require minimal setup&lt;/li&gt;
&lt;li&gt;Show a real result (not just a 200 OK)&lt;/li&gt;
&lt;li&gt;Be testable by someone who knows nothing about your product&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I now test every quickstart on a fresh environment before publishing. If I can't get it working in 5 minutes with just the docs, it's not ready.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.twilio.com/docs/quickstart" rel="noopener noreferrer"&gt;Twilio's quickstarts&lt;/a&gt; are excellent examples — they get you to a working "Hello World" in minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Examples Must Actually Run
&lt;/h2&gt;

&lt;p&gt;This sounds obvious. It's not.&lt;/p&gt;

&lt;p&gt;I've lost count of how many times I've found code examples that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use deprecated endpoints&lt;/li&gt;
&lt;li&gt;Have typos in parameter names&lt;/li&gt;
&lt;li&gt;Work in the old API version but not the current one&lt;/li&gt;
&lt;li&gt;Are missing required authentication headers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;My process now:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Write the code example&lt;/li&gt;
&lt;li&gt;Actually run it&lt;/li&gt;
&lt;li&gt;Copy the exact code that worked into the docs&lt;/li&gt;
&lt;li&gt;Add a test to catch when it breaks&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That last part is crucial. APIs change. If you don't have automated checks, your examples will rot.&lt;/p&gt;

&lt;p&gt;One specific lesson: JSON formatting matters more than you think. I once spent hours debugging why an API call failed, only to discover that multi-line JSON with whitespace caused errors, but compact single-line JSON worked fine. That's now documented with a warning.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Documentation Is Not Optional
&lt;/h2&gt;

&lt;p&gt;Most API docs show you the happy path. Request goes in, response comes out, everyone's happy.&lt;/p&gt;

&lt;p&gt;Real developers spend most of their time in the unhappy path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For every endpoint, I now document:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What errors can occur&lt;/li&gt;
&lt;li&gt;What each error code means&lt;/li&gt;
&lt;li&gt;What likely caused it&lt;/li&gt;
&lt;li&gt;How to fix it&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;400 - Missing Required Field
{
  "code": "missing_field",
  "message": "Missing field: user_id",
  "suggestion": "Ensure your request body includes the required user_id field"
}

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

&lt;/div&gt;



&lt;p&gt;This takes more time upfront but dramatically reduces support tickets. When developers can self-serve their way out of errors, everyone wins.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stripe.com/docs/error-codes" rel="noopener noreferrer"&gt;Stripe's error handling documentation&lt;/a&gt; is worth studying, they document every error code with causes and solutions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure Matters More Than You Think
&lt;/h2&gt;

&lt;p&gt;A few formatting lessons I've learned:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use tabs for multi-language examples.&lt;/strong&gt; If you support Python, JavaScript, and cURL, don't make developers scroll past two languages they don't care about.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lead with the most common case.&lt;/strong&gt; If 90% of users need the simple version, show that first. Put the advanced options in an expandable section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be consistent.&lt;/strong&gt; If you show request first, then response in one section, do it that way everywhere. Developers build mental models of your docs. Don't break them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Make copy-paste easy.&lt;/strong&gt; If developers need to copy an API key, a URL, or a code snippet, make sure it copies cleanly without extra whitespace or formatting artifacts.&lt;/p&gt;

&lt;p&gt;If you're using a docs-as-code approach, tools like &lt;a href="https://mintlify.com/" rel="noopener noreferrer"&gt;Mintlify&lt;/a&gt;, &lt;a href="https://readme.com/" rel="noopener noreferrer"&gt;ReadMe&lt;/a&gt;, or &lt;a href="https://redocly.com/" rel="noopener noreferrer"&gt;Redocly&lt;/a&gt; have built-in components for tabs, code groups, and interactive examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test Your Own Documentation
&lt;/h2&gt;

&lt;p&gt;The best feedback on my docs comes from watching someone use them.&lt;/p&gt;

&lt;p&gt;When we onboarded new team members, I asked them to mark every point where they got confused. Every time they had to ask a question, that was a documentation failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions I now ask myself:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can someone with no context get from zero to working API call using just these docs?&lt;/li&gt;
&lt;li&gt;When they hit an error, can they figure out what went wrong?&lt;/li&gt;
&lt;li&gt;Are they copying code examples directly, or having to modify them?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the answer to any of these is "no," the docs aren't done.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.writethedocs.org/slack/" rel="noopener noreferrer"&gt;Write the Docs community&lt;/a&gt; has been invaluable for getting feedback and learning from other technical writers facing similar challenges.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 3 AM Test
&lt;/h2&gt;

&lt;p&gt;Here's my final quality check:&lt;/p&gt;

&lt;p&gt;Imagine a developer at 3 AM, deadline looming, trying to integrate your API. They're tired. They're frustrated. They don't want to read your carefully crafted conceptual overview.&lt;/p&gt;

&lt;p&gt;Can they find what they need in 30 seconds? Can they copy a working example? Can they troubleshoot errors without filing a support ticket?&lt;/p&gt;

&lt;p&gt;If yes, your docs are ready. If no, keep iterating.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'm Still Learning
&lt;/h2&gt;

&lt;p&gt;API documentation is never done. I'm still figuring out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to document AI outputs that aren't deterministic ("results may vary" is true but not helpful)&lt;/li&gt;
&lt;li&gt;How to balance comprehensive reference docs with practical guides&lt;/li&gt;
&lt;li&gt;How to keep docs updated when the API changes weekly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the fundamentals stay the same: start with use cases, make the quickstart bulletproof, test everything, and always write for the developer at 3 AM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources That Have Helped Me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://cloud.google.com/apis/design" rel="noopener noreferrer"&gt;Google's API Design Guide&lt;/a&gt; — Principles for designing (and documenting) APIs&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docsfordevelopers.com/" rel="noopener noreferrer"&gt;Docs for Developers&lt;/a&gt; — The book that shaped how I think about developer docs&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idratherbewriting.com/" rel="noopener noreferrer"&gt;I'd Rather Be Writing&lt;/a&gt; — Tom Johnson's blog on API documentation&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.writethedocs.org/slack/" rel="noopener noreferrer"&gt;Write the Docs Slack&lt;/a&gt; — Community of technical writers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What's the best API documentation you've encountered? What made it work?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>api</category>
      <category>documentation</category>
      <category>writing</category>
    </item>
    <item>
      <title>How I Turned Slack Messages Into Documentation</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Tue, 13 Jan 2026 06:40:25 +0000</pubDate>
      <link>https://dev.to/daisyauma/how-i-turned-slack-messages-into-documentation-4881</link>
      <guid>https://dev.to/daisyauma/how-i-turned-slack-messages-into-documentation-4881</guid>
      <description>&lt;p&gt;&lt;em&gt;The unsexy process behind gathering information as a solo technical writer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At startups, knowledge doesn't live in neatly organized wikis or comprehensive handoff documents. It lives in Slack threads, Notion pages with outdated information, and most critically — in engineers' heads.&lt;/p&gt;

&lt;p&gt;As the only technical writer at an AI startup, my job isn't just writing documentation. It's excavating knowledge before it disappears.&lt;/p&gt;

&lt;p&gt;Here's the actual process I use to turn scattered internal conversations into documentation that developers can actually use.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Reality of Information Gathering
&lt;/h2&gt;

&lt;p&gt;When I joined my company, I inherited documentation that was outdated and AI-generated. The product had evolved significantly, but the docs hadn't kept pace. The knowledge existed — it was just trapped in places I couldn't access.&lt;/p&gt;

&lt;p&gt;I quickly learned that the best explanations weren't in formal documents. They were in Slack messages where an engineer answered a customer question at 11 PM. In casual conversations during standups. In the comments of pull requests.&lt;/p&gt;

&lt;p&gt;My job became part technical writer, part archaeologist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Build Relationships Before You Need Them
&lt;/h2&gt;

&lt;p&gt;This is the step most technical writers skip, and it's the most important one.&lt;/p&gt;

&lt;p&gt;Engineers are busy. They're shipping features, fixing bugs, and attending meetings. Documentation is rarely their priority. If you only show up when you need something, you'll always be at the bottom of their to-do list.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I do instead:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I show up in engineering channels even when I don't need anything. I react to their wins. I ask genuine questions about what they're building. When I see an interesting technical discussion, I engage with curiosity, not just for documentation purposes.&lt;/p&gt;

&lt;p&gt;When I finally do need their help documenting a feature, I'm not a stranger asking for a favor. I'm a colleague they've interacted with.&lt;/p&gt;

&lt;p&gt;This sounds soft, but it's the difference between getting a response in two hours versus two weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Ask Specific Questions, Not Open-Ended Ones
&lt;/h2&gt;

&lt;p&gt;Early on, I made the mistake of asking engineers: "Can you explain how this feature works?"&lt;/p&gt;

&lt;p&gt;The responses were either overwhelming (a 30-minute monologue covering edge cases I didn't need) or unhelpfully brief ("It does what the PR says").&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What actually works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of "How does this work?", I ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"What happens when a user sends an invalid API key?"&lt;/li&gt;
&lt;li&gt;"What's the most common mistake customers make with this endpoint?"&lt;/li&gt;
&lt;li&gt;"If this fails, what error message do they see?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Specific questions get specific answers. Specific answers become useful documentation.&lt;/p&gt;

&lt;p&gt;The best question I've learned to ask: &lt;strong&gt;"What do you wish customers understood before they start using this?"&lt;/strong&gt; Engineers love answering this one because it lets them vent about the support tickets they're tired of seeing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Capture Conversations in Real-Time
&lt;/h2&gt;

&lt;p&gt;The gold is in the Slack threads. Here's my actual process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When I see an engineer explain something well in Slack:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I screenshot or copy the message immediately&lt;/li&gt;
&lt;li&gt;I DM them: "That explanation was really clear. Mind if I turn this into docs?"&lt;/li&gt;
&lt;li&gt;Most say yes. Many are flattered.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;When a customer asks a question in a support channel:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I note the question (this tells me what's unclear in current docs)&lt;/li&gt;
&lt;li&gt;I watch how the engineer responds&lt;/li&gt;
&lt;li&gt;I add this to my documentation backlog&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;When I'm in meetings:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I keep a running note of anything that makes me think "wait, is that documented?" It usually isn't.&lt;/p&gt;

&lt;p&gt;The key is capturing knowledge when it's fresh. Engineers explain things clearly in the moment, but ask them to re-explain two weeks later and the clarity is gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Make Reviews Stupidly Easy
&lt;/h2&gt;

&lt;p&gt;Getting engineers to review documentation is like pulling teeth — unless you make it effortless.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What doesn't work:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"Hey, can you review the docs I wrote?"&lt;/p&gt;

&lt;p&gt;This gets ignored because it feels like an undefined time commitment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;"Hey, can you check if the code example in section 3 actually runs? Should take 5 minutes."&lt;/p&gt;

&lt;p&gt;I break reviews into tiny, specific asks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Is this parameter description accurate?"&lt;/li&gt;
&lt;li&gt;"Did I get the error codes right?"&lt;/li&gt;
&lt;li&gt;"Any gotchas I should add?"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also learned to set deadlines with consequences:&lt;/p&gt;

&lt;p&gt;"I'm publishing this Thursday at 2 PM. If I don't hear back, I'm assuming it's accurate."&lt;/p&gt;

&lt;p&gt;This sounds aggressive, but it works. Engineers don't want wrong documentation published under their name. They'll make time to respond when there's a deadline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Build a System, Not Just Documents
&lt;/h2&gt;

&lt;p&gt;Individual documents are nice. A system is sustainable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My simple system:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I keep a "docs debt" list — a running note of everything I've noticed needs documentation but haven't had time to write. Every Friday, I spend two hours chipping away at it.&lt;/p&gt;

&lt;p&gt;I also maintain templates for common documentation types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API endpoint documentation&lt;/li&gt;
&lt;li&gt;Tutorial structure&lt;/li&gt;
&lt;li&gt;Troubleshooting guides&lt;/li&gt;
&lt;li&gt;Release notes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Templates mean I spend my mental energy on content, not structure. They also create consistency across documents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Slack channel hack:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I created a #docs-updates channel where I post whenever I publish new documentation. Two benefits:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Engineers see their work being documented (makes them more likely to help in the future)&lt;/li&gt;
&lt;li&gt;People can flag issues immediately ("Actually, we changed that endpoint last week")&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;After months of doing this, a few things have become clear:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documentation is 20% writing, 80% gathering.&lt;/strong&gt; The actual writing is the easy part. Getting accurate information from busy people is the real skill.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Timing matters more than asking nicely.&lt;/strong&gt; Catch engineers right after they ship a feature — they're still excited and remember the details. Wait two weeks and you'll get "I don't remember, check the PR."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Perfect is the enemy of published.&lt;/strong&gt; I used to wait until documentation was comprehensive before publishing. Now I ship "good enough" and iterate. Something helpful today beats something perfect next month.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your documentation is only as good as your relationships.&lt;/strong&gt; I know which engineers explain things clearly, which ones need more specific questions, and which ones prefer async communication. This knowledge is as valuable as any writing skill.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Unsexy Truth
&lt;/h2&gt;

&lt;p&gt;There's no magic tool that extracts knowledge from your organization. Mintlify makes the publishing beautiful. GitHub makes version control seamless. But the actual information gathering?&lt;/p&gt;

&lt;p&gt;That's Slack messages at 9 PM. That's coffee chats that turn into impromptu explanations. That's asking "dumb questions" in engineering channels and not caring if you look uninformed.&lt;/p&gt;

&lt;p&gt;It's not glamorous. But it's how documentation actually gets made at startups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's your biggest challenge in gathering information for documentation? I'd love to hear what works (and what doesn't) for others.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devrel</category>
      <category>documentation</category>
    </item>
    <item>
      <title># Why I Chose Mintlify (And What I Wish I Knew Earlier)</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Mon, 05 Jan 2026 20:03:20 +0000</pubDate>
      <link>https://dev.to/daisyauma/-why-i-chose-mintlify-and-what-i-wish-i-knew-earlier-1b2l</link>
      <guid>https://dev.to/daisyauma/-why-i-chose-mintlify-and-what-i-wish-i-knew-earlier-1b2l</guid>
      <description>&lt;p&gt;&lt;em&gt;An honest review from a solo technical writer at an AI startup&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let me be upfront: I didn't choose &lt;a href="https://mintlify.com/" rel="noopener noreferrer"&gt;Mintlify&lt;/a&gt;. When I joined my current company as the first and only technical writer, the platform had already been selected. The documentation needed a complete overhaul, and Mintlify was what I had to work with.&lt;/p&gt;

&lt;p&gt;At first, I wasn't sure what to expect. I'd heard of Mintlify but never used it. Now, after months of building documentation from scratch on this platform, I have opinions, and honestly? I'd choose it myself if I had to start over.&lt;/p&gt;

&lt;p&gt;Here's my honest take on Mintlify what works, what's tricky, and why it might (or might not) be right for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Mintlify Compares to Alternatives
&lt;/h2&gt;

&lt;p&gt;Even though I didn't make the initial choice, I've since evaluated whether it was the right one. Here's how Mintlify stacks up against what else is out there:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.gitbook.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;GitBook&lt;/strong&gt;&lt;/a&gt; is the go-to for many teams. It's polished, collaborative, and has a gentle learning curve. But for a developer-focused product with heavy API documentation, I found it limiting. The customization options felt restrictive, and the pricing scales quickly as your team grows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://readme.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;ReadMe&lt;/strong&gt;&lt;/a&gt; is fantastic for API documentation specifically. The interactive API explorer is genuinely impressive. But if you need more than API docs; tutorials, conceptual guides, getting started content, it starts to feel like you're fighting the platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docusaurus.io/" rel="noopener noreferrer"&gt;&lt;strong&gt;Docusaurus&lt;/strong&gt;&lt;/a&gt; gives you complete control. It's open-source, React-based, and incredibly flexible. The trade-off? You're essentially maintaining a website. For a solo technical writer at a startup, that overhead wasn't something I could justify.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mintlify&lt;/strong&gt; sits in an interesting middle ground: docs-as-code workflow, beautiful defaults, and enough customization to not feel boxed in.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Love About Mintlify
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Docs-as-Code Workflow Changed Everything
&lt;/h3&gt;

&lt;p&gt;This was the game-changer for me. My documentation lives in a GitHub repository, written in &lt;a href="https://mdxjs.com/" rel="noopener noreferrer"&gt;MDX&lt;/a&gt; (Markdown with components). Every change goes through a pull request. Engineers can review docs the same way they review code.&lt;/p&gt;

&lt;p&gt;Why this matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Version control&lt;/strong&gt;: I can see exactly what changed, when, and why&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collaboration&lt;/strong&gt;: Engineers can suggest edits directly in the files they know&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt;: Push to main, docs update automatically&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backup&lt;/strong&gt;: My documentation is just files in a repo, not locked in someone's database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Coming from tools where documentation lived in a web interface, this felt like a revelation. No more copy-pasting between platforms. No more wondering if I saved my changes. Just Git.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Defaults Are Actually Beautiful
&lt;/h3&gt;

&lt;p&gt;I've used documentation tools where "out of the box" meant spending a week on styling before you could show anyone. Mintlify's defaults look professional from day one.&lt;/p&gt;

&lt;p&gt;The typography is clean. The navigation makes sense. Dark mode works properly. Code blocks have syntax highlighting. These sound like basics, but you'd be surprised how many platforms get them wrong.&lt;/p&gt;

&lt;p&gt;For a startup where I needed to ship documentation fast, not spending time on design decisions was a gift.&lt;/p&gt;

&lt;h3&gt;
  
  
  MDX Components Save Hours
&lt;/h3&gt;

&lt;p&gt;Mintlify comes with &lt;a href="https://www.mintlify.com/docs/components" rel="noopener noreferrer"&gt;built-in components&lt;/a&gt; that would take forever to build yourself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/components/tabs" rel="noopener noreferrer"&gt;&lt;strong&gt;Tabs&lt;/strong&gt;&lt;/a&gt; for showing multiple code examples (Python, JavaScript, cURL)&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/components/callouts" rel="noopener noreferrer"&gt;&lt;strong&gt;Callouts&lt;/strong&gt;&lt;/a&gt; for notes, warnings, and tips&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/components/cards" rel="noopener noreferrer"&gt;&lt;strong&gt;Cards&lt;/strong&gt;&lt;/a&gt; for navigation and feature highlights&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/components/steps" rel="noopener noreferrer"&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/a&gt; for sequential instructions&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/components/code-groups#code-groups" rel="noopener noreferrer"&gt;&lt;strong&gt;Code groups&lt;/strong&gt;&lt;/a&gt; for switching between related examples&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.mintlify.com/docs/api-playground/overview" rel="noopener noreferrer"&gt;&lt;strong&gt;API playground&lt;/strong&gt;&lt;/a&gt; that lets developers test endpoints directly in the docs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These aren't just nice-to-have. They're the difference between documentation that people skim and documentation that people actually use.&lt;/p&gt;

&lt;h3&gt;
  
  
  The API Reference Generation
&lt;/h3&gt;

&lt;p&gt;If you're documenting APIs, Mintlify can &lt;a href="https://www.mintlify.com/docs/api-playground/openapi-setup#openapi-setup" rel="noopener noreferrer"&gt;generate reference documentation from your OpenAPI spec&lt;/a&gt;. You maintain your spec file, and the docs stay in sync.&lt;/p&gt;

&lt;p&gt;Is it perfect? No. I still end up writing custom content around the generated reference. But having the baseline automatically generated with request/response examples, parameter descriptions, and authentication details saves significant time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Wish I Knew Earlier
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Learning Curve Is Real
&lt;/h3&gt;

&lt;p&gt;Mintlify markets itself as simple, and it is once you understand the patterns. But there's a learning curve that caught me off guard.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.mintlify.com/docs/organize/settings#global-settings" rel="noopener noreferrer"&gt;&lt;code&gt;docs.json&lt;/code&gt;&lt;/a&gt; &lt;a href="https://mintlify.com/docs/settings/global" rel="noopener noreferrer"&gt;configuration file&lt;/a&gt; controls your entire site structure. Navigation, styling, integrations, redirects — it's all in one file. When things break, you're often debugging JSON structure.&lt;/p&gt;

&lt;p&gt;My first few weeks involved a lot of trial and error. "Why isn't this page showing up in the sidebar?" Usually: I forgot to add it to the navigation config. "Why is this redirect not working?" Usually: path formatting issues.&lt;/p&gt;

&lt;p&gt;If you're not comfortable with JSON configuration and Git workflows, budget time for learning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Image Handling Has Quirks
&lt;/h3&gt;

&lt;p&gt;This one bit me multiple times. &lt;a href="https://www.mintlify.com/docs/create/image-embeds#images-and-embeds" rel="noopener noreferrer"&gt;Images in Mintlify&lt;/a&gt; need to be in specific locations, and the path syntax depends on where your MDX file lives.&lt;/p&gt;

&lt;p&gt;I've debugged countless "image not displaying" issues. The culprit is usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wrong path (relative vs. absolute)&lt;/li&gt;
&lt;li&gt;Case sensitivity in filenames&lt;/li&gt;
&lt;li&gt;Forgetting to commit the image file to Git&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My advice: establish a clear image organization system from day one and stick to it religiously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some Features Need Workarounds
&lt;/h3&gt;

&lt;p&gt;Not everything works exactly as documented. I've had to get creative with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dark/light mode images&lt;/strong&gt;: Needed custom CSS classes to swap images based on theme&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nested navigation&lt;/strong&gt;: The sidebar structure has limits that required restructuring my content&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom components&lt;/strong&gt;: Possible, but requires understanding the underlying system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these are dealbreakers, but they're the kind of friction that adds up when you're trying to move fast.&lt;/p&gt;

&lt;h3&gt;
  
  
  Enterprise Features Cost Extra
&lt;/h3&gt;

&lt;p&gt;If you need &lt;a href="https://www.mintlify.com/docs/deploy/authentication-setup#interaction-with-authentication-modes" rel="noopener noreferrer"&gt;authentication&lt;/a&gt;, &lt;a href="https://www.mintlify.com/docs/deploy/personalization-setup#personalization-setup" rel="noopener noreferrer"&gt;personalization&lt;/a&gt;, or analytics beyond the basics, you're looking at higher-tier plans. I implemented customer-specific documentation using Mintlify's authentication features, it works well, but it wasn't part of the base package.&lt;/p&gt;

&lt;p&gt;For a startup, be realistic about what features you need now vs. later. The &lt;a href="https://mintlify.com/pricing" rel="noopener noreferrer"&gt;free and lower tiers&lt;/a&gt; are generous for getting started, but factor in growth.&lt;/p&gt;




&lt;h2&gt;
  
  
  Who Should (and Shouldn't) Use Mintlify
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Mintlify is great if you:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Want docs-as-code without building your own system&lt;/li&gt;
&lt;li&gt;Have developer-focused documentation with API content&lt;/li&gt;
&lt;li&gt;Value beautiful defaults over unlimited customization&lt;/li&gt;
&lt;li&gt;Are comfortable with Git and Markdown&lt;/li&gt;
&lt;li&gt;Need to ship documentation quickly at a startup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Consider alternatives if you:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Need heavy collaboration features for non-technical writers&lt;/li&gt;
&lt;li&gt;Want a completely custom design (&lt;a href="https://docusaurus.io/" rel="noopener noreferrer"&gt;Docusaurus&lt;/a&gt; gives more control)&lt;/li&gt;
&lt;li&gt;Primarily need internal documentation (&lt;a href="https://notion.so/" rel="noopener noreferrer"&gt;Notion&lt;/a&gt; or &lt;a href="https://www.atlassian.com/software/confluence" rel="noopener noreferrer"&gt;Confluence&lt;/a&gt; might be simpler)&lt;/li&gt;
&lt;li&gt;Have a large team that needs granular permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;I didn't choose Mintlify but after months of daily use, I'm glad someone else did. If I were starting fresh at a new company and had to pick a documentation platform myself, Mintlify would be at the top of my list.&lt;/p&gt;

&lt;p&gt;The docs-as-code workflow fits how I think about documentation. The defaults are beautiful. The components save time. The platform gets out of my way and lets me focus on writing.&lt;/p&gt;

&lt;p&gt;Is it perfect? No. The learning curve is steeper than advertised. Some features need workarounds. Enterprise features add up.&lt;/p&gt;

&lt;p&gt;But for a solo technical writer at a startup building developer documentation? It's been the right tool for the job.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What documentation platform do you use? I'm curious what's worked (and what hasn't) for others. Drop a comment — I read every one.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>documentation</category>
      <category>tooling</category>
    </item>
    <item>
      <title>The Python Web Stack You've Never Heard Of: Building Apps Without Frontend Code</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Mon, 05 Jan 2026 20:02:43 +0000</pubDate>
      <link>https://dev.to/daisyauma/the-python-web-stack-youve-never-heard-of-building-apps-without-frontend-code-en6</link>
      <guid>https://dev.to/daisyauma/the-python-web-stack-youve-never-heard-of-building-apps-without-frontend-code-en6</guid>
      <description>&lt;p&gt;I recently interviewed with Anvil, and despite not getting the role, I found what they do to be really cool. As a Python developer, I’ve hit the same wall countless times: I can wrangle data, build ML models, automate workflows, but the moment someone says “put a web UI on that,” I’m stuck learning React, wrestling with JavaScript tooling, and coordinating between frontend and backend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anvil.works/" rel="noopener noreferrer"&gt;Anvil&lt;/a&gt;&amp;nbsp;takes a contrarian approach: what if you could write your entire web application including the client-side code in Python? No JavaScript required. But here’s the technical puzzle: browsers only understand JavaScript. So how does this actually work?&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;

&lt;p&gt;Anvil’s stack consists of four main layers that work together to enable full-stack Python development:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Layer&lt;/strong&gt;: Python code that runs in the browser, compiled to JavaScript via Skulpt&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Server Layer&lt;/strong&gt;: Standard Python with full ecosystem access, running on Anvil’s servers&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Communication&lt;/strong&gt;: RPC over WebSockets connecting client and server seamlessly&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Database&lt;/strong&gt;: Built-in PostgreSQL (Data Tables) or connect to external databases&lt;/p&gt;

&lt;p&gt;There’s also an optional fifth component called the&amp;nbsp;&lt;strong&gt;Uplink&lt;/strong&gt;, which lets you connect local Python scripts or Jupyter notebooks to your web app (more on this later).&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%2Fsced6imz16xvg888ve2o.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%2Fsced6imz16xvg888ve2o.png" alt="Anvil architecture" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key innovation here is a unified language across the entire stack. No context switching between Python and JavaScript, no REST API boilerplate, no separate frontend and backend codebases.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Technical Magic: Client-Side Python
&lt;/h2&gt;

&lt;p&gt;Here’s the fundamental problem: web browsers only execute JavaScript. For decades, the solution has been clear: learn JavaScript frameworks, coordinate between frontend and backend teams, manage two entirely different codebases.&lt;/p&gt;

&lt;p&gt;Anvil’s solution relies on&amp;nbsp;&lt;a href="https://skulpt.org/" rel="noopener noreferrer"&gt;Skulpt&lt;/a&gt;, a JavaScript implementation of Python that runs in the browser. When you write Python code for the client-side, it gets compiled to JavaScript at runtime. This means your Python code is actually executing in the browser, handling events, manipulating the DOM, and updating the UI.&lt;/p&gt;

&lt;p&gt;Here’s what this looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This Python code runs IN THE BROWSER
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyForm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyFormTemplate&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;button_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Client-side event handling in Python
&lt;/span&gt;    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello from the browser!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Call server seamlessly (looks like a regular function call)
&lt;/span&gt;    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;process_data&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is genuinely running as Python in your browser. The&amp;nbsp;button_click&amp;nbsp;method handles a UI event, displays an alert, calls a server function, and updates a label, all without writing a single line of JavaScript.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Familiar Python syntax and patterns with no mental context switching&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seamless client-server communication where RPC calls look like regular Python functions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unified codebase with one language and one set of conventions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rapid development without frontend/backend coordination overhead&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The crucial insight is understanding where code actually runs. UI event handlers execute in the browser (Python via Skulpt), but heavy data processing, machine learning, and pandas operations run on the server in native Python. Database queries happen server-side. The architecture naturally guides you toward the right separation of concerns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Code Example
&lt;/h2&gt;

&lt;p&gt;Let’s build a mini data dashboard that demonstrates how everything fits together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# === SERVER MODULE (server.py) ===
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;plotly.express&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anvil.server&lt;/span&gt;

&lt;span class="nd"&gt;@anvil.server.callable&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;analyze_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Full Python ecosystem available here
&lt;/span&gt;  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;reset_index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="n"&gt;fig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
               &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Sales by Category&lt;/span&gt;&lt;span class="sh"&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;fig&lt;/span&gt;

&lt;span class="nd"&gt;@anvil.server.callable&lt;/span&gt;  
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_to_database&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Built-in database access
&lt;/span&gt;  &lt;span class="n"&gt;app_tables&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Saved successfully&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="c1"&gt;# === CLIENT MODULE (Form1.py) ===
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anvil.server&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Form1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Form1Template&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;upload_change&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# This runs in the browser
&lt;/span&gt;    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

    &lt;span class="c1"&gt;# Call server function - seamless RPC
&lt;/span&gt;    &lt;span class="n"&gt;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;analyze_sales&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;figure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;

    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_button_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dropdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;selected_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;save_to_database&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;alert&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What’s happening here:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;File upload is handled client-side (Python in browser via Skulpt)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Heavy processing with pandas happens server-side with full Python capabilities&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RPC calls look like regular Python function calls (no HTTP requests to construct)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No JSON serialization code (Python objects are serialized automatically)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security is built-in: server functions decorated with&amp;nbsp;@anvil.server.callable&amp;nbsp;form your API boundary&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice there’s no REST API definition, no endpoint configuration, no fetch calls with headers and error handling. The&amp;nbsp;anvil.server.call()&amp;nbsp;function handles all of that transparently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration &amp;amp; Ecosystem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What Works Where&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Server-side, you have access to the full Python ecosystem. Install any pip package: pandas, scikit-learn, requests, TensorFlow. This is native Python execution.&lt;/p&gt;

&lt;p&gt;Client-side is more limited. Plotly works for visualizations, and you have access to a subset of the standard library, but compute-heavy libraries like NumPy won’t run in the browser. This limitation actually makes sense architecturally, heavy computation belongs on the server anyway.&lt;/p&gt;

&lt;p&gt;JavaScript libraries can be wrapped and called from Python using Anvil’s&amp;nbsp;&lt;a href="https://anvil.works/learn/tutorials/javascript-libraries" rel="noopener noreferrer"&gt;JavaScript integration features&lt;/a&gt;. You’re not completely cut off from the JavaScript ecosystem when you need it.&lt;/p&gt;

&lt;p&gt;Anvil includes&amp;nbsp;&lt;a href="https://anvil.works/docs/integrations" rel="noopener noreferrer"&gt;built-in integrations&lt;/a&gt;&amp;nbsp;for common services: Stripe for payments, Google and Microsoft for authentication and APIs, and email sending. These work out of the box with minimal configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Uplink: The Secret Weapon&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The&amp;nbsp;&lt;a href="https://anvil.works/docs/uplink" rel="noopener noreferrer"&gt;Uplink&lt;/a&gt;&amp;nbsp;is perhaps Anvil’s most unique feature. It lets you connect existing Python code running anywhere; your laptop, a Jupyter notebook, a GPU server to your web application.&lt;/p&gt;

&lt;p&gt;Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML&lt;code&gt;# Your local Jupyter notebook or scriptimport anvil.serveranvil.server.connect("YOUR_UPLINK_KEY")@anvil.server.callabledef run_ml_model(data):  # Use your local GPU, existing code, trained models  return model.predict(data)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your web app calls this like any server function, but it executes on your machine. This is brilliant for connecting data science workflows to web interfaces without rewriting everything. Your Jupyter notebook becomes a backend service.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use This
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Choose Anvil when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your team is Python-heavy but frontend-light&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building internal tools, dashboards, or admin panels&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rapidly prototyping data applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connecting Jupyter notebooks or data science code to web UIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You value development speed over pixel-perfect custom UI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating CRUD applications where Python’s full ecosystem matters more than complex client-side interactions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Anvil makes a specific technical bet: for certain types of applications, the productivity gains from using a unified language outweigh the performance overhead and ecosystem constraints of client-side Python.&lt;/p&gt;

&lt;p&gt;This isn’t about replacing React or Vue. It’s about offering an alternative path for Python developers who view web UIs as a necessary interface layer rather than the core of what they’re building. When your value is in data processing, business logic, or machine learning models, Anvil lets you wrap those capabilities in a web interface without learning an entirely new stack.&lt;/p&gt;

&lt;p&gt;The platform is part of a broader trend of Python expanding beyond its traditional backend role.&lt;/p&gt;

&lt;p&gt;Is this the future of web development? Probably not. But for specific use cases (particularly in data science, internal tooling, and rapid prototyping) it’s a genuinely productive alternative that more Python developers should know about.&lt;/p&gt;

&lt;p&gt;This article may not be perfect and I would appreciate any feedback!&lt;/p&gt;

&lt;p&gt;Buy me a coffee:&amp;nbsp;&lt;a href="https://buymeacoffee.com/daisyauma" rel="noopener noreferrer"&gt;https://buymeacoffee.com/daisyauma&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Python Web Stack You've Never Heard Of: Building Apps Without Frontend Code</title>
      <dc:creator>Daisy Auma</dc:creator>
      <pubDate>Thu, 09 Oct 2025 16:56:34 +0000</pubDate>
      <link>https://dev.to/daisyauma/the-python-web-stack-youve-never-heard-of-building-apps-without-frontend-code-4oj5</link>
      <guid>https://dev.to/daisyauma/the-python-web-stack-youve-never-heard-of-building-apps-without-frontend-code-4oj5</guid>
      <description>&lt;p&gt;I recently interviewed with Anvil, and despite not getting the role, I found what they do to be really cool. As a Python developer, I’ve hit the same wall countless times: I can wrangle data, build ML models, automate workflows, but the moment someone says “put a web UI on that,” I’m stuck learning React, wrestling with JavaScript tooling, and coordinating between frontend and backend.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anvil.works/" rel="noopener noreferrer"&gt;Anvil&lt;/a&gt;&amp;nbsp;takes a contrarian approach: what if you could write your entire web application including the client-side code in Python? No JavaScript required. But here’s the technical puzzle: browsers only understand JavaScript. So how does this actually work?&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;

&lt;p&gt;Anvil’s stack consists of four main layers that work together to enable full-stack Python development:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client Layer&lt;/strong&gt;: Python code that runs in the browser, compiled to JavaScript via Skulpt&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Server Layer&lt;/strong&gt;: Standard Python with full ecosystem access, running on Anvil’s servers&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Communication&lt;/strong&gt;: RPC over WebSockets connecting client and server seamlessly&amp;nbsp;&lt;br&gt;
&lt;strong&gt;Database&lt;/strong&gt;: Built-in PostgreSQL (Data Tables) or connect to external databases&lt;/p&gt;

&lt;p&gt;There’s also an optional fifth component called the&amp;nbsp;&lt;strong&gt;Uplink&lt;/strong&gt;, which lets you connect local Python scripts or Jupyter notebooks to your web app (more on this later).&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%2Fsced6imz16xvg888ve2o.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%2Fsced6imz16xvg888ve2o.png" alt="Anvil architecture" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The key innovation here is a unified language across the entire stack. No context switching between Python and JavaScript, no REST API boilerplate, no separate frontend and backend codebases.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Technical Magic: Client-Side Python
&lt;/h2&gt;

&lt;p&gt;Here’s the fundamental problem: web browsers only execute JavaScript. For decades, the solution has been clear: learn JavaScript frameworks, coordinate between frontend and backend teams, manage two entirely different codebases.&lt;/p&gt;

&lt;p&gt;Anvil’s solution relies on&amp;nbsp;&lt;a href="https://skulpt.org/" rel="noopener noreferrer"&gt;Skulpt&lt;/a&gt;, a JavaScript implementation of Python that runs in the browser. When you write Python code for the client-side, it gets compiled to JavaScript at runtime. This means your Python code is actually executing in the browser, handling events, manipulating the DOM, and updating the UI.&lt;/p&gt;

&lt;p&gt;Here’s what this looks like in practice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# This Python code runs IN THE BROWSER
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyForm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyFormTemplate&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;button_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Client-side event handling in Python
&lt;/span&gt;    &lt;span class="nf"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello from the browser!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Call server seamlessly (looks like a regular function call)
&lt;/span&gt;    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;process_data&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is genuinely running as Python in your browser. The&amp;nbsp;&lt;code&gt;button\_click&lt;/code&gt;&amp;nbsp;method handles a UI event, displays an alert, calls a server function, and updates a label, all without writing a single line of JavaScript.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Familiar Python syntax and patterns with no mental context switching&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Seamless client-server communication where RPC calls look like regular Python functions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unified codebase with one language and one set of conventions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rapid development without frontend/backend coordination overhead&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The crucial insight is understanding where code actually runs. UI event handlers execute in the browser (Python via Skulpt), but heavy data processing, machine learning, and pandas operations run on the server in native Python. Database queries happen server-side. The architecture naturally guides you toward the right separation of concerns.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Code Example
&lt;/h2&gt;

&lt;p&gt;Let’s build a mini data dashboard that demonstrates how everything fits together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# === SERVER MODULE (server.py) ===
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;plotly.express&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anvil.server&lt;/span&gt;

&lt;span class="nd"&gt;@anvil.server.callable&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;analyze_sales&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Full Python ecosystem available here
&lt;/span&gt;  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uploaded_file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;groupby&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;reset_index&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

  &lt;span class="n"&gt;fig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;px&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;revenue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
               &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Sales by Category&lt;/span&gt;&lt;span class="sh"&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;fig&lt;/span&gt;

&lt;span class="nd"&gt;@anvil.server.callable&lt;/span&gt;  
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_to_database&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Built-in database access
&lt;/span&gt;  &lt;span class="n"&gt;app_tables&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sales&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_row&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;category&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Saved successfully&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="c1"&gt;# === CLIENT MODULE (Form1.py) ===
&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anvil.server&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Form1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Form1Template&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;upload_change&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# This runs in the browser
&lt;/span&gt;    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

    &lt;span class="c1"&gt;# Call server function - seamless RPC
&lt;/span&gt;    &lt;span class="n"&gt;chart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;analyze_sales&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;figure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chart&lt;/span&gt;

    &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;visible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;save_button_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;event_args&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dropdown&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;selected_value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amount&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text_box&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;save_to_database&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;alert&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What’s happening here:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;File upload is handled client-side (Python in browser via Skulpt)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Heavy processing with pandas happens server-side with full Python capabilities&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RPC calls look like regular Python function calls (no HTTP requests to construct)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No JSON serialization code (Python objects are serialized automatically)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security is built-in: server functions decorated with&amp;nbsp;&lt;code&gt;@anvil.server.callable&lt;/code&gt;&amp;nbsp;form your API boundary&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice there’s no REST API definition, no endpoint configuration, no fetch calls with headers and error handling. The&amp;nbsp;&lt;code&gt;anvil.server.call()&lt;/code&gt;&amp;nbsp;function handles all of that transparently.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integration &amp;amp; Ecosystem
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What Works Where&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Server-side, you have access to the full Python ecosystem. Install any pip package: pandas, scikit-learn, requests, TensorFlow. This is native Python execution.&lt;/p&gt;

&lt;p&gt;Client-side is more limited. Plotly works for visualizations, and you have access to a subset of the standard library, but compute-heavy libraries like NumPy won’t run in the browser. This limitation actually makes sense architecturally, heavy computation belongs on the server anyway.&lt;/p&gt;

&lt;p&gt;JavaScript libraries can be wrapped and called from Python using Anvil’s&amp;nbsp;&lt;a href="https://anvil.works/learn/tutorials/javascript-libraries" rel="noopener noreferrer"&gt;JavaScript integration features&lt;/a&gt;. You’re not completely cut off from the JavaScript ecosystem when you need it.&lt;/p&gt;

&lt;p&gt;Anvil includes&amp;nbsp;&lt;a href="https://anvil.works/docs/integrations" rel="noopener noreferrer"&gt;built-in integrations&lt;/a&gt;&amp;nbsp;for common services: Stripe for payments, Google and Microsoft for authentication and APIs, and email sending. These work out of the box with minimal configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Uplink: The Secret Weapon&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The&amp;nbsp;&lt;a href="https://anvil.works/docs/uplink" rel="noopener noreferrer"&gt;Uplink&lt;/a&gt;&amp;nbsp;is perhaps Anvil’s most unique feature. It lets you connect existing Python code running anywhere; your laptop, a Jupyter notebook, a GPU server to your web application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Your local Jupyter notebook or script
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anvil.server&lt;/span&gt;
&lt;span class="n"&gt;anvil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;YOUR_UPLINK_KEY&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@anvil.server.callable&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run_ml_model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
  &lt;span class="c1"&gt;# Use your local GPU, existing code, trained models
&lt;/span&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;predict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your web app calls this like any server function, but it executes on your machine. This is brilliant for connecting data science workflows to web interfaces without rewriting everything. Your Jupyter notebook becomes a backend service.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use This
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Choose Anvil when:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Your team is Python-heavy but frontend-light&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building internal tools, dashboards, or admin panels&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rapidly prototyping data applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Connecting Jupyter notebooks or data science code to web UIs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You value development speed over pixel-perfect custom UI&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Creating CRUD applications where Python’s full ecosystem matters more than complex client-side interactions&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Bottom Line
&lt;/h2&gt;

&lt;p&gt;Anvil makes a specific technical bet: for certain types of applications, the productivity gains from using a unified language outweigh the performance overhead and ecosystem constraints of client-side Python.&lt;/p&gt;

&lt;p&gt;This isn’t about replacing React or Vue. It’s about offering an alternative path for Python developers who view web UIs as a necessary interface layer rather than the core of what they’re building. When your value is in data processing, business logic, or machine learning models, Anvil lets you wrap those capabilities in a web interface without learning an entirely new stack.&lt;/p&gt;

&lt;p&gt;The platform is part of a broader trend of Python expanding beyond its traditional backend role.&lt;/p&gt;

&lt;p&gt;Is this the future of web development? Probably not. But for specific use cases (particularly in data science, internal tooling, and rapid prototyping) it’s a genuinely productive alternative that more Python developers should know about.&lt;/p&gt;

&lt;p&gt;This article may not be perfect and I would appreciate any feedback!&lt;/p&gt;

&lt;p&gt;Buy me a coffee:&amp;nbsp;&lt;a href="https://buymeacoffee.com/daisyauma" rel="noopener noreferrer"&gt;https://buymeacoffee.com/daisyauma&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>architecture</category>
      <category>webdev</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
