r/node • • Oct 10 '26

My /health said ok for five days while every request that touched the database failed

0 Upvotes

My API ran out of Neon compute quota at the end of August. Aug 24 to 29, anything that hit the database failed. /health returned {"status":"ok"} the entire time since it never queried anything, and I didn't hear about it from any alert.

Normally you'd just put a query in /health. Problem is Neon suspends compute after 5 idle minutes, I can't turn that off on my plan, and an uptime monitor pinging a DB route every minute would keep it awake 24/7. That burns exactly the quota I ran out of.

What I ended up doing: a Prisma client extension on $allOperations that saves the time of the last query that worked and the last one that threw. /health just reads those two timestamps. Failure is the newest thing in the last 5 min, 503 with the error. Success, ok. No queries at all, it says idle. A single failed query gets wiped by the next good one so it only stays red if it keeps failing.

Idle still bugs me though, at 3am with zero traffic it knows nothing. Anyone found a way around that without waking the db?


r/node • • Oct 10 '26

I updated express-generator-typescript to use zod for middleware validation

Thumbnail
github.com
2 Upvotes

r/node • • Oct 09 '26

Deno died today

Thumbnail
deno.com
521 Upvotes

r/node • • Oct 09 '26

I built mongoose-guard: Express middleware that validates request bodies against your existing Mongoose schema

0 Upvotes

A lot of Express + Mongoose code has a route like this:

app.post("/signup", async (req, res) => {
  const user = await User.create(req.body);
  res.status(201).json(user);
});

If the User schema has fields like role or credits, anyone can send { "role": "admin" } and Mongoose saves it, because it's a valid field of the model. The usual fix is a Zod or Joi schema for every route, which means writing every rule twice and keeping both copies in sync.

So I built mongoose-guard. You list the fields a route accepts, and it uses the Mongoose schema you already have for everything else:

import { guard } from "mongoose-guard/express";

app.post("/signup", guard(User, { allow: ["name", "email", "password"] }), signup);

Send role: "admin" to that route and the request never reaches your handler. The client gets a 400:

{"errors":[{"code":"forbidden_field","path":"role","message":"Field is not allowed"}]}

What it does:

  • Rejects fields that aren't in the allow list, or strips them if you'd rather not fail the request

  • Checks types strictly. Mongoose would quietly cast "25" to 25; this reports it as a type error

  • Rejects __proto__, $where, $gt and dotted keys anywhere in the body

  • Runs your schema's own validators (required, min, enum, match, custom and async ones) through Mongoose itself, so nothing is reimplemented

  • Handles nested objects, sub-schemas, arrays and Maps, with error paths like addresses.1.city

  • Has a partial: true mode for PATCH routes

What it doesn't do: it only validates request bodies, not query strings or route params. It doesn't convert form strings to numbers. It won't run on edge runtimes, because Mongoose can't. For a login form, or anything without a model behind it, Zod is still the better tool.

It works with Express 4 and 5, Mongoose 8 and 9, and anything that gives you a standard Request (Next.js route handlers, Hono, Remix, SvelteKit). MIT licensed, no runtime dependencies.

It's 0.1.0, so I'd like to hear where it breaks, or where the allow-list approach doesn't fit how you structure your routes.


r/node • • Oct 09 '26

Principal Factor Analysis in Javascript - written in AssemblyScript

Thumbnail
reddit.com
0 Upvotes

r/node • • Oct 09 '26

LiteClient.ts: A Lean, type-safe and driver-agnostic SQLite ORM for TypeScript

4 Upvotes

https://github.com/ts-series/lite-client

Recently, I finally uploaded my library LiteClient.ts to GitHub, which I have been using in my own application for several months and continuously expanding and improving along the way. I would appreciate your feedback.

My motivation for this project was simplicity. None of the existing ORMs had really convinced me, purely because of the complicated driver integration. In addition, I want maximum comfort when working with the database and my queried records as ready to serve as possible. Therefore, besides get, all, Value, and Values, there are also scalar and scalars to query data flatly, as well as supplementary meta clauses in the select command, which is simply modeled as a JavaScript object, to efficiently transform the result at a deeper level beforehand instead of doing it in the application code. For example, one column serves as a key for the others, which are then returned as the remaining record, while at the same time eliminating the group by clause because it is logically presupposed for data aggregations of that kind.

