← Articles · Full Stack & Security · 2026-11-11 · 5 min read

Shipping One Codebase Across Edge (Workers D1) and Docker SQLite

Architectural lessons from the Dual-Mode Blog CMS: database adapter abstraction, standard Web Crypto PBKDF2 auth, and zero-bloat Hono JSX SSR.

  • Hono
  • SQLite WAL
  • Cloudflare D1
  • PBKDF2

# Preventing Cloud Vendor Lock-In at the Storage Boundary

Applications tightly coupled to serverless SDKs often require full rewrites to self-host on Docker. By defining a lightweight SQL adapter behind Hono JSX routes, the exact same TypeScript codebase targets Cloudflare D1 in production or Node 22 native SQLite WAL locally.

# Portable Authentication via Standard Web Crypto API

Avoiding native C++ password-hashing addons allows identical cryptographic verification across edge isolates and Alpine containers using Web Crypto PBKDF2-SHA256 (100,000 iterations + per-user salt).

  • Session tokens lock down behind HttpOnly, Secure, and SameSite cookie attributes.
  • Forms combine Cloudflare Turnstile verification with explicit CSP worker-src and frame-src rules.
  • Bundled esbuild ESM output keeps container memory usage minimal with sub-second startups.