r/nestjs • • 13h ago

Observe Pricing

4 Upvotes

Is anyone using nestjs observe? It seems the event count is too low for the price. Eg. Pro plan at 25M events per month will only provide 100 events per day for 10k users.

This will not even track one api at this rate. Are we doing something wrong?


r/nestjs • • 2d ago

First time using Nestjs in a production multi-tenant application.

10 Upvotes

For the first time I am using Nestjs and it is for multi-tenant application. The main issue is all the documents are written using AI even the APIs Endpoint Catalogue more that 200+ . The catch is that I have been asked to develop the APIs without a database just refering to an Sql Schema expecting AI will do everything. The Multi-tenant layer is not also there in the first place.

Expecting me to complete it within a week. And I am losing my mind. Pushing AI generate code that does not even make sense..How to navigate through by creating less error.


r/nestjs • • 3d ago

Added custom ws server support for graphql-ws subscriptions in @nestjs/graphql (v14.1.0)

1 Upvotes

Nest used to create the WebSocketServer for graphql-ws internally, so there was no way to set things like maxPayload, perMessageDeflate or verifyClient. The issue asking for this had been open since Feb 2023.

Since v14.1.0 you can pass your own:

import { WebSocketServer } from 'ws';

const wsServer = new WebSocketServer({
  noServer: true,
  path: '/subscriptions',
  maxPayload: 64 * 1024,
});

GraphQLModule.forRoot<ApolloDriverConfig>({
  driver: ApolloDriver,
  subscriptions: { 'graphql-ws': { server: wsServer } },
});

A few things to know:

  • It has to use noServer: true or Nest throws at startup.
  • Its path takes priority over the module path.
  • Nest closes it on shutdown, so use one server per GraphQL module.

One thing I learned in review: a path bug only showed up against a real ws server, so the tests don't mock ws anymore.

PR: https://github.com/nestjs/graphql/pull/4105


r/nestjs • • 4d ago

Has anyone encountered WebSocket connection issues with NestJS 12 when deploying to Vercel?

1 Upvotes

Hey everyone!

I'm currently building a small proof-of-concept (POC) application using WebSockets with NestJS, and I'm trying to host it on Vercel.

I'm using NestJS 12 with @nestjs/platform-socket.io, but I'm having trouble establishing a WebSocket connection when the application is deployed to Vercel. The connection simply fails.

Interestingly, I tried the same implementation using NestJS 11, and I didn't encounter this issue. The WebSocket connection works as expected.

Has anyone here encountered the same issue with NestJS 12 and Vercel? I'm wondering if there's something different in NestJS 12 that requires additional configuration for WebSocket connections.

I'd appreciate hearing about your experiences or any possible solutions.

Thanks!


r/nestjs • • 4d ago

Nest Workflows vs BullMQ vs Temporal

9 Upvotes

Hi everyone. In my NestJS app, I’ve been using BullMQ to schedule and asynchronously execute my jobs. There were some issues with everything not being fully type-safe from the docs back then so I had to create my own abstractions specific for our team here.

But I did face complications where I do need to save some state in my Postgres database, and BullMQ works with Redis. Plus we have external API’s we are using and we have to keep track of their state. Maintaining idempotency is kind of challenging.

With the v12 migration, we got new reliability solutions like Nest Workflows.

I read the docs and it seems more simpler or easier to work with.

I’ve also heard of alternative solutions to BullMQ like Temporal.

I do want to hear from everyone’s take on which one would be the best solution, or should I say, when should each one of them be used?


r/nestjs • • 6d ago

Any good learning Source?

2 Upvotes

Hello, I primarily work on mobile app development and use Golang for the backend. I am interested in learning NestJS, although I have never worked with the JavaScript ecosystem before. Could anyone please suggest some quality learning resources for JavaScript and subsequently NestJS? That would be very helpful.


r/nestjs • • 6d ago

Production-ready NestJS API guide: quality gates, observability, CI/CD, AWS

9 Upvotes

