Urgent.News

What's breaking now, across thousands of outlets.

Tech

I open-sourced 3 small Node utilities I pulled out of building an edtech platform

I've spent the last while building MCQplex , an exam-prep platform for Nepal's NEB curriculum. Along the way I built a few pieces of infrastructure that had nothing to do with exams specifically, so I pulled them out into their own packages: llm-free-cascade Free-tier LLM APIs (Gemini, Groq, Cerebras, and others) are individually rate-limited, but between them they add up to a lot of free…

In a recent development, the author has open-sourced three small Node.js utilities that were created while building an educational technology platform. These utilities are unrelated to the exam-specific features of the platform and have been extracted as separate packages.

The first package, llm-free-cascade, provides free-tier APIs for Large Language Model (LLM) services such as Gemini, Groq, Cerebras, and others. These APIs are rate-limited individually, but by cascading chat completions across multiple keys, the author has managed to accumulate a significant amount of free inference. The cascade package automatically rotates between keys and implements a cooldown mechanism for providers that have structural issues. It is designed to have zero dependencies.

The second package, pdf-render-pool, addresses the performance issue of launching a fresh headless Chromium instance for each PDF rendering task. The naive approach using Puppeteer incurs a delay of 1-2 seconds and consumes approximately 200MB of RAM every time. pdf-render-pool solves this problem by keeping a single browser warm and limiting the concurrency of PDF requests.

This ensures that a burst of PDF requests does not overwhelm the server. The package is MongoDB-backed, allowing for advisory locks to prevent deadlocks in case of crashed holders. Both llm-free-cascade and pdf-render-pool are MIT licensed, have no peer dependencies, and are tested and available on npm.

The third package, mongo-job-lock, tackles the issue of running node-cron jobs across multiple instances (such as a PM2 cluster or several servers). Without this solution, every instance would execute the job, leading to inefficiency and potential deadlocks. mongo-job-lock introduces a tiny MongoDB-backed advisory lock, which ensures that only one instance can hold the lock at a time, preventing deadlocks.

The package is designed to work with the existing MongoDB connection and is straightforward to integrate. Like the other packages, mongo-job-lock is zero or optional-peer dependent, MIT licensed, tested, and available on npm.

The author is welcoming feedback and pull requests, particularly for llm-free-cascade, as free-tier model names change frequently and the providers.json configuration needs to be updated for stale entries.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

This story

This is one outlet's version. Read the fullest account.

Read the original at dev.to →

More in Tech

More from Saturday 19 September →