<?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[akashtechblogs]]></title><description><![CDATA[Level up your coding skills with practical tutorials on backend scaling, frontend design, and open-source developer tools. Read latest from Akash Pal.]]></description><link>https://blogs.akashpal.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/650b1c393a5cf3acda17f846/2c9cc8ac-56bc-42f2-bc79-add9bd4e6ef7.jpg</url><title>akashtechblogs</title><link>https://blogs.akashpal.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 10:25:51 GMT</lastBuildDate><atom:link href="https://blogs.akashpal.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Preparing Our Docs for AI Agents: How and Why We Implemented llms.txt in Astro]]></title><description><![CDATA[Html2Pdf is officially live in production: If you have used AI coding assistants like Cursor, Claude Code, GitHub Copilot, or Antigravity recently, you…]]></description><link>https://blogs.akashpal.dev/preparing-our-docs-for-ai-agents-how-and-why-we-implemented-llms-txt-in-astro</link><guid isPermaLink="true">https://blogs.akashpal.dev/preparing-our-docs-for-ai-agents-how-and-why-we-implemented-llms-txt-in-astro</guid><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Mon, 09 Nov 2026 13:20:36 GMT</pubDate><content:encoded><![CDATA[<p><strong>Html2Pdf</strong> is officially live in production:</p>
<ul>
<li><strong>Live Web App &amp; Interactive Demo</strong>: <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app</a></li>
<li><strong>Official TypeScript / ESM SDK</strong>: <a href="https://www.npmjs.com/package/@akcraft/html2pdf-sdk">@akcraft/html2pdf-sdk</a></li>
<li><strong>Live Web API</strong>: <a href="https://api.html2pdf.akcraft.app/">api.html2pdf.akcraft.app</a></li>
</ul>
<p>If you have used AI coding assistants like <strong>Cursor</strong>, <strong>Claude Code</strong>, <strong>GitHub Copilot</strong>, or <strong>Antigravity</strong> recently, you have likely noticed a recurring frustration: when an agent tries to read a documentation website, it often struggles.</p>
<p>It might crawl an entire webpage, choke on thousands of lines of client-side React hydration boilerplate, get confused by cookie consent banners and responsive sidebar markup, and then proceed to hallucinate function names, parameters, or types that don't exist in your SDK.</p>
<p>In our project—<a href="https://html2pdf.akcraft.app/"><strong>html2pdf</strong></a>, a developer API and TypeScript SDK for converting HTML and CSS to pixel-perfect PDFs with native Indian language support—we decided to fix this.</p>
<p>We recently adopted the emerging <a href="https://llmstxt.org"><code>llms.txt</code> <strong>standard</strong></a> across our Astro documentation site.</p>
<p>Here is why web documentation is broken for AI models, how the <code>llms.txt</code> specification solves it, and how we implemented both <code>llms.txt</code> and <code>llms-full.txt</code> in our Astro SSR pipeline to give AI agents instant, zero-hallucination context.</p>
<hr />
<h2>1. The Problem: The "Documentation Tax" on AI Agents</h2>
<p>Documentation websites are built for humans, not Large Language Models.</p>
<p>Consider what happens when a developer asks Cursor or Claude:</p>
<blockquote>
<p><em>"Write a TypeScript script that uses the</em> <code>@akcraft/html2pdf-sdk</code> <em>to generate a landscape A4 invoice with 15mm margins."</em></p>
</blockquote>
<p>If the AI tries to fetch <code>https://html2pdf.akcraft.app</code> to learn how our SDK works, the server responds with a full HTML document:</p>
<pre><code class="language-html">&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;script type="module" src="/_astro/hoisted.B_x9Z1.js"&gt;&lt;/script&gt;
    &lt;style&gt;/* 25 KB of minified utility CSS */&lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;header class="sticky top-0 z-50 backdrop-blur border-b border-slate-200"&gt;
      &lt;nav aria-label="Main Navigation"&gt;
        &lt;!-- 150 lines of desktop and mobile navigation links --&gt;
      &lt;/nav&gt;
    &lt;/header&gt;
    &lt;main&gt;
      &lt;!-- Interactive React Islands, SVG icons, marketing copy --&gt;
    &lt;/main&gt;
    &lt;footer&gt;
      &lt;!-- 200 lines of social links, legal disclaimers, and copyright --&gt;
    &lt;/footer&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<h3>Why this degrades AI output:</h3>