I'm working on a project where I put together a complete, detailed guide on how to build and deploy a project, using a simple NestJS API as an example. It's a todo list app, but built as if it were fully production-ready, the way strong companies do it. The goal is to collect all the best practices in one place, structure them, back them with code and personal experience, and turn them into a step-by-step guide: for example, how to set up quality gates, observability, CI/CD, deployment to AWS, and so on.

The first version is ready. If you're interested, please take a look and share your feedback and ideas for version 2: what should I change or improve?

I'm thinking of taking it towards high load:
- load testing, scaling
- maybe A/B tests, feature toggles, and expanding authentication (right now it's a stub)

What else would you recommend?

NestJS API: https://github.com/prod-forge/backend
Frontend (React + Expo): https://github.com/prod-forge/frontend
Infrastructure (Terraform): https://github.com/prod-forge/terraform


r/nestjs • • 8d ago

Production-Grade Fault Tolerance for TypeScript: Retry, Circuit Breaker, Timeout and Hedging

Post image
3 Upvotes

@ylcnfrht/resilience is an open-source resilience library for TypeScript. Retry, circuit breaker, timeout, fallback, hedging and rate limiting are composed into a single pipeline, following the Polly v8 API.

  • Typed errors: unhandled failure modes surface at compile time
  • Deadline propagation across nested calls
  • Integrations for fetch, axios, Express, Fastify, Koa, Hono and NestJS
  • Zero dependencies, from 4.1 KB; runs on Node.js, Bun, Deno, Workers and browsers

Docs: https://resilience.ferhatyalcin.dev

GitHub: https://github.com/ylcnfrht/resilience


r/nestjs • • 9d ago

Looking for a good project-based Node.js/Nest backend course

8 Upvotes

Hey everyone!

So I am a mobile developer with 4 years of experience, so I'm not starting completly from scratch

I'm looking for a practical, project-based course that focuses on building real-world backend applications from scratch to deployment, covering industry best practices.

I'd prefer something beyond beginner-level programming tutorials, with a focus on hands-on development rather than just theory.

Any recommendations based on personal experience? Paid courses are totally fine.

Thanks!


r/nestjs • • 11d ago

Stop passing req.user everywhere: I ported Spring Security's architecture to Express

Thumbnail reddit.com
2 Upvotes

r/nestjs • • 12d ago

Why I'm choosing a modular monolith instead of microservices for my next backend project

Thumbnail reddit.com
9 Upvotes

r/nestjs • • 13d ago

MikroORM Under Heavy Load in Complex Domains (300+ RPS/inst): >30% Event Loop Spent in ORM. Experience, Pitfalls, and Code Review

7 Upvotes

Hi everyone!

I’m looking for real-world experience using MikroORM under solid load. By "heavy load" in this context, I don’t mean trivial services with SELECT 1, but rather systems with complex domain logic (HRM / ERP / IAM) operating on entity graphs, with loads reaching 300+ RPS per single service instance.

The Problem

During load testing, I ran into noticeable overhead caused by the ORM itself. The profiler shows that >30% of the Event Loop time is consumed specifically by MikroORM.

Breakdown by components:

  • ~10% — QueryBuilder, QueryHelper, criteria node parsing;
  • ~10% — EntityManager, SQL driver, shared utilities, and platform type transformations;
  • ~6% — Entity instantiation, hydration, and relationship maintenance;
  • ~3% — The entire Unit of Work block, including Identity Map.

Initial Baseline / Rule-Outs

To eliminate obvious culprits:

  1. Logging: Completely disabled during load testing.
  2. OpenTelemetry: Sampling rate is set to 0.1 and configured so that dropped trace samples do not create unused spans.

As a result, under high RPS, Event Loop Utilization (ELU) and Event Loop lag start spiking rapidly. Even with optimal database performance and zero bottlenecks in the rest of the application code, the ORM overhead severely degrades overall request P99 latency.

Code & Architecture

You can inspect how the ORM is integrated into the service architecture in this repository: example service

I’d appreciate any constructive criticism, highlights of potential bottlenecks in my current usage of EntityManager / QueryBuilder, or advice from anyone who has tuned MikroORM for similar load profiles.

Thanks in advance!


r/nestjs • • 14d ago

Changes regarding the (unofficial) selfhosted nestjs observe version

12 Upvotes

A few days ago I posted this self-hosted collector for @nestjs/observe. The creator of NestJS and NestJS Observe reached out (issue #1) because the name could make people think it is an official project. The repo is now called https://github.com/MontejoJorge/unofficial-selfhosted-nestjs-observe

He also changed the license of the package @.nestjs/observe. Releases after 0.3.20 ship under the NestJS Observe Agent License, which only allows sending telemetry to NestJS Observe. That is his call, but i think its a shame, since earlier he said building your own integrations was fine and now its not allowed.

You can check the demo of my project here https://montejojorge.github.io/unofficial-selfhosted-nestjs-observe/

The latest changes includes the users and releases sections, and a storage page to view how much storage are using the logs, traces and requests of your apps.


r/nestjs • • 16d ago

To framework or not

7 Upvotes

I know rust Axum
Also Aspnet and nestJs

What do you think should i use full framework or barebones like axum

Knowing that we’re a startup and our projects mostly CRUDs

With Axum i gain control the code ,rust strong type system , modern, memory safety and compilation to machine code .
But suffering from no conversions and crates ( packages incompatibilities ) . Although I’m following clean architecture and MVC.

Frameworks like nest or asp you gain conversions testing, and compatibility but not machine code ( for dot net it feels old a bit , verbose and vendor locked for Microsoft to an extent )

Wdyt?


r/nestjs • • 17d ago

Best saas arhitecutre

0 Upvotes

Hey!

We're a small software agency planning a large SaaS platform for public institutions. We've talked to several developers and compared recommendations from different AI models, but we're still getting conflicting opinions on the best tech stack.

We're starting from scratch, with no preferred language or framework. Most development will be done using Claude Code and Codex, with us handling architecture, requirements, and reviews.

What we're building:

500–1,000 institutions (multi-tenant SaaS)

50–80 modules with thousands of features: document management, registries, requests, approvals, workflows, GIS, reporting, etc.

Around 100k public employees and potentially 20–100k citizens using the platform

Hundreds of dynamic forms, complex roles, permissions, and institution-specific configurations

PDF generation, electronic signatures, document archiving, and integrations with government/third-party APIs

A platform-wide AI assistant that can search documents, fill forms, generate files, and execute authorized actions

Web, Windows desktop, Android, and iOS

High availability, strong security, GDPR compliance, and long-term maintainability (10+ years)

Our main questions:

NestJS or FastAPI? Which would you choose for a large modular backend? Does TypeScript across the stack outweigh Python's ecosystem, considering the AI mostly uses external LLM APIs?

React or Angular? Which is better for 80+ modules, complex forms, dashboards, and long-term maintenance?

Mobile: Flutter, React Native, or something else? Ideally, we'd reuse as much code as possible.

Multi-tenancy: PostgreSQL shared schema + RLS, or a separate database per institution? Which scales and maintains better at 1,000 tenants?

Architecture: Modular monolith or microservices? How would you organize modules, dynamic forms, permissions, and external integrations?

AI: Would PostgreSQL + pgvector be enough for RAG and tool calling, or would you introduce a knowledge graph? How would you enforce permissions and prevent prompt injection?

API: REST + OpenAPI or GraphQL for third-party integrations?

AI-assisted coding: How would you structure a monorepo, CI, testing, and code reviews when most code is generated by Claude Code/Codex?

If you were starting this from zero today, what stack would you choose, and what would you avoid?

We're not chasing hype or benchmarks. We want something secure, reliable, scalable, and maintainable by a small team for the next 10+ years.

Would really appreciate advice from people who've built large enterprise or multi-tenant systems.


r/nestjs • • 17d ago

Laravel vs NestJS for a multi-tenant SaaS with AI agents and background jobs?

1 Upvotes

Hello everyone, I’m building a web app for service businesses. It combines CRM, projects, tasks, documents, invoicing, email and calendar. It also has an AI assistant that can take actions on a user’s behalf, with the same permissions and approval rules as the rest of the product.

The web app already runs on next.js and TypeScript, with Supabase for Postgres, auth and storage, and Inngest for background workflows. We’re still early in wiring the product to the database, so I’m weighing three paths for the backend:

* Keep next.js and enforce clearer boundaries around the backend code.
* Keep Next.js for the UI and move the backend into a dedicated NestJS service.
* Keep the React UI and build the backend in Laravel.

The backend needs to serve the web app, a future mobile app, integrations and the AI assistant. Background work includes email and calendar sync, document generation, imports and exports, scheduled reminders and workflows that may pause for approval. The requirements I care most about are workspace isolation, permissions, audit trails and safe retries. If a worker crashes halfway through sending a reminder, a retry shouldn’t send it twice.

Some of our implementation is AI-assisted with Claude Code and Codex. I’m looking for a setup that a small team can review, debug and maintain over several years.

For people who’ve operated something similar in production:

  1. When did a dedicated backend become worth it? What problems did it solve, and what did it add to your day-to-day operations?
  2. If you’ve used Laravel or NestJS on a multi-tenant product, where did its conventions help most? Where did you still need to build your own safeguards?
  3. How do you enforce tenant isolation for background jobs and integrations? What happens if a query forgets the workspace filter?
  4. What has held up for multi-step jobs, retries and approvals? I’d love to hear about failures you actually had to recover from.
  5. If you use AI coding tools heavily, which conventions or automated checks have caught the most mistakes?

Thank you 🙏🏻


r/nestjs • • 18d ago

NestJS DevTools v0.3.1 — A big update to my VS Code extension 🚀

3 Upvotes

Hey r/NestJS!

I previously shared NestJS DevTools, a VS Code extension I built to make everyday NestJS development faster.

I've been working on it quite a bit, and v0.3.1 brings some major improvements:

What's new?

  • 🩺 Provider Health: Detects unregistered Injectable() and
  • Controller() classes, reports problems, and offers quick fixes to register providers in the right module.
  • 🧭 Routes Explorer: Browse all your API endpoints in one place, grouped by controller, with HTTP methods, Swagger tags, and documentation coverage.
  • 💉 Dependency Injection Tools: Find provider usages, automatically inject providers into constructors, and jump to the module that provides them.
  • 📊 API Documentation Coverage: Find endpoints missing ApiOperation() and see your overall documentation coverage.
  • 📝 Smarter Logger: Context-aware log insertion, custom templates, and bulk log cleanup with a preview.
  • ⚡ File Generator 2.0: Generate any NestJS file type, create custom templates, and scaffold matching unit tests.
  • 🎯 Command Hub: Access all extension features from one searchable menu.

The idea is simple: Bring useful NestJS development tools directly into VS Code without extra dependencies, configuration, or changes to your application.

🔗 NestJS DevTools – VS Code Marketplace

I'd genuinely appreciate it if you gave it a try.

What NestJS development task do you think deserves better tooling inside VS Code? I'm actively working on the next release and would love to hear your suggestions.


r/nestjs • • 20d ago

Working on NestJS rules for AI coding agents, and I'd love to learn how you use them in production

7 Upvotes

Hi all,

I'm putting together a set of NestJS best-practice rules that AI coding agents (Claude Code, Cursor, Codex...) can load while working on a project. It's still a work in progress and I'm learning as I go, so I'd really value hearing from people who use NestJS professionally.

If you have a minute, I'd love to know:

- Do you use an AI agent on your NestJS code day to day? Which one, and for what kind of tasks?

- Do you give it any project guidance (AGENTS.md, CLAUDE.md, Cursor rules, skills)? What has actually been useful?

- What does it get wrong most often on NestJS? Things I keep correcting are circular module imports, accidental request-scoped providers and missing validation.

- Is there a convention or pattern from your own production experience that you'd want an agent to always follow?

The project is open source (MIT) and I'm the one building it, in case you want to look at what I have so far: MattiaValerio/nest-skills.
It has 40 rules for now. Any suggestion, correction or "this rule is wrong because..." would help a lot, and I'm happy to credit anyone who contributes.

Thanks for reading!


r/nestjs • • 21d ago

I made a Hono adapter for Nest, on Bun it's ~17% faster than the new platform-node

11 Upvotes

been running nest on bun for rigtch.fm, and the express/fastify adapters there go through bun's node:http compat layer, so i wrote `@mnigos/platform-hono`. it serves nest from Bun.serve on bun and `@hono/node-server` on node, works with nest 11 and 12. on the same hello world benchmark nest used for the platform-node launch (wrk -t4 -c100, nest 12.3.2 for every adapter, M4) it does 141k req/s on bun vs 121k for platform-node on bun. on node it's about fastify level, the gains are on bun

not supported yet: nest versioning, views and express/fastify style `@Res()` calls. if something breaks in your app open an issue https://github.com/Mnigos/platform-hono


r/nestjs • • 23d ago

File structure for monolithic microservices (nx workspace)

Thumbnail reddit.com
0 Upvotes

r/nestjs • • 24d ago

NestJS Devtools

11 Upvotes

Hey everyone,
I made a VS Code extension for NestJS developers to make everyday development faster and easier.

NestJS DevTools includes:

Smart Logger: Quickly insert debug, log, warn, error, and verbose statements with automatic class names.

Module Navigation: Browse your NestJS modules and quickly jump between services, controllers, DTOs, entities, and other files.

File Generator: Generate NestJS boilerplate files with the correct naming conventions and imports.

Method Search: Quickly find and navigate between methods and API routes in your files.

I originally built it to improve my own workflow, and thought other NestJS developers might find it useful too.
I’d love to hear your feedback, suggestions, or ideas for future features!
🔗 NestJS DevTools – VS Code Marketplace


r/nestjs • • 24d ago

Node.js 26 LTS

11 Upvotes

What does the Node.js 26 move to LTS mean for Nest.js?

Will appreciate, if someone could provide an overview / what to expect in Nest


r/nestjs • • 25d ago

Made (AI did) a selfosted version of nestjs observe dashboard.

28 Upvotes

Here is the repo so you can try it! https://github.com/MontejoJorge/selfhosted-nestjs-observe

Works with the @nestjs/observe pacakge.


r/nestjs • • 27d ago

Typed WebSocket gateways for NestJS, with AsyncAPI docs and a generated client

14 Upvotes

Hi all, I want to share a NestJS integration for a WebSocket framework I built, chanx-js. It gives you gateways where every message is typed and validated, documented as AsyncAPI, and the frontend client is generated from those docs.

What pushed me to build it: with @WebSocketGateway I still had to write the client types by hand, there were no docs for the messages, and broadcasting across several instances needed extra setup.

What it gives you:

  • Payloads validated before your handler runs, with Zod, Valibot, ArkType or class-validator DTOs
  • AsyncAPI 3 docs generated from your gateways, served at /asyncapi
  • A typed client generated from those docs, with React, Vue, Svelte and Solid bindings, so a wrong payload fails to compile on the frontend
  • Broadcasts across instances through Redis, and an injectable ChanxService to push to users from any service, controller or queue worker
  • Topics like room:lobby, many of them over one socket
  • Test helpers to send, receive and capture broadcasts

A gateway looks like this:

It's a normal injectable class, so guards, interceptors, pipes and exception filters work as you'd expect. It runs on both Express and Fastify.

Repo: https://github.com/chanx-dev/chanx-js

NestJS guide: https://js.chanx.dev/server/integrations/nestjs

It's still new, so if anything doesn't fit the way you structure Nest apps, please open an issue or a discussion. Stars and PRs are welcome too.