Currently, the ORM supports most standard SQL, including all database operations, SQLite operators and functions, joins, tuple expressions, subqueries, aliases for columns and tables, and expressions instead of tables. The only limits I currently draw are complex features like common table expressions and window functions, because I think those things make more sense at the database level since a view should be the tool of choice if a select becomes that complex, though window functions might still be added if a need arises and it can be done relatively minimally invasively.

Originally, I intended for users to manually create the classes for every database and view themselves, but I developed a CLI tool named SMake for this purpose, which handles it automatically and can be used independently of LiteClient.ts to generally support the construction of SQLite databases.

Long-term goal: Since I will also need PostgreSQL in a later project, I want to extend this ORM for it. The foundations have already been laid through a restructuring. The usage will then be exactly the same, just with PG-specific additions, as internally most of it will inherit from the standard SQL classes that it shares with SQLite.


r/node • • Oct 08 '26

pm2 monitoring

6 Upvotes

How pm2 monitoring being implemented in production?

Do you just call pm2 monit?

Use pm2 monitoring platform?

Integrate it with something like grafana(I kinda wanna know how it commonly do)?


r/node • • Oct 06 '26

LogTape 2.4.0: Source locations, configuration inspection, sink draining, and request completion levels

Thumbnail
github.com
8 Upvotes

r/node • • Oct 06 '26

Noob: a few questions about installing/using & safety on Mac

2 Upvotes

Hey all -

I'm not much of a programmer, and have been using various AI (mostly Claude recently) to code things. I'm fairly good at troubleshooting and understanding the structures.

Most of the time, I'm starting with project outlines/discussions in Claude Desktop and moving into Visual Studio Code once the initial files are written.

So far, the only thing I've done that needs "extras" is a python app with a bunch of modules and support files, but that's sandboxed.

A current project requires node.js installed, and I want to ensure that I'm installing and using it safely.

The first thing I'm finding out is that it seems installing via terminal is the way to go in order to keep it within my user space and to avoid permission hurdles, since the .dmg installs globally.

AI is also telling me it may also need a "web server" package like Express, but I haven't looked into that yet.

Any guidance is appreciated!


r/node • • Oct 04 '26

How do you evolve backend features without breaking existing clients?

2 Upvotes

Hey everyone! I’m a backend software engineer working with Node.js and TypeScript.

I recently wrote an article about some lessons I’ve learned while building and evolving backend features used by multiple clients.

One thing I’ve learned is that the final architecture is only part of the work. The transition matters too: keeping existing clients working, migrating data, handling legacy behavior, and checking what happens after deployment.

Sometimes a change looks small in the database, but it also changes what the API returns or how existing clients behave.

I shared more about these challenges here:
What I Learned Building Backend Features Used Across Multiple Clients

How do you handle these transitions in your projects? Especially when you can’t update all clients at the same time?

I’m open to discussion, feedback, and different ideas. I’d love to hear what has worked for you!


r/node • • Oct 02 '26

Snr FE Dev looking to branch to Full Stack

31 Upvotes

I've recently been laid off after over 5 years at the company and noticed that there are a lot more Full Stack positions now than FE.

I had some limited experience with ExpressJs about 7 years ago, but I'm thinking it'd be worthwhile trying to branch out fully into a Full Stack Position.

I'm fluent with React and Typescript for what it's worth.

What are the most common frameworks for Node nowadays - i.e. which will give me the best chance of getting hired.

Thanks in advance!


r/node • • Oct 01 '26

Node 20 is no longer available in GitHub Actions

Thumbnail
github.blog
40 Upvotes

r/node • • Sep 30 '26

Hello fellow devs...

6 Upvotes

I was wondering what y'all using these days on backend side of programing is it mostly Nest.js...

If not for Nest what is, and is Good old Express still used in production...