<ol>
<li><strong>Context Window Waste</strong>: Modern LLMs have generous context windows, but processing 15,000 tokens of raw HTML, SVG paths, and CSS class names is an inefficient waste of attention and cost.</li>
<li><strong>Attention Dilution</strong>: Crucial SDK parameter types (<code>format: PaperFormat.A4</code>, <code>orientation: PdfOrientation.LANDSCAPE</code>) get buried under navigation links, cookie disclosures, and marketing slogans.</li>
<li><strong>Hallucination Risk</strong>: When models can't parse messy DOM trees reliably, they guess. You end up with generated code importing non-existent packages like <code>html2pdf-client</code> or passing invalid options like <code>{ pageSize: 'A4' }</code>.</li>
</ol>
<p>We need a dedicated, machine-friendly format: <strong>documentation stripped down to pure, structured markdown.</strong></p>
<hr />
<h2>2. The Standard: What is <code>llms.txt</code>?</h2>
<p>Proposed by Jeremy Howard (<a href="http://Answer.ai">Answer.ai</a>) and gaining rapid adoption across projects like FastHTML, Anthropic docs, and Mintlify, <a href="https://llmstxt.org"><strong>llmstxt.org</strong></a> proposes a simple convention:</p>
<blockquote>
<p>Place an <code>/llms.txt</code> file at the root of your domain to serve as a curated, machine-readable index of your documentation for LLMs.</p>
</blockquote>
<p>Similar to how <code>robots.txt</code> tells web scrapers what to index, <code>llms.txt</code> tells AI agents where your authoritative technical knowledge lives.</p>
<h3>Anatomy of an <code>llms.txt</code> File</h3>
<p>The specification requires clean, strict Markdown:</p>
<ol>
<li><strong>Single H1 Title</strong>: The name of the project or API.</li>
<li><strong>Blockquote Summary</strong>: A 1–2 sentence high-level summary of capabilities.</li>
<li><strong>Preamble</strong>: Short contextual guidance.</li>
<li><strong>H2 Section Headers</strong>: Curated Markdown lists containing URLs and concise descriptions.</li>
<li><strong>Optional Section (</strong><code>## Optional</code><strong>)</strong>: Secondary or non-critical resources (e.g., login portals, dashboards, license terms) that agents can skip when context window space is constrained.</li>
</ol>
<p>Alongside <code>llms.txt</code>, the standard encourages a companion file: <code>llms-full.txt</code>. While <code>llms.txt</code> is an index of links, <code>llms-full.txt</code> is a single, complete, copy-pasteable document containing all core API schemas, parameters, and examples.</p>
<hr />
<h2>3. How We Designed Our Files in <code>html2pdf</code></h2>
<p>We created both <code>llms.txt</code> and <code>llms-full.txt</code> tailored to our developer workflow.</p>
<h3>1. <code>website/public/llms.txt</code> (The Index)</h3>
<p>Here is our live <code>llms.txt</code>:</p>
<pre><code class="language-markdown"># Html2Pdf
&gt; High-performance developer API and TypeScript SDK for converting HTML and CSS to pixel-perfect PDF documents with native Indian language typography.

Html2Pdf provides a headless Chromium-based rendering engine built on Fastify, with bundled Noto font shapers for 21 Indian languages across 12 scripts, per-user rate limiting, S3-compatible cloud storage, and signed URL generation.

## Documentation
- [TypeScript SDK Reference](https://www.npmjs.com/package/@akcraft/html2pdf-sdk): Official @akcraft/html2pdf-sdk TypeScript client, methods, and types.
- [API OpenAPI / Swagger](https://html2pdf.akcraft.app/swagger): Fastify OpenAPI specification and interactive Swagger UI.
- [Full Documentation](https://html2pdf.akcraft.app/llms-full.txt): Comprehensive single-file reference for LLMs, including schemas, code samples, and Indic language matrix.

## Core Features
- [Interactive Studio Demo](https://html2pdf.akcraft.app/#studio): Browser studio for testing HTML payloads, presets (invoice, report, Indic text), and print options.
- [Indic Language Typography](https://html2pdf.akcraft.app/#languages): Zero-configuration rendering for Devanagari, Bengali, Tamil, Telugu, Gujarati, Gurmukhi, Kannada, Malayalam, Odia, Urdu, Ol Chiki, and Meetei Mayek.
- [Architecture Pipeline](https://html2pdf.akcraft.app/#architecture): 4-step rendering pipeline: Key Auth -&gt; Sandboxed Chromium -&gt; S3 Storage -&gt; Expiring Presigned URL.

## Optional
- [Dashboard](https://html2pdf.akcraft.app/dashboard): Manage API keys, monitor monthly conversion quotas, and download generated PDFs.
- [Sign In](https://html2pdf.akcraft.app/login): Authenticate via email/password or Google OAuth.
- [npm Package](https://www.npmjs.com/package/@akcraft/html2pdf-sdk): Client package on npm.
</code></pre>
<h3>2. <code>website/public/llms-full.txt</code> (The Master Knowledge Base)</h3>
<p>When an agent needs complete implementation details, it points to <code>llms-full.txt</code>. We packed our entire technical interface into a compact 300-line Markdown file:</p>
<ul>
<li><p><strong>Full SDK Usage</strong>: Real TypeScript snippets showing imports, initialization with <code>apiKey</code>, and calling <code>sendHtmlRequest()</code>.</p>
</li>
<li><p><strong>Exact Enums &amp; Types</strong>:</p>
<pre><code class="language-typescript">export enum PaperFormat {
  Letter = 'Letter',
  Legal = 'Legal',
  Tabloid = 'Tabloid',
  Ledger = 'Ledger',
  A0 = 'A0',
  // ... A1 through A6
}

export enum PdfOrientation {
  PORTRAIT = 'portrait',
  LANDSCAPE = 'landscape',
}
</code></pre>
</li>
<li><p><strong>Fastify TypeBox Schema</strong>: Complete request payload shapes (<code>userId</code>, <code>content</code>, <code>options</code>, <code>margin</code>, <code>printBackground</code>, <code>headerTemplate</code>, <code>footerTemplate</code>).</p>
</li>
<li><p><strong>cURL HTTP Examples</strong>: Direct REST calls sending the <code>x-api-key</code> header and parsing <code>pdfUrl</code>.</p>
</li>
<li><p><strong>Status &amp; Error Handling</strong>: The <code>Html2PdfError</code> class structure (<code>statusCode</code>, <code>retryAfter</code>, <code>apiError</code>) and HTTP 429 rate limit behaviors.</p>
</li>
<li><p><strong>The Indic Font Matrix</strong>: Supported font families (<code>Noto Sans Devanagari</code>, <code>Noto Serif Bengali</code>, etc.) and CSS snippet patterns.</p>
</li>
</ul>
<hr />
<h2>4. Implementation in Astro SSR</h2>
<p>Our website is built with <strong>Astro 7 SSR</strong> running on the Netlify adapter (<code>@astrojs/netlify</code>).</p>
<p>When adding static machine-readable files to an Astro SSR application, you want to avoid unnecessary server-side rendering overhead.</p>
<h3>Static Placement via <code>public/</code></h3>
<p>By placing both files inside the <code>website/public/</code> directory:</p>
<pre><code class="language-plaintext">website/
├── public/
│   ├── llms.txt            &lt;-- Served at /llms.txt
│   ├── llms-full.txt       &lt;-- Served at /llms-full.txt
│   ├── robots.txt
│   └── favicon.svg
├── src/
│   ├── pages/
│   └── layouts/
└── astro.config.mjs
</code></pre>
<p>During <code>npm run build</code>, Astro automatically copies files in <code>public/</code> directly to <code>dist/client/</code>.</p>
<h3>Key Advantages of This Approach:</h3>
<ol>
<li><strong>Zero Lambda / Serverless Invocations</strong>: Netlify's edge CDN serves <code>/llms.txt</code> and <code>/llms-full.txt</code> directly from the static edge cache without waking up a Node.js SSR function.</li>
<li><strong>Correct Content-Type</strong>: Served cleanly with <code>Content-Type: text/plain; charset=utf-8</code> or <code>text/markdown</code>, preventing browsers or scrapers from expecting HTML tags.</li>
<li><strong>Hermetic &amp; Git-Tracked</strong>: The documentation is version-controlled alongside our code. Whenever an engineer updates an API schema or SDK option, <code>llms-full.txt</code> is updated in the exact same Git commit.</li>
</ol>
<p>We verified our build and test suite:</p>
<pre><code class="language-bash">cd website
npm run build
# Astro outputs:
# dist/client/llms.txt
# dist/client/llms-full.txt
# All 52 website unit tests green.
</code></pre>
<hr />
<h2>5. The Real-World Impact: Testing with AI Agents</h2>
<p>To see the difference, we tested an AI coding assistant (Cursor / Claude 3.5 Sonnet) on a prompt:</p>
<blockquote>
<p><em>"Write a Node.js script using @akcraft/html2pdf-sdk that sets up custom 20mm margins, prints backgrounds, and handles rate limiting."</em></p>
</blockquote>
<h3>Before <code>llms.txt</code> (Crawling the raw homepage):</h3>
<ul>
<li>The model imported <code>Html2Pdf</code> instead of <code>Html2PdfClient</code>.</li>
<li>It passed <code>{ margins: { top: 20 } }</code> (numbers instead of strings with units like <code>'20mm'</code>).</li>
<li>It completely fabricated a non-existent method <code>client.convert()</code>.</li>
</ul>
<h3>After <code>llms.txt</code> (Passing <code>@https://html2pdf.akcraft.app/llms.txt</code>):</h3>
<ul>
<li><p><strong>100% Type-Safe</strong>: Imported <code>Html2PdfClient</code>, <code>PaperFormat</code>, and <code>PdfOrientation</code>.</p>
</li>
<li><p><strong>Accurate Margins</strong>:</p>
<pre><code class="language-typescript">options: {
  format: PaperFormat.A4,
  orientation: PdfOrientation.PORTRAIT,
  printBackground: true,
  margin: {
    top: '20mm',
    bottom: '20mm',
    left: '20mm',
    right: '20mm',
  },
}
</code></pre>
</li>
<li><p><strong>Error Handling</strong>: Correctly caught <code>Html2PdfError</code> and checked <code>err.statusCode === 429</code> with <code>err.retryAfter</code>.</p>
</li>
</ul>
<p>Zero guesswork. Zero hallucinations.</p>
<hr />
<h2>6. Checklist: How to Add <code>llms.txt</code> to Your Project</h2>
<p>If you maintain an open-source library, a SaaS API, or a developer documentation site, adding <code>llms.txt</code> takes less than an hour:</p>
<ol>
<li><input disabled type="checkbox" /> <strong>Create</strong> <code>public/llms.txt</code>:<ul>
<li>Add your H1 and blockquote description.</li>
<li>Link directly to your primary developer guides and OpenAPI specs.</li>
<li>Include an <code>## Optional</code> section for secondary pages.</li>
</ul>
</li>
<li><input disabled type="checkbox" /> <strong>Create</strong> <code>public/llms-full.txt</code>:<ul>
<li>Provide a complete, self-contained Markdown reference of all types, endpoints, schemas, and common recipes.</li>
</ul>
</li>
<li><input disabled type="checkbox" /> <strong>Keep It in Sync</strong>:<ul>
<li>Treat your <code>llms.txt</code> as a first-class citizen in CI/CD. When updating your TypeScript types or endpoints, update your LLM documentation in the same PR.</li>
</ul>
</li>
<li><input disabled type="checkbox" /> <strong>Link it in Your Footer</strong>:<ul>
<li>Add a subtle <code>/llms.txt</code> link in your website footer so both human developers and agents can discover it.</li>
</ul>
</li>
</ol>
<hr />
<h2>Summary</h2>
<p>The web is evolving. While human developers appreciate beautiful landing pages, interactive sandboxes, and modern typography, AI coding agents need concise, unambiguous, and token-efficient truth.</p>
<p>By implementing the <code>llms.txt</code> specification, we made <a href="https://html2pdf.akcraft.app"><strong>html2pdf</strong></a> AI-native. Any developer using an AI assistant can now integrate our PDF microservice in seconds without fighting outdated training data or hallucinated APIs.</p>
<p>You can inspect our live files anytime:</p>
<ul>
<li>Index: <a href="https://html2pdf.akcraft.app/llms.txt">https://html2pdf.akcraft.app/llms.txt</a></li>
<li>Full Reference: <a href="https://html2pdf.akcraft.app/llms-full.txt">https://html2pdf.akcraft.app/llms-full.txt</a></li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Taming Zombie Chromium in Docker: Why We Added Tini as PID 1]]></title><description><![CDATA[Html2Pdf is officially live in production: If you have ever run headless Chromium, Puppeteer, or Playwright inside a Docker container in production, you…]]></description><link>https://blogs.akashpal.dev/taming-zombie-chromium-in-docker-why-we-added-tini-as-pid-1</link><guid isPermaLink="true">https://blogs.akashpal.dev/taming-zombie-chromium-in-docker-why-we-added-tini-as-pid-1</guid><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Sun, 01 Nov 2026 14:59:38 GMT</pubDate><content:encoded><![CDATA[<p><strong>Html2Pdf</strong> is officially live in production:</p>
<ul>
<li><strong>Live Web App &amp; Interactive Demo</strong>: <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app</a></li>
<li><strong>Official TypeScript / ESM SDK</strong>: <a href="https://www.npmjs.com/package/@akcraft/html2pdf-sdk">@akcraft/html2pdf-sdk</a></li>
<li><strong>Live Web API</strong>: <a href="https://api.html2pdf.akcraft.app/">api.html2pdf.akcraft.app</a></li>
</ul>
<p>If you have ever run headless Chromium, Puppeteer, or Playwright inside a Docker container in production, you might have run into a quiet, insidious issue: <strong>zombie processes piling up in your process table</strong>, container shutdowns that hang for 10 seconds before being brutally killed by <code>SIGKILL</code>, or random container crashes under high traffic.</p>
<p>In our project—<a href="https://html2pdf.akcraft.app/"><strong>html2pdf</strong></a>, a high-performance HTML-to-PDF microservice built with Fastify, Puppeteer, and Node 22—we recently ran into this exact challenge.</p>
<p>Here is the story of how zombie processes were sneaking into our containers, the hidden quirks of Linux's PID 1, and how adding <code>tini</code> in a two-line Dockerfile change fixed the problem for good.</p>
<hr />
<h2>1. The Context: Headless Chromium in Production</h2>
<p>Our backend service (<code>api/</code>) accepts HTML payloads, renders pixel-perfect documents using headless Chromium, uploads the resulting PDFs to cloud storage, and returns presigned URLs.</p>
<p>Under the hood, every PDF generation delegates to Puppeteer:</p>
<pre><code class="language-typescript">// api/helpers/pdfHelper.ts
export async function saveHtmlToPdf(htmlString: string, jobId: string, options: PdfOptions = {}) {
    const browser = await puppeteer.launch({
        headless: true,
        args: [
            '--no-sandbox',
            '--disable-setuid-sandbox',
            // ...
        ],
    });
    const page = await browser.newPage();
    await page.setContent(htmlString, { waitUntil: 'load' });
    const pdfBuffer = await page.pdf({ /* format, margins, headers */ });
    await browser.close();
    // ... upload and return
}
</code></pre>
<p>This works smoothly on local machines. But inside a Linux container, headless Chromium is not just a single process. It is a multi-process architecture consisting of:</p>
<ul>
<li><strong>The Browser parent process</strong></li>
<li><strong>The Zygote process</strong> (which forks new renderer processes)</li>
<li><strong>Renderer processes</strong> (one per tab or isolated context)</li>
<li><strong>The GPU process</strong></li>
<li><strong>Utility / Network / Crash-reporter subprocesses</strong></li>
</ul>
<p>When you run hundreds or thousands of PDF conversions per hour, dozens of these child processes are spawned, executed, and closed continuously.</p>
<p>And that is where container physics starts to work against you.</p>
<hr />
<h2>2. The Problem: The Zombie Process Apocalypse</h2>
<p>When a Linux process finishes executing, it doesn't immediately vanish from the system. It enters a state called <code>TASK_DEAD</code> or <code>ZOMBIE</code> (<code>[defunct]</code> in <code>ps</code> output). The operating system keeps an entry in the process table holding its PID, exit code, and resource statistics so that its parent can read it using the <code>wait()</code> or <code>waitpid()</code> system calls.</p>
<p>Once the parent reads the exit status, the zombie is cleared (<strong>"reaped"</strong>).</p>
<pre><code class="language-plaintext">[Parent Process]
     │
     ├─ forks ──► [Child Subprocess]
     │                    │
     │                 executes
     │                    │
     │                 terminates
     │                    ▼
     │            [ZOMBIE / DEFUNCT]
     │                    │
     ├─ waitpid() ────────┘ (Reaped &amp; Removed)
     ▼
</code></pre>
<h3>What happens when the parent dies or crashes?</h3>
<p>If a parent process terminates before its children, those children become <strong>orphans</strong>. In a standard Linux operating system, orphaned processes are immediately reparented to the ancestor process: <strong>PID 1</strong> (traditionally <code>init</code> or <code>systemd</code>).</p>
<p>PID 1 has a fundamental operating system contract:</p>
<ol>
<li><strong>Adopt all orphaned processes.</strong></li>
<li><strong>Constantly call</strong> <code>waitpid(-1, ...)</code> <strong>upon receiving</strong> <code>SIGCHLD</code> <strong>to reap zombies.</strong></li>
</ol>
<h3>The Docker Catch: Node.js as PID 1</h3>
<p>In a typical Docker container:</p>
<pre><code class="language-dockerfile">CMD ["node", "index.js"]
</code></pre>
<p>Because <code>node</code> is the first process launched in the container, <strong>Node.js runs as PID 1</strong>.</p>
<pre><code class="language-plaintext">Container PID Namespace
└─ PID 1: node index.js
    └─ PID 14: chromium (browser)
        └─ PID 18: chromium (renderer)
        └─ PID 22: chromium (crash-reporter)
</code></pre>
<p>Here lies the architectural friction:</p>
<ul>
<li><strong>Node.js is an application runtime, not an OS init system.</strong> Node does not listen for <code>SIGCHLD</code> signals from arbitrary orphaned processes, nor does it run a reaping loop.</li>
<li>When Chromium renderers crash, timeout, or get detached, they are reparented to PID 1 (Node).</li>
<li>Node ignores them. The defunct process table entries stay in memory forever.</li>
</ul>
<p>Over time, running <code>ps aux</code> inside the container reveals an ever-growing graveyard:</p>
<pre><code class="language-bash">appuser   14  0.0  0.0      0     0 ?   Z    14:20   0:00 [chromium] &lt;defunct&gt;
appuser   22  0.0  0.0      0     0 ?   Z    14:21   0:00 [chromium] &lt;defunct&gt;
appuser   47  0.0  0.0      0     0 ?   Z    14:23   0:00 [chromium] &lt;defunct&gt;
</code></pre>
<p>Eventually, the container exhausts the kernel's process ID limit (<code>kernel.pid_max</code> or container cgroup <code>pids.max</code>), throwing:</p>
<pre><code class="language-plaintext">Error: spawn ENOMEM / EAGAIN: Resource temporarily unavailable
</code></pre>
<h3>The Second Catch: Broken Signal Handling (<code>SIGTERM</code>)</h3>
<p>Linux gives PID 1 special status regarding signals: <strong>the kernel does not register default signal handlers for PID 1</strong>.</p>
<p>If PID 1 has not explicitly registered a handler for <code>SIGTERM</code> or <code>SIGINT</code>, the kernel will <strong>silently discard</strong> the signal.</p>
<p>When deploying a new version to Render, Kubernetes, or Docker:</p>
<ol>
<li>Docker sends <code>SIGTERM</code> to PID 1.</li>
<li>If Node or the shell doesn't cleanly handle and propagate it to all children, the container ignores it.</li>
<li>Docker waits for a graceful stop timeout (typically 10 seconds).</li>
<li>Docker gives up and sends <code>SIGKILL</code> (exit 137).</li>
<li>In-flight PDF renders are violently severed mid-write, resulting in corrupted files and interrupted HTTP requests.</li>
</ol>
<hr />
<h2>3. The Solution: Enter <code>tini</code></h2>
<p>To solve both zombie process accumulation and signal propagation, you need an init process acting as PID 1.</p>
<p>While full init systems like <code>systemd</code> or <code>upstart</code> are bloated and inappropriate for minimal Docker images, <code>tini</code> (<a href="https://github.com/krallin/tini">krallin/tini</a>) was designed specifically for containers:</p>
<ul>
<li><strong>Tiny binary footprint:</strong> ~20 KB.</li>
<li><strong>Single purpose:</strong> Registers as PID 1, spawns your target command as its child, forwards all incoming signals (<code>SIGTERM</code>, <code>SIGINT</code>, etc.) to the child process and process group, and reliably reaps any adopted zombie children.</li>
</ul>
<pre><code class="language-plaintext">Container PID Namespace with tini
└─ PID 1: tini --
    └─ PID 7: node index.js
        └─ PID 15: chromium
</code></pre>
<h3>Why not just use <code>docker run --init</code>?</h3>
<p>Docker supports an <code>--init</code> flag which injects a built-in <code>tini</code> binary into the container. However:</p>
<ul>
<li>Managed PaaS environments (like <strong>Render</strong>, Google Cloud Run, AWS ECS Fargate, or custom Kubernetes clusters) do not always allow you to pass arbitrary flags like <code>--init</code> to the Docker engine.</li>
<li>Packaging <code>tini</code> directly inside your <code>Dockerfile</code> guarantees that <strong>the container is self-contained and behaves consistently everywhere</strong>—on a developer's laptop, in CI pipelines, and across any production host.</li>
</ul>
<hr />
<h2>4. How We Implemented Tini in <code>html2pdf</code></h2>
<p>Implementing <code>tini</code> in our production <code>api/Dockerfile</code> took just a few modifications.</p>
<h3>Step 1: Install <code>tini</code> in the Runtime Stage</h3>
<p>Our production image uses a multi-stage build: <code>node:22-alpine</code> for compiling TypeScript, and <code>node:22-slim</code> (Debian) for runtime dependencies (Chromium, C++ graphics libraries, fontconfig).</p>
<p>We added <code>tini</code> to the <code>apt-get</code> installation list:</p>
<pre><code class="language-dockerfile"># api/Dockerfile (Runtime Stage)
FROM node:22-slim

RUN apt-get update &amp;&amp; apt-get install -y --no-install-recommends \
      tini \
      chromium \
      chromium-sandbox \
      fonts-liberation \
      # ... other shared libraries
    &amp;&amp; rm -rf /var/lib/apt/lists/*
</code></pre>
<h3>Step 2: Configure <code>ENTRYPOINT</code> and <code>CMD</code></h3>
<p>Next, we configured <code>tini</code> as the container <code>ENTRYPOINT</code>, passing <code>--</code> to denote the end of <code>tini</code> options, followed by the normal <code>CMD</code>:</p>
<pre><code class="language-dockerfile"># tini acts as PID 1 to reap zombie Chromium sub-processes and forward signals cleanly.
ENTRYPOINT ["/usr/bin/tini", "--"]

CMD ["node", "index.js"]
</code></pre>
<p>Because <code>ENTRYPOINT</code> and <code>CMD</code> are combined in Docker's exec format, the container executes:</p>
<pre><code class="language-bash">/usr/bin/tini -- node index.js
</code></pre>
<p><code>tini</code> launches as PID 1, spawns <code>node index.js</code> as its immediate child, and sits quietly in the background.</p>
<hr />
<h2>5. What We Are Optimizing: The Impact</h2>
<table>
<thead>
<tr>
<th>Problem Area</th>
<th>Before <code>tini</code> (Node as PID 1)</th>
<th>After <code>tini</code> (<code>tini</code> as PID 1)</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Zombie Sub-processes</strong></td>
<td>Crashed/exited Chromium helpers persisted as <code>&lt;defunct&gt;</code> entries.</td>
<td>Instantly reaped on <code>SIGCHLD</code>. Zero zombie buildup.</td>
</tr>
<tr>
<td><strong>PID Resource Leaks</strong></td>
<td>Long-running containers under high load risked kernel PID exhaustion (<code>EAGAIN</code>).</td>
<td>Clean process table even after 100,000+ conversions.</td>
</tr>
<tr>
<td><strong>Container Shutdowns</strong></td>
<td>Ignored <code>SIGTERM</code>, hanging until Docker forced <code>SIGKILL</code> after 10s.</td>
<td><code>SIGTERM</code> forwarded instantly to Fastify and Chromium. Clean, graceful exit in &lt;1 second.</td>
</tr>
<tr>
<td><strong>Deployment Reliability</strong></td>
<td>Active conversions risk corruption on sudden SIGKILL during redeploy.</td>
<td>Inflight jobs get time to finish or gracefully abort.</td>
</tr>
<tr>
<td><strong>Image &amp; CPU Overhead</strong></td>
<td>N/A</td>
<td><strong>+23 KB</strong> to the image size; <strong>0.0%</strong> CPU overhead.</td>
</tr>
</tbody></table>
<hr />
<h2>6. Takeaways for Containerized Node &amp; Browser Workloads</h2>
<p>If your container does any of the following:</p>
<ol>
<li>Spawns child processes (<code>child_process.fork</code>, <code>child_process.spawn</code>, <code>execFile</code>).</li>
<li>Runs headless browsers (<strong>Puppeteer</strong>, <strong>Playwright</strong>, <strong>Selenium</strong>).</li>
<li>Executes CLI tools dynamically (ffmpeg, ImageMagick, pandoc).</li>
</ol>
<p><strong>Do not let Node.js or Bash be your PID 1 without an init helper.</strong></p>
<p>Using <code>tini</code> is a minimal, low-risk, high-return infrastructure upgrade:</p>
<ul>
<li>Two lines in your <code>Dockerfile</code>.</li>
<li>Bulletproof process lifecycle.</li>
<li>Zero surprises in production.</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How I Solved the Indic Font “Tofu” Problem in Dockerized Headless Chromium]]></title><description><![CDATA[Bundling fonts for 21 Indian languages across 12 scripts with Fastify 5 and Puppeteer Html2Pdf is officially live in production: In my previous post, I…]]></description><link>https://blogs.akashpal.dev/how-i-solved-the-indic-font-tofu-problem-in-dockerized-headless-chromium</link><guid isPermaLink="true">https://blogs.akashpal.dev/how-i-solved-the-indic-font-tofu-problem-in-dockerized-headless-chromium</guid><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Sun, 25 Oct 2026 15:46:53 GMT</pubDate><content:encoded><![CDATA[<p><em>Bundling fonts for 21 Indian languages across 12 scripts with Fastify 5 and Puppeteer</em></p>
<p><strong>Html2Pdf</strong> is officially live in production:</p>
<ul>
<li><strong>Live Web App &amp; Interactive Demo</strong>: <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app</a></li>
<li><strong>Official TypeScript / ESM SDK</strong>: <a href="https://www.npmjs.com/package/@akcraft/html2pdf-sdk">@akcraft/html2pdf-sdk</a></li>
<li><strong>Live Web API</strong>: <a href="https://api.html2pdf.akcraft.app/">api.html2pdf.akcraft.app</a></li>
</ul>
<p>In my <a href="https://blogs.akashpal.dev/from-sample-sdk-to-production-launching-html2pdf-for-21-indian-languages">previous post</a>, I introduced Html2Pdf and mentioned one problem I wanted to cover in detail: Indian language text turning into empty square boxes in generated PDFs.</p>
<p>That symptom is often called <strong>tofu</strong>. The HTML can look correct in your editor and still come out wrong in a PDF generated inside a minimal Linux container. Here is how I fixed it in my Fastify 5 + Puppeteer service.</p>
<h2>Why the glyphs disappeared</h2>
<p>Headless Chromium can only render a character if it can find a usable font with that glyph. A developer laptop may already have fonts for Hindi, Tamil, Bengali, or Urdu. A slim Docker image usually does not.</p>
<p>When Chromium cannot find a glyph, it may show a replacement box. Complex scripts also need correct shaping: characters can combine, reorder, or change form based on context. So a reliable fix needs both suitable fonts and a browser environment that can discover and use them when it prints.</p>
<h2>The approach</h2>
<p>I bundled Noto font files with the API, configured Linux fontconfig to search that directory while keeping the system fonts, and passed the configuration into the Chromium process that Puppeteer launches.</p>
<p>The bundled font files cover these 12 scripts and 21 languages:</p>
<table>
<thead>
<tr>
<th>Script</th>
<th>Languages</th>
</tr>
</thead>
<tbody><tr>
<td>Devanagari</td>
<td>Hindi, Marathi, Nepali, Sanskrit</td>
</tr>
<tr>
<td>Bengali</td>
<td>Bengali, Assamese</td>
</tr>
<tr>
<td>Gurmukhi</td>
<td>Punjabi</td>
</tr>
<tr>
<td>Gujarati</td>
<td>Gujarati</td>
</tr>
<tr>
<td>Odia</td>
<td>Odia</td>
</tr>
<tr>
<td>Tamil</td>
<td>Tamil</td>
</tr>
<tr>
<td>Telugu</td>
<td>Telugu</td>
</tr>
<tr>
<td>Kannada</td>
<td>Kannada</td>
</tr>
<tr>
<td>Malayalam</td>
<td>Malayalam</td>
</tr>
<tr>
<td>Ol Chiki</td>
<td>Santali</td>
</tr>
<tr>
<td>Meetei Mayek</td>
<td>Manipuri</td>
</tr>
<tr>
<td>Nastaliq</td>
<td>Urdu</td>
</tr>
</tbody></table>
<p>Manipuri can also be written in Bengali script, which is why the language count and script count do not map one-to-one.</p>
<h2>1. Bundle the fonts with the application</h2>
<p>Keep the <code>.ttf</code> files in a directory that is part of the Docker build context. My API keeps its font files in <code>api/fonts/</code>, next to <code>fonts.conf</code> and the Noto font licence.</p>
<p>The important part is that the runtime image receives this directory too. Installing fonts only in a build stage does not help if that stage is discarded before the final image is assembled.</p>
<h2>2. Tell fontconfig where to look</h2>
<p>This is the <code>fonts.conf</code> used by the API:</p>
<pre><code class="language-xml">&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
&lt;fontconfig&gt;
  &lt;!-- Keep fonts provided by the operating system. --&gt;
  &lt;include ignore_missing="yes"&gt;/etc/fonts/fonts.conf&lt;/include&gt;

  &lt;!-- Also search the directory containing this config file. --&gt;
  &lt;dir prefix="relative"&gt;.&lt;/dir&gt;

  &lt;cachedir prefix="xdg"&gt;fontconfig&lt;/cachedir&gt;
&lt;/fontconfig&gt;
</code></pre>
<p>The relative font directory keeps the config portable inside the image. Adding the bundled directory supplements the system configuration instead of replacing it.</p>
<h2>3. Pass the config to Puppeteer’s Chromium process</h2>
<p><code>FONTCONFIG_FILE</code> needs to be present in the environment of the browser process. Setting it in a shell where Node runs is not enough if the Chromium process is launched with a different environment.</p>
<pre><code class="language-ts">import puppeteer from 'puppeteer';
import { fileURLToPath } from 'node:url';

const fontsConf = fileURLToPath(
  new URL('../fonts/fonts.conf', import.meta.url),
);

const browser = await puppeteer.launch({
  headless: true,
  env: {
    ...process.env,
    FONTCONFIG_FILE: fontsConf,
  },
  args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
</code></pre>
<p>The sandbox flags above are used by this service’s Docker setup, where the default container seccomp profile blocks Chromium’s setuid sandbox setup. Treat Chromium sandboxing as a deployment security decision: use the configuration appropriate for your container runtime rather than copying flags without understanding the environment.</p>
<h2>4. Wait for fonts before printing</h2>
<p>If submitted HTML uses web fonts, wait until the page reports that its fonts are ready before calling <code>page.pdf()</code>. Otherwise Chromium can capture the page before those fonts finish loading.</p>
<pre><code class="language-ts">await page.setContent(html, { waitUntil: 'load' });
await page.evaluate(() =&gt; document.fonts.ready);

const pdf = await page.pdf({
  format: 'A4',
  printBackground: true,
});
</code></pre>
<p>This wait complements the bundled-font setup: fontconfig makes local fonts available to Chromium, while <code>document.fonts.ready</code> helps avoid racing fonts referenced by the document.</p>
<h2>5. Build with the right Docker context</h2>
<p>Because the Dockerfile, package files, and <code>fonts/</code> directory all live under <code>api/</code>, build from that directory as the context:</p>
<pre><code class="language-bash">docker build -t html2pdf-api api/
</code></pre>
<p>The context matters. Docker can only copy files that are inside the chosen build context, and <code>.dockerignore</code> is applied relative to that context. In this repository, using the API directory keeps the build small and ensures the font assets are available to the Dockerfile.</p>
<p>The runtime stage needs Chromium and its shared libraries as well as the application files and bundled fonts. My image uses Debian’s Chromium package and copies the compiled app plus <code>fonts/</code> into the final stage.</p>
<h2>Verify the actual PDF</h2>
<p>I check the rendered PDF from the container, not only the browser preview on my development machine. A useful smoke-test document should include samples from every script you support, then you can inspect the resulting PDF visually for missing glyphs and broken shaping.</p>
<p>My API also includes a static sample PDF with one row per bundled script, which makes it easy to catch regressions when the font bundle or container changes.</p>
<h2>The result</h2>
<p>The production container now has the fonts it needs, Chromium knows where to find them, and PDF generation waits for document fonts before printing. Html2Pdf supports 21 Indian languages across 12 scripts without asking API users to install fonts in their own environments.</p>
<p>If you are seeing tofu in a container-generated PDF, check these three things first:</p>
<ol>
<li>Does the <strong>final runtime image</strong> contain a font with the needed glyphs?</li>
<li>Can Chromium’s fontconfig discover that font?</li>
<li>Are you generating the PDF only after fonts used by the page are ready?</li>
</ol>
<p>Next in the series: how I designed rate limits, storage cleanup, and API key handling for the production API.</p>
]]></content:encoded></item><item><title><![CDATA[From `@sample-sdk` to Production: Launching Html2Pdf for 21 Indian Languages]]></title><description><![CDATA[In my first post, I shared why I started building an HTML-to-PDF converter after hitting repeated PDF rendering headaches in my AI Question Generator…]]></description><link>https://blogs.akashpal.dev/from-sample-sdk-to-production-launching-html2pdf-for-21-indian-languages</link><guid isPermaLink="true">https://blogs.akashpal.dev/from-sample-sdk-to-production-launching-html2pdf-for-21-indian-languages</guid><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Tue, 20 Oct 2026 15:48:04 GMT</pubDate><content:encoded><![CDATA[<p>In my <a href="https://blogs.akashpal.dev/why-i-m-building-an-html-to-pdf-tool-that-works-in-every-language">first post</a>, I shared why I started building an HTML-to-PDF converter after hitting repeated PDF rendering headaches in my <strong>AI Question Generator</strong> project. Back then, the tool wasn't released yet—my code snippet still used a placeholder package called <code>@sample-sdk/html2pdf-sdk</code>.</p>
<p>Today, the placeholder is gone. <strong>Html2Pdf</strong> is officially live in production:</p>
<ul>
<li><p><strong>Live Web App &amp; Interactive Demo</strong>: <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app</a></p>
</li>
<li><p><strong>Official TypeScript / ESM SDK</strong>: <a href="https://www.npmjs.com/package/@akcraft/html2pdf-sdk">@akcraft/html2pdf-sdk</a></p>
</li>
<li><p><strong>Live Web API</strong>: <a href="https://api.html2pdf.akcraft.app/">api.html2pdf.akcraft.app</a></p>
</li>
</ul>
<p>In that first post, I set three goals for the tool: <strong>Multilingual</strong>, <strong>Fast</strong>, and <strong>Trustworthy</strong>. Here is how those three promises turned into a real product you can use today.</p>
<h2>1. Multilingual: 21 Indian Languages Across 12 Scripts (No More Tofu Boxes)</h2>
<p>If you have ever tried generating a Hindi, Tamil, or Bengali PDF inside a standard Linux Docker container, you have probably seen empty rectangles (<code>□□□</code>—"tofu") or broken vowel signs instead of text. Most lightweight PDF libraries don't shape complex Indic ligatures properly, and minimal cloud containers don't ship with Indian language fonts.</p>
<p>Html2Pdf runs headless Chromium inside an isolated container pre-bundled with Google Noto typography and a custom <code>fonts.conf</code> pipeline. Before the engine captures the PDF, it waits for <code>document.fonts.ready</code> so every glyph renders cleanly.</p>
<p>Out of the box, it supports <strong>21 Indian languages across 12 scripts</strong> with zero font setup on your end:</p>
<table>
<thead>
<tr>
<th>Script</th>
<th>Supported Languages</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Devanagari</strong></td>
<td>Hindi, Marathi, Nepali, Sanskrit</td>
</tr>
<tr>
<td><strong>Bengali</strong></td>
<td>Bengali, Assamese</td>
</tr>
<tr>
<td><strong>Gurmukhi</strong></td>
<td>Punjabi</td>
</tr>
<tr>
<td><strong>Gujarati</strong></td>
<td>Gujarati</td>
</tr>
<tr>
<td><strong>Odia</strong></td>
<td>Odia</td>
</tr>
<tr>
<td><strong>Tamil</strong></td>
<td>Tamil</td>
</tr>
<tr>
<td><strong>Telugu</strong></td>
<td>Telugu</td>
</tr>
<tr>
<td><strong>Kannada</strong></td>
<td>Kannada</td>
</tr>
<tr>
<td><strong>Malayalam</strong></td>
<td>Malayalam</td>
</tr>
<tr>
<td><strong>Ol Chiki</strong></td>
<td>Santali</td>
</tr>
<tr>
<td><strong>Meetei Mayek</strong></td>
<td>Manipuri</td>
</tr>
<tr>
<td><strong>Nastaliq</strong></td>
<td>Urdu</td>
</tr>
</tbody></table>
<p>You can test all 21 language scripts right now using the interactive preview cards on <a href="https://html2pdf.akcraft.app/#demo">html2pdf.akcraft.app</a> without even creating an account.</p>
<h2>2. Fast &amp; Ergonomic: The Real <code>@akcraft/html2pdf-sdk</code></h2>
<p>In my first post, I showed the rough API idea. Now you can install the real zero-dependency TypeScript SDK directly from npm:</p>
<pre><code class="language-bash">npm install @akcraft/html2pdf-sdk
</code></pre>
<p>The client points to <code>https://api.html2pdf.akcraft.app</code> by default, ships with full TypeScript types for paper formats (<code>A0</code>–<code>A6</code>, <code>Letter</code>, <code>Legal</code>, <code>Tabloid</code>, <code>Ledger</code>) and page orientation (<code>portrait</code>, <code>landscape</code>), and surfaces structured errors (<code>Html2PdfError</code> with <code>statusCode</code>, <code>apiError</code>, and <code>retryAfter</code>).</p>
<pre><code class="language-typescript">import {
  Html2PdfClient,
  PaperFormat,
  PdfOrientation,
  Html2PdfError,
} from "@akcraft/html2pdf-sdk";

const client = new Html2PdfClient(process.env.HTML2PDF_API_KEY);

try {
  const result = await client.sendHtmlRequest({
    userId: "YOUR_USER_ID",
    content: "&lt;h1&gt;नमस्ते दुनिया&lt;/h1&gt;&lt;p&gt;Generated with @akcraft/html2pdf-sdk&lt;/p&gt;",
    options: {
      format: PaperFormat.A4,
      orientation: PdfOrientation.Portrait,
    },
  });

  console.log(result.jobId);    // Unique conversion job ID
  console.log(result.status);   // "completed"
  console.log(result.pdfUrl);   // Presigned download URL (valid for 1 hour)
  console.log(result.fileName); // Stored PDF filename
} catch (err) {
  if (err instanceof Html2PdfError) {
    console.error(`API Error (${err.statusCode}): ${err.apiError}`);
    if (err.retryAfter) {
      console.error(`Rate limit reached. Retry after ${err.retryAfter}s`);
    }
  }
}
</code></pre>
<p>Prefer plain HTTP or another language? You can call <code>POST https://api.html2pdf.akcraft.app/api/send-html</code> directly with an <code>x-api-key</code> header from Python, Go, cURL, or any backend.</p>
<h2>3. Trustworthy: Built-In Key Security &amp; Self-Cleaning Storage</h2>
<p>When you send HTML templates—whether invoices, exam papers, or reports—you shouldn't have to worry about leaked API keys or sensitive PDFs sitting in a public bucket forever. Here is how Html2Pdf protects your account and files:</p>
<ul>
<li><p><strong>One-Time SHA-256 Hashed API Keys</strong>: When you generate an API key (<code>h2p_live_...</code>) in the dashboard, it is generated client-side via <code>crypto.getRandomValues</code> and shown to you once. Our database stores only its SHA-256 hash—never plaintext—and supports instant soft-revocation.</p>
</li>
<li><p><strong>Presigned URLs &amp; 2-Hour Auto-Deletion</strong>: Every converted PDF returns a presigned download link that expires in 1 hour, and you can manually delete any file immediately from <a href="https://html2pdf.akcraft.app/dashboard">your dashboard</a> or via DELETE /api/delete-file/:fileName. On the backend, an automated cleanup job that sweeps storage every 15 minutes to purge files older than 2 hours is currently in beta testing—so if you need immediate removal, use manual deletion anytime.</p>
</li>
<li><p><strong>Beta Version Limits</strong>: For the beta, I've kept limits generous at 10 conversions/minute and 1,000,000 conversions/month, with automatic quota rollback if a render or storage upload ever fails.</p>
</li>
</ul>
<h2>A Quick Look at the Developer Dashboard</h2>
<p>At <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app/dashboard</a> (with Email/Password or Google OAuth sign-in), you get three focused views to manage your integration:</p>
<ul>
<li><p><strong>Overview</strong>: Track your conversion counts, monthly quota usage, and active key snippet at a glance.</p>
</li>
<li><p><strong>API Keys</strong>: Create new <code>h2p_live_...</code> keys with a reveal-once modal and revoke old keys without breaking historical job logs.</p>
</li>
<li><p><strong>History</strong>: Browse paginated conversion logs, download active PDFs, or delete files on demand.</p>
</li>
</ul>
<p>Before launching, I locked the codebase behind a <strong>116-test automated gate</strong> (53 Fastify API tests, 40 Astro/React website tests, and 23 Vitest SDK tests) with zero failing tests.</p>
<h2>Try It Out &amp; What's Coming Next in This Series</h2>
<p>You can try the live HTML-to-PDF previewer right now at <a href="https://html2pdf.akcraft.app/">html2pdf.akcraft.app</a> or grab <a href="https://www.npmjs.com/package/@akcraft/html2pdf-sdk">@akcraft/html2pdf-sdk</a>) on npm.</p>
<p>Because a lot went into building the backend, I'm splitting the technical deep dives into upcoming posts:</p>
<ol>
<li><p><strong>How I Solved the Indic Font "Tofu" Problem in Dockerized Headless Chromium</strong> (bundling 21 Indian languages across 12 scripts with Fastify 5 and Puppeteer).</p>
</li>
<li><p><strong>Designing Dual-Gate Rate Limiting, Atomic S3 Rollbacks &amp; SHA-256 API Keys</strong> (using Upstash Redis Lua scripts, Supabase, and Astro 7 SSR proxies).</p>
</li>
</ol>
<p>Let me know in the comments which deep dive you'd like to read first—and if you test the SDK in your own project, I'd love your feedback!</p>
<p><code>#javascript</code> <code>#typescript</code> <code>#pdf</code> <code>#buildinpublic</code> <code>#npm</code> <code>#webdev</code></p>
]]></content:encoded></item><item><title><![CDATA[Why I'm building an HTML to PDF tool that works in every language]]></title><description><![CDATA[I needed PDFs in one project, so I built my own converter, then turned it into a shared SDK with Indian language support. Beta coming soon.]]></description><link>https://blogs.akashpal.dev/why-i-m-building-an-html-to-pdf-tool-that-works-in-every-language</link><guid isPermaLink="true">https://blogs.akashpal.dev/why-i-m-building-an-html-to-pdf-tool-that-works-in-every-language</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[pdf]]></category><category><![CDATA[buildinpublic]]></category><category><![CDATA[npm]]></category><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Sun, 04 Oct 2026 14:04:07 GMT</pubDate><content:encoded><![CDATA[<p>I'm building a tool that turns HTML into a PDF. It isn't released yet. A beta is coming soon, and I want to share the story from the start.</p>
<h2>How it started</h2>
<p>In one of my personal project, AI Question Generator, I needed to create PDFs. So I built my own converter for it.</p>
<p>Then I thought: If I'll need this in my next project too. And the one after that. Copying the same code into every project means every bug gets fixed in many places, or not fixed at all.</p>
<p>So I moved it into one central library that all my projects can share. Once it worked well, I realized other developers might want it too. That's why I'm releasing it as an SDK.</p>
<h2>What I wanted from it</h2>
<p>Since I'd depend on it in my own projects, I held it to three goals:</p>
<ul>
<li><p><strong>Trustworthy</strong>: safe with my keys and my files</p>
</li>
<li><p><strong>Fast</strong>: a PDF back in seconds</p>
</li>
<li><p><strong>Multilingual</strong>: the text always shows up correctly</p>
</li>
</ul>
<h2>What it looks like</h2>
<p>You send HTML, and you get a PDF link back:</p>
<pre><code class="language-ts">import { Html2PdfClient } from "@sample-sdk/html2pdf-sdk";

const client = new Html2PdfClient({ apiKey: "YOUR_API_KEY" });

const result = await client.sendHtmlRequest({
  userId: "YOUR_USER_ID",
  content: "&lt;h1&gt;नमस्ते दुनिया&lt;/h1&gt;",
});

console.log(result.pdfUrl); // link to your PDF
</code></pre>
]]></content:encoded></item><item><title><![CDATA[How I Added a Bot to My App Without Ever Touching the Code Again]]></title><description><![CDATA[We built the side project. It was working. But something felt incomplete — users had questions, and there was no one to answer them at 2am. So we thought…]]></description><link>https://blogs.akashpal.dev/how-i-added-a-bot-to-my-app-without-ever-touching-the-code-again</link><guid isPermaLink="true">https://blogs.akashpal.dev/how-i-added-a-bot-to-my-app-without-ever-touching-the-code-again</guid><category><![CDATA[bot,typebot]]></category><category><![CDATA[bot]]></category><category><![CDATA[bot-script]]></category><category><![CDATA[Low Code]]></category><category><![CDATA[Script]]></category><category><![CDATA[personal development]]></category><dc:creator><![CDATA[Akash Pal]]></dc:creator><pubDate>Sun, 17 May 2026 19:17:49 GMT</pubDate><content:encoded><![CDATA[<p>We built the side project. It was working. But something felt incomplete — users had questions, and there was no one to answer them at 2am.</p>
<p>So we thought: <em>let's add a bot.</em></p>
<p>But before jumping in, we asked ourselves the real question — <strong>will this make our project more maintainable, or a nightmare?</strong></p>
<p>Because the last thing we wanted was a bot so tightly coupled to our codebase that every FAQ update needed a redeploy. That's not sustainable for a side project. That's just creating more work for yourself.</p>
<p>So we set a constraint early: <strong>integrate once, update independently.</strong></p>
<p>That one constraint led us straight to <a href="https://typebot.com/">Typebot</a>.</p>
<p>Getting started was almost suspiciously easy.</p>
<p>Typebot gives you templates out of the box. We picked a simple FAQ one, tweaked the questions to match our app, and hit publish. Then we grabbed the embed script, dropped it into our app — one time — and that was it.</p>
<p>No new component. No state management. No API to wire up. Just a script tag.</p>
<p>And the best part? That was the last time we touched the app for anything bot-related. Need to add a new FAQ? Go to Typebot, update the flow, publish. Done. The app has no idea anything changed — and it doesn't need to.</p>
<p>For a side project, that's huge. You're not always in "deployment mode." Sometimes you just want to update a line of text without spinning up the whole pipeline.</p>
]]></content:encoded></item></channel></rss>