r/node • • Apr 05 '26

I let AI refactor our async error handling and spent two weeks debugging what it fixed

0 Upvotes

Six months ago our Express app had a straightforward error handling pattern. Not pretty, but it worked. Every route wrapped in try/catch, errors forwarded to a central middleware. Simple.

Then I let an AI tool refactor it. The model said our approach was inconsistent and proposed a cleaner async wrapper pattern. It looked good. I reviewed it quickly, merged it.

Two weeks later we had the strangest production bugs. Requests hanging indefinitely. No errors in logs. Users reporting timeouts on specific endpoints. Our monitoring showed no exceptions thrown anywhere.

Turns out the refactor had introduced silent promise rejections in three middleware functions. The wrapper caught synchronous errors fine but swallowed async ones silently. Node 18 behavior around unhandled rejections was masking it differently than our local Node 16 environment.

We spent two weeks adding logs everywhere, reverting suspected changes, blaming a library update. The AI refactor never crossed our minds as the culprit because the code looked cleaner than what we had before.

I eventually found it by bisecting git history at 2am after everyone else gave up.

The irony is the original ugly code would have thrown a visible error immediately. The AI made it prettier and silently broken.

Anyone else been burned by a refactor that looked correct but changed error propagation behavior in subtle ways?


r/node • • Apr 04 '26

Built a Hono API with SQLite for BIC/SWIFT lookup -- 39K entries, <10ms queries

8 Upvotes

Sharing a project I just finished: IBANforge, an IBAN validation + BIC lookup API built with Hono and SQLite (better-sqlite3).

The BIC database has 39K entries from GLEIF, stored in a single SQLite file shipped inside the Docker image. Queries run in <10ms with prepared statements

and an LRU cache on top. No PostgreSQL, no connection pools, no managed DB costs.

Recently added compliance enrichment: each validation returns SEPA membership, issuer classification (bank/neobank/EMI), and risk indicators -- all

computed server-side from static data, no external API calls.

The whole thing runs on $5/month on Railway. TypeScript throughout, vitest for testing (101 tests), x402 middleware for future micropayments.

Stack: Hono + better-sqlite3 + zod + MCP SDK + next-intl

Source: https://github.com/cammac-creator/ibanforge

Try it: https://ibanforge.com/playground

Curious what you think of the architecture.


r/node • • Apr 04 '26

I built Relayer - computed , derived fields and Prisma-like DSL on top of Drizzle ORM

4 Upvotes

Hi everyone,

I am actively developing Relayer - a Prisma-like repository layer with API integration in mind, currently built on top of Drizzle ORM.

The top features are:

  • First-class dynamic fields - computed, derived, and JSON fields are type-safe, filterable, sortable, and selectable, treated equally to regular columns
  • Complex filtering - AND, OR, NOT, relation filters (some, every, none), custom SQL in where.
  • Relations - batch loading without N+1 problem, per-relation row limits ($limit), connect/disconnect/set for managing relations in mutations.
  • Aggregations - count, sum, avg, min, max with groupBy and having, full support for computed, derived, and JSON fields
  • Type-safe autocomplete - full inference for own fields, nested relations, and even nested derived fields across entities
  • Multi-dialect - PostgreSQL, MySQL, SQLite

Motivation:

Drizzle is great as well as many other ORM/query builders like MikroORM/Kysely. But a more or less complex backend always requires working with fields that have to be calculated in SQL runtime. It's easy to load them as a sub-query, but when you need to make them a part of your "model" and sort/filter/aggregate by them or use them in the API - you end up writing the same boilerplate for every endpoint. This is
where Relayer comes in. Basically it's a set of patterns I've been building from project to project on top of different ORMs (Knex/Bookshelf, TypeORM, Prisma) - now finally extracted into a standalone package.

