r/node • u/talaqen • Feb 23 '26
r/node • u/Ambitious-Garbage-73 • Apr 04 '26
I spent a week reading through AI-generated code that's been in production for 8 months. It was fine. That was the problem.
Got asked to do a security audit on a mid-size Node.js backend. The team had been using Cursor + Claude heavily since last summer. About 60% of the codebase was AI-assisted or fully AI-generated.
The code passed every check. No injection vulnerabilities, no obvious race conditions, decent error handling. Tests covered 78% of branches. On paper, it was fine.
Then I spent a week actually reading it.
Every function did exactly what it was supposed to do. Nothing more. There was no shared understanding of why things were structured the way they were. Comments explained what the code did, not why. Functions that obviously belonged together were scattered across unrelated files because that's how the AI generated them in separate sessions. The auth middleware was written three different ways in three different places, all slightly different, all working.
When I asked the team why they used JWT with a 7-day expiration for a fintech product, nobody knew. When I asked why the rate limiter was applied at the route level instead of the middleware level, nobody knew. When I asked about the retry logic in the payment service that would retry a failed charge up to 5 times with exponential backoff, nobody had thought about what happens if the first charge actually went through but the confirmation was dropped.
The AI never told them any of these decisions were happening. It just made them.
I want to be careful here because I don't think AI coding tools are bad. I use them constantly. But there's a specific failure mode I keep seeing where teams move fast, the code works, nothing breaks, and six months later nobody on the team can answer basic architectural questions about their own system.
The AI didn't write bad code. It wrote code that nobody understood, and the code was good enough that nobody had a reason to understand it.
That's a different kind of risk than a bug.
Anyone else auditing or inheriting AI-generated codebases and finding this pattern? Curious if there are approaches that actually help teams maintain architectural understanding when AI is writing most of the implementation.
r/node • u/Crescitaly • Mar 02 '26
After 2 years of solo Node.js in production, here are the patterns I swear by and the ones I abandoned.
Running a Node.js monolith in production for 2+ years as the only developer. 15K+ users, ~200 req/s at peak. Here's what actually matters:
Patterns I swear by:
1. Centralized error handling middleware Every Express route wraps async handlers with a single error catcher. No try/catch in every route. One place to log, one place to format error responses.
2. Request validation at the edge Joi/Zod validation on every incoming request before it touches any business logic. The number of bugs this prevents is insane.
3. Structured logging from day 1 Winston with JSON format, correlation IDs on every request. When something breaks at 3 AM, structured logs are the difference between debugging in 5 minutes vs 2 hours.
4. Database connection pooling with health checks Mongoose with proper poolSize, heartbeat interval, and reconnection logic. Had a 4-hour outage early on because I used default connection settings.
5. Rate limiting per endpoint, not just globally Some endpoints (auth, payments) get strict limits. Others (reads) are more permissive. One global rate limit is too blunt.
6. Graceful shutdown handling SIGTERM handler that stops accepting new connections, finishes in-flight requests, closes DB connections, then exits. Prevents data corruption during deploys.
Patterns I abandoned:
1. Microservices Built 4 separate services for 50 users. Debugging was a nightmare. Consolidated back to a monolith. Night and day difference in velocity.
2. GraphQL For my use case (mostly CRUD with simple relationships), REST was simpler and faster to develop. GraphQL added complexity with no real benefit at my scale.
3. Event-driven architecture with message queues Used RabbitMQ for async processing. Replaced it with simple cron jobs on Lambda. 90% of "async processing" needs are just scheduled tasks.
4. Clustering with PM2 Switched to a single process behind an ALB. Node handles concurrent requests fine with async I/O. PM2 clustering added complexity for minimal benefit at my traffic level.
5. ORM-heavy patterns Started with Sequelize, moved to raw MongoDB queries. For simple CRUD, native drivers are faster and easier to debug.
The biggest insight: complexity is the real enemy when you're solo. Every abstraction layer you add is another thing to debug at 3 AM when things break.
What Node.js patterns have you found essential vs overhyped?
r/node • u/EquivalentGuitar7140 • Mar 01 '26
After building 30+ Node.js microservices, here are the mistakes I wish I'd learned earlier
I've been building production Node.js services for about 6 years now, mostly multi-tenant SaaS platforms handling real traffic. Some of these mistakes cost me weekends, some cost the company money. Sharing so you don't repeat them.
**1. Not treating graceful shutdown as a day-1 requirement**
This one bit me hard. Your Node process gets a SIGTERM from K8s/ECS/Docker, and if you're not handling it properly, you're dropping in-flight requests. Every service should have a shutdown handler that stops accepting new connections, finishes current requests, closes DB pools, and then exits. I lost a full day debugging "random 502s during deploys" before realizing this.
**2. Using default connection pool settings for everything**
Postgres, Redis, HTTP clients -- they all have connection pools with defaults that are wrong for production. The default pg pool size of 10 is fine for a single instance, but when you're running 20 replicas, that's 200 connections hitting your database. We hit Postgres max_connections limits during a traffic spike because nobody thought about pool math.
**3. Catching errors at the wrong level**
Early on I'd wrap individual DB calls in try/catch. Now I use a layered error handling strategy: domain errors bubble up as typed errors, infrastructure errors get caught at the middleware/handler level, and unhandled rejections get caught by a global handler that logs + alerts. Way less code, way fewer swallowed errors.
**4. Building "shared libraries" too early**
Every team I've been on has tried to build a shared npm package for common utilities. It always becomes a bottleneck. Now I follow the rule: copy-paste until you've copied the same code 3+ times across 3+ services, THEN extract it. Premature abstraction in microservices is worse than duplication.
**5. Not load testing the actual deployment, just the code**
Your code handles 5k req/s on your laptop. Great. But in production, you've got a load balancer, container networking, sidecar proxies, and DNS resolution in the mix. Always load test the full stack, not just the application layer.
What are your worst Node.js production mistakes? Curious what others have learned the hard way.
r/node • u/TheFlyingPot • Mar 03 '26
I built <tool name> — a modern, <tech stack>-first <what it does> for Node.js
Hey r/node! 👋
I have been building <tool name> — a <what it does> for Node.js, and I'm excited to share it more broadly.
If you've ever reached for <competitor>, <another competitor>, or <another competitor> and wished the DX was a bit more modern and TypeScript-native, <tool name> might be for you.
<tool name> is a scalable, production-ready <what it does> built with TypeScript from the ground up. It's designed to be simple to get started with, but powerful enough for serious workloads.
We'd love feedback, contributions, and honest criticism. Drop a ⭐ if you find it useful, and feel free to open an issue or start a discussion!
<no GH link>
----------
Done. Now all you vibe coding bots can use the template. It will be easier for us to identify you and not waste any more time reading your slop.
Seriously though, it's always this. I am getting kinda tired of all this spam.
Mods, what if we wrote an AI bot to automatically identify other bots and stop this nonsense?
r/node • u/indutny • Mar 18 '26
A petition to disallow acceptance of LLM assisted Pull Requests in Node.js core
Hello everyone!
Some of you may remember me for my work on Node.js core (and [io.js drama](https://en.wikipedia.org/wiki/Node.js#Io.js)), but if not I hope that this petition resonates with you as much as it does with me.
I've opened it in response to a 19k LoC LLM-generated PR that was trying to land into Node.js Core. The PR merge is blocked for now over the objections that I raised, but there is going to be a Technical Steering Committee vote in two weeks where its fate is going to be decided.
I know that many of us use LLM for research and development, but I firmly believe that the critical infrastructure the Node.js is is not the place for such changes (and especially not at the scale where it changes most of the FS internals for the sake of a new feature).
I'd love to see your signatures there even if you never contributed to Node.js. The only requirement is caring about it!
(Also happy to answer any questions!)
r/node • u/Minimum-Ad7352 • Aug 15 '26
Why is JavaScript criticized so much for backend development?
I've seen some developers say that we should stop using js on the server, but I rarely see the same criticism directed at python.Honestly, js is pretty fast, especially with node.js, and the backend ecosystem is really solid. There are great frameworks like nest and fastify, and typescript gives you static typing, which makes larger projects much easier to maintain.I'm not saying node is perfect or the best choice for every backend, but I don't really understand why js gets so much criticism while python seems to get a pass.What am I missing?
r/node • u/yojimbo_beta • Jan 30 '26
I need you to understand that if your library was vibe coded, there's almost no benefit to me using it, versus just generating my own copy
Nearly every library submission on r/node is some LLM generated thing, with weird design and bad decisions
By definition, if it was that low effort to produce, your library has no moat, no USP. I'm getting all the disadvantages of an AI coded library, plus all the disadvantages of a vibe coder's crappy tastes and weak knowledge
r/node
•
u/GhostLexly
•
Oct 10 '26
God damnit, no stability
Bun acquired by Anthropic and rewritten by AI
Deno acquired by Cloudflare
Prisma had a huge breaking change (again) on prisma 8 and rewritten by AI
NextJS Pages Router -> App Router breaking change and “use client”, “use server”
NestJS v12 changed all the tooling/bundler and let’s hope the main maintainer Kamil stay alive the next 10 years
PassportJS dead
TypeORM dead
How anyone can maintain a big project without rewriting it every 2 weeks or trust any JS open source project for the long term ? 🤪
r/node • u/Minimum-Ad7352 • Feb 27 '26
Postgres for everything, how accurate is this picture in your opinion?
For those interested Image from the book "Just use postgres"
r/node
•
u/Some_Routine_6107
•
Jun 29 '26
Reached ~192 Stars! Built a Terminal Torrent client that searches every trusted source at once and downloads straight to disk
Finding a torrent in 2026 sucks. One site is a minefield of fake download buttons. Another hides the real link under a popup that spawns two more tabs. And after all that, half the results are dead with zero seeders.
So I built the opposite. torlink lives in your terminal: you type a query, it hits a curated set of trackers all at once, and the results stream back tagged with source, size, and seeders as fast as each site answers. Arrow to the one you want, press d, and it lands on your drive. No browser and no setup.
The whole thing is one command:
npx torlnkThat's it, all you need is Node. (The npm name is torlnk; torlink was too close to an existing package, so the spare "i" had to go.)
What you get
One search across FitGirl, YTS, EZTV, Nyaa, SubsPlease, and SolidTorrents at once, with results streaming in and staying sorted as each source answers. If one is down it keeps going and tells you which.
Press
dto grab. Queue up as many as you want; they download in the background and pick up where they left off if you quit mid-transfer.It seeds by default once a download finishes, and you can turn that off per item. Torrenting only works when people give back.
A clean keyboard-driven TUI: one footer line, a
?cheatsheet, and that is the whole surface. Nothing leaves your machine except the request to the torrent network.
My favorite way to use it right now is loading up on games to try out this summer. One search, a couple of keystrokes, and a whole stack of them is downloading in the background.
On games: games are the only category that can actually run code, so those come from FitGirl alone, a repacker with a long, well-known track record. Everything else is plain video and subtitles from sources like YTS, EZTV, and Nyaa.
MIT and open source. Open to feedback and source suggestions, and a star is appreciated if you find it useful.
Source Code: https://github.com/baairon/torlink
Showcase Video: torlink showcase on YouTube
r/node • u/Nice_Pen_8054 • Dec 13 '25
Why NodeJS is not considered "enterprise" like C# / ASP .NET?
Hello,
A lot of famous websites like Netflix, Notion and apps like Slack, Discord use NodeJS for back end.
Why NodeJS is not considered "enterprise" like C# / ASP .NET?
In the next years, it might be possible?
r/node
•
u/m_null_
•
May 11 '26
NodeBook Volume I is done now!
Hi r/node,
I've (finally) finished Volume I of NodeBook - 46 chapters. This took way more time than I thought it would.
For those who haven't read it yet - it covers the lower-level Node stuff, and everything you'd need to know to become a better backend dev (or even build libraries using node). If you're using other runtimes, like Bun/Deno, you'll still learn a lot about backend development. Give it a go.
It's not for beginners. You should at-least know Javascript and somewhat comfortable with node ecosystem.
There are tons of beginner level tutorials for Node out there, many good, many bad, but they're there. If you are new, you can still read it, but it assumes you have written some Node before. My recommendation is to go through some beginner level Node tutorial, build a couple of dummy scripts, and you'll be good to go.
The chapters are public here: https://www.thenodebook.com
The book will forever stay free online. I have some plans for a digital edition, probably by the end of next month.
GitHub repo: https://github.com/ishtms/nodebook
r/node • u/jaredcasner • Mar 31 '26
Axios 1.14.1 compromised
https://news.ycombinator.com/item?id=47581837
Make sure to pin to 1.14.0
r/node • u/Minimum-Ad7352 • Jun 09 '26
Databases Might Be the Most Important Backend Skill
The longer I work in backend development, the more I think databases are the area worth studying the deepest. Languages, frameworks, and architectural trends come and go, but almost every backend system ultimately depends on how data is stored, queried, and managed. Understanding raw SQL is important, but so is learning indexing, query optimization, transactions, locking, schema design, normalization, denormalization, data modeling, partitioning, replication, and consistency trade-offs. I've noticed that many performance, scalability, and reliability problems often lead back to database decisions made early in a project. In contrast, a well-designed database can make the rest of the system significantly simpler. If a backend developer had limited time to become an expert in just one area, databases would be a strong candidate. Curious whether others feel the same or would choose something different.
r/node • u/awaitVibes • Dec 27 '25
11 YoE, NSBV is my go to stack.
After 11 years in the industry, Node.js, SQLite and Bash (for automation/deployments) hosted on a single VPS is my go to stack.
Arguments for:
You can get a LOT of mileage out of vertical scaling.
Automated testing with SQLite is a dream. You can spin up and tear down hundreds or thousands of in memory database instances in under a second.
Extremely low hosting costs.
In my experience, most VPSs have > 99.8% uptime.
A simple, comprehensible stack that can run locally = improved velocity and DX.
Less infrastructure = lower risk of making a blunder and having a security misconfiguration. Not to mention less time creating, testing and maintaining infrastructure.
Having no requirement for horizontal scalability simplifies implementation a great deal.
Your bash scripts and database queries will still work in 20 years.
I could go on...
Optional, useful add-ons:
S3 (or alternative) for assets & things like DB backups (2 lines of bash).
CDN for improved asset load times.
Separate VPS running Grafana/Loki.
"BUT THIS WON'T SCALE!"
If the magic day comes where you have thousands of concurrent users, and after exhausting caching and optimisation possibilities, NSBV can no longer keep up, congratulations! You have a successful product, and with it, revenue, business buy-in or an easy journey to raising venture capital. THIS is the time to start investing into horizontal scalability.
"WHAT IF THE SERVER GOES DOWN!"
Calculate the cost of ~30 minutes of downtime. Now compare it to the cost of hiring (arbitrarily) 2.5 more engineers to compensate for the lost velocity of a complex architecture and extra SRE overhead. Unless you're building something seriously important, the likelihood is that downtime is an optimal outcome, and good value for money.
Keen to hear your thoughts, if anyone can think of a better name than NSBV, and if anyone would find a template repo useful.
r/node • u/HexLayer3 • Oct 26 '26
PHP had to scramble last week - now it is Node's turn. Node2Shell, or Broccoli2Shell if you’re feeling leafy - RCE works in lab conditions.
It’s got three names already - Node2Shell, HTTP2Shell, Broccoli2Shell - because of course it does. Whatever you call it, same compression bug, different runtime: PHP patched its pre-auth RCE wave last week, this is ours.
This one is quite less theoretical than PHP2Shell - PoC is working in the lab against Node 24.22.0 on x86-64, shell returned as the service account.
Meanwhile a scanner is already out there fingerprinting which hosts decompress Brotli - building the hit list before the exploit goes wide.
Patch to 22.23.4 / 24.22.1 / 26.12.1.
r/node • u/der_gopher • 17d ago
The future of Software Engineering is boring
r/node • u/Fun_Can_6448 • Mar 31 '26
30-second setup to avoid being impacted by supply chain attacks like the axios compromise
The axios attack (hijacked maintainer → malicious versions 1.14.1 & 0.30.4 → RAT payload) was live for ~2-3 hours before npm pulled it. Most supply chain attacks follow this same pattern — they rely on people installing before anyone notices.
All major package managers now let you delay installing freshly published versions. One config line, set it globally, and you're covered:
npm .npmrc
min-release-age=7pnpm pnpm-workspace.yaml
minimumReleaseAge: 10080bun bunfig.toml
minimumReleaseAge = 10080Not a silver bullet, but for the "publish and pray" type of attack - which is most of them - this is the easiest win you'll ever get.