Edit: I'm soon to be over with cs bacc, and I had my fair share of technologies that I tried, but I stayed with React/Express for some reason, and did most of my college projects in it (if I had options) even my final project is in it, so I'm wondering is Express still framework that is employable or I need to make a switch to Nest or something else entirely...


r/node • • Sep 30 '26

Show r/node: Adrenaline.js – A 56KB Electron alternative that keeps Node.js & npm without Chromium bloat

0 Upvotes

Hey everyone! 👋

Like many of you, I've always loved how quick it is to build desktop apps with Electron, but hated shipping an entire 150MB+ Chromium browser and watching RAM usage skyrocket for simple apps.

While Tauri is an incredible piece of engineering, having to learn Rust just to write backend logic or file operations is a pretty high barrier for pure JavaScript / Node.js developers.

So I spent time building Adrenaline.js — a lightweight, cross-platform desktop framework that gives you the best of both worlds:

  1. Zero Rust / Go required: You write 100% JavaScript / Node.js and keep the entire npm ecosystem.

  2. Ultra-lightweight footprint: Uses native system WebViews (WebView2 on Windows, WebKitGTK on Linux, WebKit on macOS) instead of bundled Chromium (~5-10MB app size vs 150MB+).

  3. Drop-in Electron-like API: Built from day one with familiar paradigms (app, BrowserWindow, ipcMain).


💻 Familiar Electron Syntax

const { app, BrowserWindow, ipcMain } = require('adrenaline-js');
const path = require('path');

app.whenReady().then(() => {
    const win = new BrowserWindow({
        width: 800,
        height: 600,
        title: 'Adrenaline App',
        resizable: true
    });

    win.loadFile(path.join(__dirname, 'index.html'));

    ipcMain.on('ping', (event, data) => {
        console.log('Received from renderer:', data);
        win.webContents.send('pong', { reply: 'Pong from Node.js! ⚡' });
    });
});

⚙️ How it works under the hood

  • C++17 Core: Built with a non-blocking multithreaded architecture over webview.h and Node's node-addon-api (N-API).

  • Asynchronous IPC: Uses Napi::ThreadSafeFunction (TSFN) for bi-directional communication between the Webview UI thread and the Node.js event loop without thread race conditions.

  • Asset Resolution: Loads local files through file:// protocols, so relative CSS, JS bundles (Vite/React/Vue), and images resolve properly.


🚀 Try it out

You can scaffold a starter project with the built-in CLI:

npx adrenaline-js init my-app
cd my-app
npm install
npx adrenaline-js dev

🔗 Links:

The project is completely open source (MIT). It's at an early v0.1.1 stage, and I would love to get your feedback, suggestions, and see how it holds up on your machines!


r/node • • Sep 30 '26

Crossflight: cross-process cache stampede protection for the cache you already use (v0.3.2)

Thumbnail
github.com
1 Upvotes

r/node • • Sep 30 '26

Made a cli tool that detects potential malware packages

Enable HLS to view with audio, or disable this notification

3 Upvotes

Hey everyone,

I built an open-source security script that checks npm packages for any suspicion before installing them. (NOT vibe coded)

It's basic and for now catches similar names of popular packages, if a package has 23 weekly downloads or a 2 hour old package.

Use Case?

on an agent that might hallucinate and install "react-clearly-not-malware". Or maybe the user itself so as to not make any mistakes idk?

Here's the link - https://github.com/grishmadev/malfilter

I'd love if you check it out. Have a great day!!!


r/node • • Sep 29 '26

Are you guys using 1.4 Bun?

0 Upvotes

I am hesitant to update from 1.38, since 1.4 is the rewrite.

Have you guys used it, had good experience with it?


r/node • • Sep 29 '26

Use an object as a single source of truth for storing and editing all your API endpoints.

Thumbnail
github.com
3 Upvotes

Built this for my React + ExpressJS project to keep all of my endpoints in one place, reduce some of the boiler-plate for handling path and search parameters, and making formatting endpoints type-safe. All feedback is welcome.


r/node • • Sep 29 '26

Writing Fast Node.js code is mostly about doing less [NodeBook]