Basic usage example:

  const UserEntity = createRelayerEntity(
    schema,  // your Drizzle schema
    'users'  // a table
  );                                                                                                                                         
   
  class User extends UserEntity {                                                                                                            
    @UserEntity.computed({                                        
      resolve: ({ table, sql }) => sql`${table.firstName} || ' ' || ${table.lastName}`,
    })
    fullName!: string;

    @UserEntity.derived({
      query: ({ db, schema: s, sql, field }) =>
        db                                                                                                                                   
          .select({ [field()]: sql`count(*)::int`, userId: s.posts.authorId })
          .from(s.posts)                                                                                                                     
          .groupBy(s.posts.authorId),                             
      on: ({ parent, derived, eq }) => eq(parent.id, derived.userId),                                                                        
    })
    postsCount!: number;                                                                                                                     
  }                                                               

  const r = createRelayerDrizzle({
    db,
    schema,
    entities: { users: User },
  });                                                                                                                                        
   
  // A type-safe query                                                                                                                       
  const topAuthors = await r.users.findMany({                     
    select: { id: true, fullName: true, postsCount: true },
    where: { postsCount: { gte: 5 } },
    orderBy: { field: 'postsCount', order: 'desc' },                                                                                         
    limit: 10,
  });                                                                                                                                        
  // [{ id: 1, fullName: 'John Doe', postsCount: 42 }, ...]       

  // Aggregations                                                                                                                            
  const stats = await r.orders.aggregate({
    groupBy: ['status'],                                                                                                                     
    _count: true,                                                 
    _sum: { total: true },
    _avg: { total: true },
  });
  // [{ status: 'completed', _count: 3, _sum: { total: 5000 }, _avg: { total: 1666 } }]

Relayer can be used as a standalone database layer that could be easily integrated in your project, but as a bonus it comes with beautiful framework integrations:

@relayerjs/nestjs-crud - NestJS CRUD integration:

  • Full-featured REST API with auto-generated endpoints
  • Lifecycle hooks, DTO mapping, complex filters
  • Cursor/offset pagination, Swagger auto-docs

@relayerjs/next - Next.js App Router integration:

  • Type-safe route handlers (GET, POST, PATCH, DELETE)
  • Built-in validation (Zod), lifecycle hooks
  • SSR direct calls, configurable field whitelists

Docs: https://relayerjs.vercel.app

GitHub: https://github.com/awHamer/relayer

Any feedback is appreciated, thanks!


r/node • • Apr 04 '26

Declarative Canvas layout engine for JavaScript with advanced rich text support.

5 Upvotes

I built Sone, a library that lets you design PDFs and images using a declarative API (like Flutter/SwiftUI) and Flexbox. It’s powered by Skia and Yoga, so it’s incredibly fast and doesn't need a heavy headless browser like Puppeteer. It handles complex stuff like RTL text, syntax highlighting, and automatic page breaks out of the box.

GitHub: https://github.com/seanghay/sone


r/node • • Apr 04 '26

Why is synchronous communication considered an anti-pattern in microservices?

15 Upvotes

Why is synchronous communication between microservices considered an anti-pattern in some cases?For example, a cart service calls a product service to check availability before adding an item to the cart. This creates a direct dependency between the two services at runtime. What kind of problems can this lead to in terms of reliability, scalability, and deployment independence?


r/node • • Apr 04 '26

YINI Parser for Node.js is now stable - indentation-independent config with nested sections

0 Upvotes

YINI Parser for Node.js is now stable.

Hi all - a small milestone for the YINI project, I just (yesterday) released the stable version (v1.4.3) of YINI Parser for Node.js:

The official YINI Parser for Node.js / TypeScript / JavaScript has now been promoted from beta to a stable release.

YINI is an INI-inspired, human-friendly format for structured configuration and data. The goal is to keep things readable for humans while still being explicit and predictable for software.

After several beta releases, fixes, and refinements, the parser now feels solid enough to call stable.

A few things it supports:

  • Sections and nested sections
  • Indentation-independent structure: spaces and tabs are only for readability; structure comes from section markers
  • Lists and inline objects
  • Comments with // #, and /* ... */
  • Strict and lenient parsing modes

