Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Building a Pure-TypeScript 13x13 Crossword CSP Solver and 100-Page Vector PDF Engine on Cloudflare Workers

Turning a group of friends' inside jokes into a real, print-ready crossword keepsake book sounds simple until you try to run both puzzle generation and 100-page book typesetting inside a single edge Worker. When we built ClueBook and its interactive puzzle & sample PDF preview , our main constraint was keeping the entire pipeline—13x13 crossword solving, vector PDF interior layout, and…

Developing a pure-TypeScript 13x13 crossword crossword solver and 100-page vector PDF engine on Cloudflare Workers proved challenging. Cloudflare Workers restrict the use of Python runtimes or headless browsers, limiting our ability to efficiently process complex tasks. To overcome this limitation, we built a deterministic 13x13 bitmask CSP solver that tackles contributor clues, which are short, irregular, and unpredictable.

This solver divides the grid construction process into two bounded stages: skeleton placement and bitmask CSP fill. By limiting the number of steps in the skeleton placement stage and governing the bitmask CSP fill stage, we ensured that even dense intersections would not exceed Worker CPU budgets. The deterministic nature of this solver guarantees that regenerating a book after moderation or order fulfillment yields the exact same puzzles and answer keys.

For the 100-page 6x9 vector PDF, we opted against rendering HTML through Chromium, which could add cold starts and memory spikes. Instead, we directly built the entire interior and dynamic-spine cover wrap with pdf-lib. This approach ensures vector grid lines, crisp clue numbering, dedication pages, and answer keys stream out without rasterization bloat.

The 100-page interior renders in under 200ms, while the cover wrap completes in under 30ms, providing a fast and efficient printing process. Idempotent fulfillment on D1 paid print orders is managed through an atomic compare-and-swap state transition in Cloudflare D1, backed by an idempotent Stripe webhook log. This ensures retried webhooks never create duplicate print jobs.

The live 13x13 solver and 3-page sample PDF layout can be tested in the ClueBook Preview, or users can create a group puzzle at getcluebook.com.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

What Makes Reliable RF Connector Components? A Manufacturing Perspective

RF connectors may look like small mechanical parts, but their manufacturing requirements are far from simple. A slight change in contact diameter, conductor alignment, or thread geometry can affect…

  • RF connectors consist of center contacts, pins, sockets, and conductors
  • Materials like brass, copper, and beryllium copper used for signal-carrying elements
  • Surface treatments like gold plating ensure stable electrical contact and corrosion resistance

Tripo3D or GenAnywhere? What I Learned Splitting a Site From Its Objects

The question I keep getting is which of these two AI tools to use. After a month on a drive-in revival, my answer is that they do not overlap enough to compete.

  • GenAnywhere models land, Tripo3D models objects
  • Project involved eight-and-a-half-acre drive-in with six renders and one 1:300 model
  • Decision between tools depends on where land ends

More from Friday 27 November →