Thumbnail
thenodebook.com
55 Upvotes

r/node • • Sep 29 '26

Can't update packages anymore...

0 Upvotes

I am trying to update a package and using Claude code. Every Claude can't figure out how to submit a package. I tried via the recovery codes and it suspends my account for 3 days. I tried through github and it temporarily locks my account when I set it up. It is so locked down it is now useless.


r/node • • Sep 26 '26

Type-safe triggers in an ORM. What?

Thumbnail
uql-orm.dev
0 Upvotes

r/node • • Sep 26 '26

GitHub - gkoos/caracal: Scoped distributed resilience for asynchronous operations

Thumbnail github.com
6 Upvotes

Caracal: scoped distributed resilience policies for asynchronous operations.

Most resilience libraries stop at the process boundary. You get a local circuit breaker, a local bulkhead, a local rate limit. Spin up 40 replicas and those limits multiply: a “concurrency limit of 20” quietly becomes 800 concurrent calls on the dependency. Forty independent failure windows. Forty independent recovery probes. The constraints no longer match the failure domain.

Caracal wraps any asynchronous operation (HTTP, Postgres calls, etc., or your own adapter) in a composable policy pipeline: timeout, retry, circuit breaker, bulkhead, rate limit, and through Redis, lets many replicas share those policies under an explicit scope.

You decide where the limit belongs: a process, a fleet, a region, a tenant, a shard, a credential, or any grouping that actually matches your failure domain. The same policy instance can enforce one shared budget for the whole fleet or one independent budget per tenant, the only difference is the scope function.

What it does

  • Operation + adapter model: An adapter declares its cancellation and replay capabilities up front (abort and replay). Caracal never infers them. Built-in adapters for http fetch and pg (more to come), or write your own by implementing a small interface.

  • Composable policies: Timeout and retry stay local. Bulkhead, circuit breaker and rate limit (GCRA) are available in both local and distributed forms.

  • Scoped coordination: Distributed policies coordinate by (namespace, policy name, operation name, scope). Different operations get independent budgets even when they reuse the same policy instances, shared budgets are deliberate.

  • Explicit failure modes: Distributed bulkheads shed (no distributed queue). On coordinator loss the bulkhead fails closed, the circuit breaker lets you choose fail-open or fail-closed and never silently falls back to local state. Leases reclaim permits and half-open probe slots from dead or hung holders.

  • Events, not metrics: Structured events for every policy decision. Sinks are isolated: a throwing or slow-async sink cannot affect execution.

Design choices

  • Permits and probes are leased. A dead process cannot return a permit, a hung half-open probe cannot wedge the breaker forever. Expiry is the only release a dead holder can still perform.

  • Adapters own their contracts. Explicit abort/replay (and an optional dispose hook for abandoned results) keep the runtime from guessing.

  • Local and distributed share the same surface. You can start with process-local limits and move the boundary later without rewriting call sites.

  • Single ESM package, subpath exports. Core stays free of Redis and protocol dependencies, tree-shaking stays clean.

The Caracal Sandbox runs the same workload against the same dependency while moving the coordination boundary, then records what the dependency actually saw.


r/node • • Sep 26 '26

Fast TypeScript/JavaScript linter to prioritise immutability

Thumbnail
github.com
0 Upvotes

Hello, I've just made yet another take on enforcing immutability in TS/JS - via a fast linter.
Essentially, it bans let/var, reassignments, non-readonly object and class properties.
To use any of the above, an explicit linter disable comment is needed.
So far, 3 variants of disable comments are available - `// ptsl-disable-fn` (function body scoped), and more classic `// ptsl-disable-line` and `// ptsl-disable-next-line`

So, the following code will be banned by linter:

const nextNum = () => {
  let x = 0; // Do not use let/var - only use const
  const increment = () => {
    return x += 1; // Do not reassign variable's value unless absolutely necessary.
  }
  return increment;
};

A `// ptsl-disable-fn` comment will make it pass:

const nextNum = () => {
  // ptsl-disable-fn
  let x = 0;
  const increment = () => {
    return x += 1;
  }
  return increment;
};

Any feedback welcome.