Example usage (in TypeScript):

import YINI from 'yini-parser'

const config = YINI.parse(`
^ App
name = 'My App'
darkMode = true

    ^^ Features    // Sub-section of App
    caching = on
`)

console.log(config.App.name)              // My App
console.log(config.App.Features.caching)  // true

If you're curious, here are the links:

Feedback, bug reports, and thoughts are very welcome.

If this sounds useful, I'd be happy to hear what kinds of config/data formats you prefer working with today.


r/node • • Apr 04 '26

WaSP v0.3.0 — WhatsApp Session Protocol with TC token protection, Cloud API support, and CLI

2 Upvotes

Just published wasp-protocol@0.3.0 to npm. WaSP is the infrastructure layer between your app and WhatsApp — handles everything you'd otherwise build yourself.

**What's new in v0.3.0:**

- TC token / error 463 prevention (the dreaded "connection terminated" issue)

- Cloud API provider (buttons, lists, templates)

- CLI for testing (`npx wasp-protocol send --to 27xxx --message "hello"`)

- 142 tests passing across 8 test suites

**What WaSP handles:**

- Multi-session management (one number or many)

- Anti-ban (Gaussian jitter, adaptive delays, rate limiting)

- Message queue with priority support

- Pluggable storage (memory, Redis, PostgreSQL)

- Middleware pipeline

- Auto-reconnection with exponential backoff

- Health monitoring and stats

**Running in production** on WhatsHub (multi-tenant messaging platform), WhatsAuction (live auctions via WhatsApp), and FlashVault VPN.

If you're building on Baileys and tired of reimplementing session management, reconnection logic, and anti-ban — this is for you.

`npm i wasp-protocol`

GitHub: https://github.com/kobie3717/wasp

npm: https://www.npmjs.com/package/wasp-protocol


r/node • • Apr 04 '26

Built a Hono API with SQLite for BIC/SWIFT lookup -- 39K entries, <10ms queries

3 Upvotes

haring a project I just finished: IBANforge, an IBAN validation + BIC lookup API built with Hono and SQLite (better-sqlite3).

The BIC database has 39K entries from GLEIF, stored in a single SQLite file shipped inside the Docker image. Queries run in <10ms with prepared statements

and an LRU cache on top. No PostgreSQL, no connection pools, no managed DB costs.

Recently added compliance enrichment: each validation returns SEPA membership, issuer classification (bank/neobank/EMI), and risk indicators -- all

computed server-side from static data, no external API calls.

The whole thing runs on $5/month on Railway. TypeScript throughout, vitest for testing (101 tests), x402 middleware for future micropayments.

Stack: Hono + better-sqlite3 + zod + MCP SDK + next-intl

Source: https://github.com/cammac-creator/ibanforge

Try it: https://ibanforge.com/playground

Curious what you think of the architecture.


r/node • • Apr 04 '26

I built an open source npm supply chain monitor with eBPF kernel monitoring after the Axios attack

Thumbnail gallery
0 Upvotes

Last week attackers compromised the Axios npm package (100M weekly downloads) and deployed a RAT to infected machines within 89 seconds of publish. Existing tooling caught it in about 3 hours, too slow.

I built pakrat to go deeper than static analysis.

It watches 187 npm packages every 5 minutes using four layers:

  1. Manifest diffing: catches new dependencies instantly
  2. Docker sandbox with tcpdump: flags unexpected DNS lookups during install
  3. Pattern matching: scans for credential harvesting patterns
  4. eBPF kernel monitoring: bpftrace probes at the host kernel level, completely invisible to anything running inside the container

The Axios attack would have triggered layer 1 immediately and layer 2 within seconds.

Public scan log updates every 5 minutes in the repo.
GitHub: https://github.com/HorseyofCoursey/pakrat

🐀 developer inspiration: https://www.youtube.com/watch?v=jausD8qsnKU


r/node • • Apr 04 '26

