<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Nonprofit Web Builder]]></title><description><![CDATA[Nonprofit Web Builder]]></description><link>https://nonprofitwebbuilder.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 12:31:02 GMT</lastBuildDate><atom:link href="https://nonprofitwebbuilder.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How I Built a 50-State Cottage Food Label Maker & FDA Rounding Engine on Cloudflare Workers + D1 FTS5]]></title><description><![CDATA[Home bakers and micro food brands in the US live in an awkward tooling gap: spreadsheets break as soon as packaging waste or pound-to-gram unit conversions…]]></description><link>https://nonprofitwebbuilder.hashnode.dev/50-state-cottage-food-label-maker-fda-rounding-cloudflare-workers</link><guid isPermaLink="true">https://nonprofitwebbuilder.hashnode.dev/50-state-cottage-food-label-maker-fda-rounding-cloudflare-workers</guid><category><![CDATA[cloudflare]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Weikang Zhang]]></dc:creator><pubDate>Tue, 24 Nov 2026 10:38:12 GMT</pubDate><content:encoded><![CDATA[<p>Home bakers and micro food brands in the US live in an awkward tooling gap: spreadsheets break as soon as packaging waste or pound-to-gram unit conversions get complicated, Word templates misalign on Avery 5163 sheets or 4x6 thermal rolls, and commercial nutrition label tools often charge $49–$99/month.</p>
<p>I built <strong><a href="https://cottagefoodtools.com">CottageFoodTools.com</a></strong> so a food maker can type one ingredient list once and get four print-ready outputs on the Cloudflare edge:</p>
<ol>
<li><strong><a href="https://cottagefoodtools.com/cottage-food-label-maker">50-State Cottage Food Label Maker</a></strong> (Avery 5163/5164/22806 &amp; 4x6/2x4/2x3 thermal PDFs at 72 pt/in)</li>
<li><strong><a href="https://cottagefoodtools.com/recipe-cost-calculator">Recipe Cost &amp; Profit Margin Calculator</a></strong> (wholesale bag conversions, trim waste %, labor, packaging &amp; reverse retail pricing)</li>
<li><strong><a href="https://cottagefoodtools.com/nutrition-label-generator">FDA 21 CFR 101.9 Nutrition Facts Generator</a></strong> (deterministic rounding + vector SVG/PDF)</li>
<li><strong><a href="https://cottagefoodtools.com/allergen-matrix-generator">US Top-9 &amp; UK/EU 14 Allergen Matrix &amp; QR Menu</a></strong></li>
</ol>
<p>While shipping it, I also open-sourced the structured 50-state rules CSV &amp; rounding spec under MIT:
-&gt; <strong><a href="https://github.com/buttercannfly/us-cottage-food-laws-50-states">us-cottage-food-laws-50-states on GitHub</a></strong></p>
<hr />
<h2>1. Deterministic FDA 21 CFR 101.9 Rounding (Pure TypeScript)</h2>
<p>Nutrition labels cannot just call <code>Math.round()</code>. Federal rules define banded rounding per nutrient so tiny floating-point drifts near <code>0.5g</code> or <code>50 kcal</code> render identically everywhere:</p>
<ul>
<li><strong>Calories</strong>: <code>&lt;= 5</code> -&gt; <code>0</code>; <code>&gt; 5 &amp;&amp; &lt;= 50</code> -&gt; nearest <code>5</code>; <code>&gt; 50</code> -&gt; nearest <code>10</code>.</li>
<li><strong>Total / Saturated / Trans Fat</strong>: <code>&lt; 0.5g</code> -&gt; <code>0g</code>; <code>&lt; 5g</code> -&gt; nearest <code>0.5g</code>; <code>&gt;= 5g</code> -&gt; nearest <code>1g</code>.</li>
<li><strong>Carbs, Fiber, Sugars, Protein</strong>: <code>&lt; 0.5g</code> -&gt; <code>0g</code>; <code>0.5g</code> to <code>&lt; 1g</code> -&gt; <code>&lt;1g</code>; <code>&gt;= 1g</code> -&gt; nearest <code>1g</code>.</li>
<li><strong>Micronutrients (%DV)</strong>: <code>&lt; 1%</code> -&gt; <code>0%</code>, <code>&lt;= 10%</code> -&gt; 2% increments, <code>&lt;= 50%</code> -&gt; 5% increments, <code>&gt; 50%</code> -&gt; 10% increments.</li>
</ul>
<p>We run these rules deterministically in TypeScript across baked batches after applying moisture evaporation percentages (shrinking baked serving weight while keeping dry macro totals exact) and cover every band with unit tests before exporting vector SVG or <code>pdf-lib</code> PDFs.</p>
<h2>2. Avoiding False-Positive Allergen Bugs &amp; Sorting Ingredients by Weight</h2>
<p>Every cottage food label requires ingredients sorted strictly <strong>in descending order by weight (grams)</strong> — converting cups, tablespoons, teaspoons, pounds, and ounces using ingredient-specific portion density weights before sorting.</p>
<p>Keyword-naive allergen detectors also trigger nasty false positives in bakeries:</p>
<ul>
<li><code>cocoa butter</code> and <code>cream of tartar</code> are <strong>not dairy (Milk)</strong></li>
<li><code>peanut butter</code> is peanuts, <strong>not dairy</strong></li>
<li><code>almond milk</code> is tree nuts, <strong>not dairy</strong></li>
</ul>
<p>Explicitly modeling ingredient exceptions alongside explicit USDA allergen tags keeps the bold <code>Contains:</code> line and downloadable US Top-9 / UK-EU 14 matrices trustworthy.</p>
<h2>3. Lean Edge Stack on Cloudflare Workers + D1 FTS5</h2>
<p>Rather than paying for runtime Node SSR containers, all <strong>68 tool, comparison, label-size, and 50-state pages</strong> are statically pre-rendered at build time with structured JSON-LD (<code>SoftwareApplication</code>, <code>BreadcrumbList</code>, <code>FAQPage</code>) and served by a single Hono Worker on Cloudflare.</p>
<ul>
<li><strong>Sub-10ms Ingredient Search (<code>D1 FTS5</code>)</strong>: Curated USDA FoodData Central staples indexed via <code>usda_foods_fts</code> return common baking staples first (<code>All-Purpose Flour</code> ahead of obscure fortified derivatives).</li>
<li><strong>Exact Print Geometry (<code>72 pt/in</code>)</strong>: The <code>pdf-lib</code> bundle (~435 KB) is code-split and loaded lazily only when a user clicks PDF export—keeping initial interactive page load fast.</li>
<li><strong>Zero-Friction Auth &amp; OAuth Draft Recovery</strong>: Anyone can test formulas with zero login. When users click <strong>Continue with Google</strong> (OAuth 2.0 + S256 PKCE) to save recipes, <code>sessionStorage</code> seamlessly preserves their unsaved ingredient draft across the external redirect.</li>
</ul>
<hr />
<p>If you are building vertical SaaS on Cloudflare Workers or need structured cottage food reference data, feel free to check out the <a href="https://github.com/buttercannfly/us-cottage-food-laws-50-states">MIT dataset repo</a> or test the <a href="https://cottagefoodtools.com">interactive workbench</a>.</p>
]]></content:encoded></item><item><title><![CDATA[How I Built an Edge-Rendered, WCAG 2.2 AA Nonprofit Website Builder on Cloudflare Workers (And Open-Sourced the Compliance Checklist)]]></title><description><![CDATA[Most 501(c)(3) organizations do not fail online because they lack a mission. They get stuck choosing between two frustrating extremes: While building…]]></description><link>https://nonprofitwebbuilder.hashnode.dev/edge-rendered-wcag-2-2-aa-nonprofit-website-builder-cloudflare-workers</link><guid isPermaLink="true">https://nonprofitwebbuilder.hashnode.dev/edge-rendered-wcag-2-2-aa-nonprofit-website-builder-cloudflare-workers</guid><category><![CDATA[Web Development]]></category><category><![CDATA[Accessibility]]></category><category><![CDATA[cloudflare]]></category><category><![CDATA[open source]]></category><dc:creator><![CDATA[Weikang Zhang]]></dc:creator><pubDate>Mon, 23 Nov 2026 01:29:18 GMT</pubDate><content:encoded><![CDATA[<p>Most 501(c)(3) organizations do not fail online because they lack a mission. They get stuck choosing between two frustrating extremes:</p>
<ol>
<li><strong>Bloated general-purpose builders</strong> whose annual renewals climb quickly, whose visual templates hide horizontal mobile overflow or keyboard traps, and whose third-party donation plugins prompt supporters for an unexpected <code>10%–17%</code> "platform tip" at checkout.</li>
<li><strong>Client-side SPAs paired with "accessibility overlay" scripts</strong> that ship an empty <code>&lt;div id="root"&gt;&lt;/div&gt;</code> to grant reviewers and crawlers, struggle with inconsistent heading hierarchies, and bolt on JavaScript accessibility toolbars that often interfere with screen readers rather than fixing underlying HTML semantics.</li>
</ol>
<p>While building <strong><a href="https://nonprofitwebbuilder.com">Nonprofit Web Builder</a></strong>, I wanted a stack small enough to run lean on <strong>Cloudflare Workers, D1, and R2</strong>, predictable enough to stay affordable (<code>$19/month</code> Essential or <code>$49/month</code> Plus, <code>$0</code> setup fee), and strict enough that WCAG 2.2 Level AA habits and safe IRS Form 990 hosting are built into the structure rather than bolted on later.</p>
<p>Alongside the platform, I just open-sourced our standalone <strong><a href="https://github.com/buttercannfly/nonprofit-website-wcag-checklist">501(c)(3) WCAG 2.2 AA, Form 990 &amp; Zero-Tip Giving Checklist</a></strong> under the MIT license so any volunteer board or nonprofit developer can copy the starter HTML shell and run the same pre-grant checks.</p>
<p>Here are the architectural decisions that mattered most.</p>
<hr />
<h2>1. Hybrid Vite React 19 SPA + Flat Static Pre-Rendering (22 Indexable Pages)</h2>
<p>A standard Vite React SPA is pleasant to maintain when the marketing site and authenticated portal builder share components, TypeScript contracts, and design tokens. The catch is that an unrendered SPA returns almost no visible HTML until JavaScript executes, which hurts SEO snippets, slow-network mobile visitors, and link previews shared in board emails.</p>
<p>Instead of spinning up a separate Node SSR server, our build pipeline adds a dedicated pre-render script (<code>scripts/prerender.mjs</code>) after Vite builds the client bundle. During <code>npm run build</code>:</p>
<ul>
<li>It renders <code>22</code> indexable public routes into static HTML (<code>index.html</code> plus flat <code>&lt;route&gt;.html</code> files matching Cloudflare static routing cleanly), covering core landing pages, template galleries, pricing, a free <a href="https://nonprofitwebbuilder.com/nonprofit-website-audit">Nonprofit Website Audit</a>, comparison guides like <a href="https://nonprofitwebbuilder.com/best-nonprofit-website-builder">How to Choose a Nonprofit Website Builder</a>, and deep technical/governance articles.</li>
<li>In the same pass, it emits <code>sitemap.xml</code>, <code>robots.txt</code>, and route-appropriate structured data (<code>SoftwareApplication</code>, <code>BreadcrumbList</code>, <code>FAQPage</code>, and <code>Article</code> JSON-LD) directly into <code>&lt;head&gt;</code>.</li>
</ul>
<p>This keeps runtime infrastructure minimal: public pages serve straight out of edge static HTML with immediate first paint and real <code>&lt;link rel="canonical"&gt;</code> tags, while still hydrating smoothly into the React application.</p>
<hr />
<h2>2. Guarding Private Tenant Shells &amp; Authenticated Pages with <code>HTMLRewriter</code></h2>
<p>Running both public marketing pages, customer sites, and private admin/member portals on one Cloudflare Worker creates a classic indexing risk: if a tenant preview shell, dashboard, or member login route leaks duplicate marketing metadata or gets crawled as an empty SPA shell, search engines index junk routes or waste crawl budget.</p>
<p>On Cloudflare Workers (<code>apps/api/src/app.ts</code>), public allowlisted routes serve their pre-rendered static HTML directly. For private routes and authenticated application shells, the Worker passes the static shell through <strong><code>HTMLRewriter</code></strong> to:</p>
<ol>
<li>Strip <code>#root</code> pre-rendered marketing markup so private routes never flash public landing copy before authentication resolves.</li>
<li>Inject <code>&lt;meta name="robots" content="noindex, nofollow"&gt;</code> dynamically at the edge so search engines never index workspace dashboards or private member login entry points.</li>
</ol>
<p>Tenant document separation follows the same principle. Nonprofits have two completely different classes of PDFs:</p>
<ul>
<li><strong>Public inspection governance files</strong> (IRS 501(c)(3) determination letters and public-inspection Form 990s with Schedule B contributor names/addresses redacted), which belong on a clean public transparency page.</li>
<li><strong>Private board packets</strong> (board minutes, internal budgets, personnel notes), which must stay behind authenticated member portal logins (supporting up to <code>5</code> admin seats and <code>500</code> portal member logins on Essential, with <code>1 GB</code> R2 storage on Essential or <code>5 GB</code> on Plus and <code>25 MB</code> max per file).</li>
</ul>
<p>We documented the exact public-vs-private split in our <strong><a href="https://nonprofitwebbuilder.com/guides/nonprofit-board-documents-and-990s">Board Documents &amp; Form 990 Guide</a></strong> and included a printable matrix in the GitHub repo.</p>
<hr />
<h2>3. Structural WCAG 2.2 AA Instead of JavaScript Overlays</h2>
<p>Every month, well-meaning nonprofits pay for third-party accessibility overlay widgets only to discover that overlays cannot invent missing <code>&lt;label&gt;</code> associations, fix illogical heading levels, make scanned image PDFs readable, or rescue keyboard traps inside mobile navigation drawers.</p>
<p>Instead of shipping any overlay script, accessibility is treated as baseline CSS and semantic HTML across marketing pages and generated sites (<code>apps/web/src/styles.css</code> and semantic page components):</p>
<ul>
<li><strong>First-Tab <code>.skip-link</code></strong>: Positioned cleanly off-canvas until keyboard focus moves to it, jumping straight to <code>&lt;main id="main-content"&gt;</code>.</li>
<li><strong>Unbroken Landmark Architecture</strong>: Exactly one <code>&lt;header&gt;</code>, semantic <code>&lt;nav&gt;</code>, <code>&lt;main id="main-content"&gt;</code>, and <code>&lt;footer&gt;</code>, avoiding clickable <code>&lt;div&gt;</code> handlers.</li>
<li><strong>Guaranteed <code>:focus-visible</code> Outlines</strong>: A <code>3px</code> high-contrast focus ring instead of ever using <code>outline: none</code> without replacement.</li>
<li><strong>Motion Safety</strong>: Explicit <code>@media (prefers-reduced-motion: reduce)</code> handling so smooth scrolling and UI transitions turn off cleanly when a visitor prefers reduced motion.</li>
<li><strong>Accessible Governance Tables</strong>: Form 990 and financial transparency lists use structured tables and descriptive link text rather than ambiguous <code>"click here"</code> links.</li>
</ul>
<p>To stop regressions from sneaking into landing pages or mobile viewports, <code>npm run smoke:public</code> runs headless Playwright checks across desktop (<code>1440px</code>) and mobile (<code>390px</code>) viewports on every deploy, asserting <strong>zero JavaScript runtime errors</strong> and <strong><code>document.documentElement.scrollWidth &lt;= document.documentElement.clientWidth + 1</code></strong> across public views.</p>
<p>If you want to drop the same structural pattern into an existing static site or custom WordPress/Eleventy theme, grab <a href="https://github.com/buttercannfly/nonprofit-website-wcag-checklist/blob/main/snippets/accessible-nonprofit-shell.html"><code>snippets/accessible-nonprofit-shell.html</code></a> from the checklist repository—it is pure HTML + CSS with zero dependencies. You can also benchmark your current site against our free <a href="https://nonprofitwebbuilder.com/guides/nonprofit-website-accessibility-wcag">WCAG 2.2 AA Accessibility Guide</a>.</p>
<hr />
<h2>4. Schema-Level Enforcement for Zero-Tip Direct Giving</h2>
<p>One hidden cost nonprofits run into with "free" fundraising embeds is optional donor tipping: checkout overlays pre-select an extra <code>10%–17%</code> platform tip, shrinking what supporters feel comfortable giving to the cause itself.</p>
<p>Rather than inserting an intermediary checkout screen that skims a percentage or asks donors for extra platform tips, donation CTAs in Nonprofit Web Builder are modeled directly inside our Zod configuration (<code>siteConfigSchema</code>). Every primary Donate button binds to a validated <code>https://</code> donation URL controlled by the nonprofit (such as their own Stripe Payment Link or PayPal Donate checkout), keeping platform commission on donations at <strong><code>0%</code></strong>.</p>
<hr />
<h2>Open-Source Checklist &amp; Next Steps</h2>
<p>If you maintain a website for a 501(c)(3) charity, rescue, food pantry, or volunteer board—or review nonprofit sites during grant cycles—here are the free resources you can use immediately:</p>
<ul>
<li><strong>MIT Checklist &amp; Semantic Starter Repo</strong>: <a href="https://github.com/buttercannfly/nonprofit-website-wcag-checklist">https://github.com/buttercannfly/nonprofit-website-wcag-checklist</a></li>
<li><strong>60-Second Self-Audit Tool</strong>: <a href="https://nonprofitwebbuilder.com/nonprofit-website-audit">https://nonprofitwebbuilder.com/nonprofit-website-audit</a></li>
<li><strong>Accessibility &amp; Governance Guides</strong>: <a href="https://nonprofitwebbuilder.com/guides/nonprofit-website-accessibility-wcag">WCAG 2.2 AA Guide</a> · <a href="https://nonprofitwebbuilder.com/guides/nonprofit-board-documents-and-990s">Board Documents &amp; Form 990 Guide</a></li>
</ul>
<p>If you spot an edge case in the WCAG 2.2 keyboard protocol or Form 990 redaction checklist, PRs on the GitHub repo are welcome.</p>
]]></content:encoded></item></channel></rss>