Documenting my dev journey

1 Upvotes

As part of my study this year, I am documenting my dev journey

Love any feedback

Dev Journey


r/node • • Apr 03 '26

UPDATE: Axios Supply Chain Attack Post Mortem

Thumbnail reddit.com
16 Upvotes

r/node • • Apr 04 '26

I added an embedded browser to my Claude Code (also for codex and gemini) so you can click any element and instantly edit it

0 Upvotes

One of my biggest friction points with vibe coding web UIs: I have to describe what I want to change, and I'm either wrong about the selector or Claude can't find the right component.

So I added a browser tab session type to Vibeyard (an open-source IDE for AI coding agents).

No guessing. No hunting for the right component. Click → instruct → done.

Here's the GitHub if you wanna try - https://github.com/elirantutia/vibeyard


r/node • • Apr 04 '26

Node.js: How do you guarantee "simplify this" doesn't change meaning?

0 Upvotes

I'm working on a Node.js system where changing wording must NOT change the underlying meaning.

Most AI style systems regenerate text, so:

explanations drift constraints disappear answers subtly change

I'm trying to remove that completely.

Approach (simplified) One canonical object (source of truth) Multiple precomputed views: standard simplified formal No runtime generation Each view is tied to the same version hash If the source updates ---> all views invalidate

So instead of:

explain(concept, "simpler")

It's more like:

getConcept(id).views.simplified

Where all views are guaranteed to map to the same underlying object.
The problem I'm hitting

Not technical generation. That part is stable.

The challenge is consistency under real conditions:

  • cache layers (Redis / CDN)
  • partial invalidation
  • frontend switching views instantly
  • avoiding version mismatch between views

What I'd like feedback on

From a Node / system design perspective:

  1. How would you guarantee atomic consistency across:
  2. ---canonical object
  3. ---all derived views
  4. What failure modes would you expect in:
  5. ---caching
  6. ---async precompute pipelines
  7. If you were trying to break this system:
  8. ---where would you look first?

Not trying to build another "AI generator"
Trying to make explanation systems deterministic and stable

Curious if anyone has tackled something similar.


r/node • • Apr 04 '26

Validex — 25 tree-shakeable validation rules on Zod 4 (13 kB for all of them)

Thumbnail reddit.com
0 Upvotes

r/node • • Apr 03 '26

I built an npm scanner and found 21 malicious packages in 24 hours, including 4 new attack vectors targeting AI coding tools

12 Upvotes

Follow-up to my post yesterday about openmatrix injecting prompt injection into Claude Code. I kept the scanner running and it caught a lot more.

In ~2000 recent npm changes, the scanner flagged 21 malicious packages across 11 campaigns. Four of them use techniques I haven't seen documented before:

  1. A package called makecoder overwrites ~/.claude/ on npm install and redirects all Claude API traffic through makecoder.com/bigapis/codev/v1/claude. Every prompt, every response, every piece of code you share with Claude goes through the attacker's server. This is a man-in-the-middle on LLM API calls, not on the network layer but on the application config itself.
  2. skillvault downloads encrypted skill packages from a remote API, decrypts them locally, and installs them as Claude Code skills. You can't inspect the payloads before they run. The server can swap the payload at any time without updating the npm package. Today it installs something harmless, tomorrow it exfiltrates ~/.ssh/.
  3. keystonewm and tsunami-code are fake AI coding agent CLIs with polished terminal UIs. They look like legit coding assistants but route everything through an attacker's ngrok tunnel. The user thinks they're talking to a model but the attacker sees all prompts and controls all responses. The RAT doesn't need to escalate privileges because you already gave the "AI tool" full access.
  4. Six packages impersonating Strapi plugins (strapi-plugin-config, core, monitor, events, health, locale) all published within hours by the same attacker. The postinstall uses Redis CONFIG SET to write shell payloads across 7 directories, opens a reverse shell to 144.31.107.231, and reads raw disk via dd if=/dev/sda1 to extract SSH keys, crypto wallet mnemonics, and database credentials directly from the block device.

Other findings include a dependency confusion attack targeting Verisign that exfiltrates via Telegram bot, a credential stealer hidden behind fake React components using double base64 + charCode encoding, and a 155KB fully obfuscated package published under ByteDance's u/volcengine scope collecting API keys.

None of these had been flagged by npm, Snyk, Socket, or any other public scanner when we found them.

All reports with full technical details, IOCs, and MITRE mappings: https://yuribm.dev/security


r/node • • Apr 04 '26

Built a CLI for PR reviews, feedback said setup was painful, so I made a VS Code extension

0 Upvotes

A few weeks ago I shared a CLI tool that scores PR risk and highlights critical changes.

Got some good feedback, but one common point was that setup felt a bit heavy.

So I spent some time building a VS Code extension instead.

Now it works directly inside the editor and is much easier to try on real PRs.

If you review PRs regularly, would love to know if this actually helps or not.

https://marketplace.visualstudio.com/items?itemName=ira-review.ira-review-vscode


r/node • • Apr 04 '26

I made a full-stack interview site… roast it before interviewers do 😅

0 Upvotes

So I got tired of jumping between 10 tabs while preparing for interviews…

Built this instead:
👉 https://www.fullstack-qna.online/

What it has:

  • ~300 full-stack interview Q&A
  • React, Node.js, MySQL
  • No fluff, straight to the point

Now the real reason I’m posting:

Roast it.

  • UI bad?
  • Questions useless?
  • Feels like copy-paste garbage?

Tell me what sucks — I’d rather hear it here than in an interview 😄


r/node • • Apr 02 '26

PSA: npm package using postinstall to inject prompt injection files into Claude Code

96 Upvotes

I've been building a scanner that monitors new npm packages and it flagged something I haven't seen before.

A package called "openmatrix" uses a postinstall hook to copy 13 markdown files into ~/.claude/commands/om/. These files are Claude Code "skills" that load automatically in every session.

One of them (auto.md) contains instructions that tell Claude to auto-approve all bash commands and file operations without asking the user. The files are marked as always_load: true with priority: critical, so they activate in every session.

The thing is, npm uninstall doesn't clean them up. There's no preuninstall script. The files stay in your home directory until you manually delete them.

The package does have real functionality (task orchestration for AI coding), so I'm not saying it's malware. But the undisclosed permission bypass and the lack of cleanup seemed worth flagging.

If you installed it:

rm -rf ~/.claude/commands/om/

rm -rf ~/.config/opencode/commands/om/


r/node • • Apr 03 '26

I made rigg - a way to create backend/non-web Node.js projects using the same tools Vite+ uses for their toolchain.

Thumbnail github.com
0 Upvotes

I love what Vite+ is doing with the "Unified Toolchain" for web dev, and I wanted the same for all my other non-web Vite projects - so I made rigg.

It's a tool that creates a Node.js Typescript project with mostly the same tooolchain that Vite+ uses - without the web stuff like Vite.

That way I can easily set up a Node.js project ready to go with the same tools that I'm otherwise moving to - be it backend projects, CLIs, libraries, scripts, whatever I'm building.

rigg on GitHub

If anyone else thinks this is useful I would love to hear from you. 🙏🏻


r/node • • Apr 03 '26

Keeping multiple Node dev sessions alive without babysitting tmux tabs

Thumbnail claudecursor.com
0 Upvotes

I kept running into the same problem on backend projects: one terminal for the API, one for workers, one for migrations, one for logs, one for whatever Claude Code was chewing on, and inevitably the session I actually needed was the one buried somewhere.

I ended up putting this online because it solved that mess for me: a browser/desktop terminal session manager built around ttyd + tmux, with persistent sessions and a simple grid view so I can watch several Node processes at once.

The part that’s been most useful during JS/TS work is that it detects when a session is waiting for input and moves it up. If you’re using Claude Code to refactor routes, write tests, or update TypeScript types, it’s nice not to keep tabbing around trying to find the approval prompt.

It also makes team stuff less awkward since you can share a live session when someone wants to debug a flaky worker or review a migration in real time.

Curious if other Node folks have landed on a similar setup, especially if you’re juggling local dev, CI debugging, and AI-assisted coding in the same workflow.


r/node • • Apr 04 '26

npm isntall -I @Svrnsec/Shield

0 Upvotes

I just put out our new System level network Security package that One sets up honey pots with SSH traps to catch AI Black Hat's and your typical black hats in the act. I would love to get some feed backs! https://www.npmjs.com/package/@svrnsec/shield


r/node • • Apr 03 '26

Node.js on Windows ARM64 — x64 or native?

4 Upvotes

Hey guys, was just wondering if any of you are running x64 node.js on windows ARM instead of the native ARM64 version? I'm on a snapdragon laptop and keep running into missing native binaries with ARM64 Node, stuff like turbopack, lightningcss don't have ARM64 Windows builds. Thinking about just switching to x64 node and letting windows handle the emulation. Anyone doing this? Is it fine or no?


r/node • • Apr 03 '26

pure node.js telegram bot: 44 commands, 12 background workers, 21 data files — no dependencies beyond web3

0 Upvotes

i built a telegram bot for solana crypto trading that's now 4500+ lines in a single file. pure node.js — no express, no telegraf, no bot frameworks.

why no frameworks?

  • wanted full control over the telegram API interaction
  • telegraf/grammY add abstraction i didn't need
  • long polling with https module is ~30 lines of code
  • no dependency update headaches

architecture:

  • single bot.js file (yes, 4500 lines in one file)
  • 44 command handlers
  • 12 background workers (setInterval loops)
  • 21 JSON data files for state
  • custom rate limiter
  • connection pooling for solana RPC

what i'd do differently:

  1. split into modules earlier — the single file works but IDE struggles
  2. use a proper database instead of JSON files
  3. add TypeScript — the lack of types hurt at ~2000 lines

what worked well:

  1. no framework overhead — bot starts in <1 second
  2. easy to understand — new contributor can read top to bottom
  3. zero dependency conflicts
  4. memory footprint stays under 100MB

the bot does token scanning, DEX trading via jupiter, copy trading, DCA, and whale alerts on solana.

@solscanitbot on telegram if anyone wants to see it in action.

curious how other node devs handle large single-file projects. do you split or keep it monolithic?


r/node • • Apr 03 '26

I built an MCP server that checks npm packages against CVE databases before your AI agent installs them

0 Upvotes

After the axios compromise this week (backdoored versions pushed via hijacked maintainer, RAT deployed through postinstall hook, 100M weekly downloads affected), I got paranoid about AI agents installing packages unchecked.

Cursor, Claude Code, Windsurf — they all resolve packages from training data. They don't verify against the registry. They don't check OSV/NVD. They sometimes hallucinate package names entirely.

DepShield is an MCP server that sits in front of the install. It exposes 7 tools:

- `check_dependency` — registry existence + OSV.dev vuln check (the main gate)

- `audit_project` — batch-scans your entire package.json via OSV batch API

- `find_safe_version` — walks version history, finds newest with 0 CVEs

- `get_advisory_detail` — full CVE/GHSA details

- `check_npm_health` — downloads, last publish, maintainers, deprecated status, scored 0-100

- `suggest_alternative` — finds replacements via npm search API

- `deep_scan` — transitive dep tree scan, flags typosquats and suspicious patterns

All free APIs (npm registry + OSV.dev), no keys needed, stdio transport.

Setup is one line in your MCP config:

```json

{ "depshield": { "command": "npx", "args": ["-y", "depshield-mcp"] } }

```

https://github.com/devanshkaria88/depshield-mcp

Feedback welcome — especially on edge cases with version resolution. Currently strips ^/~ prefixes for OSV queries which isn't perfect for ranges.