/r/node

Photograph via //r/node

/r/node

296,671 Subscribers

9

Do you use Node.js more for SSR or as a Server API?

I’m curious to hear how most developers are using Node.js in 2025. Do you primarily use it for server-side rendering (SSR) with something like Next.js, or do you treat it more as a server API (no views) to power frontends built with frameworks like React, Vue, or Svelte?

Personally, I’ve been leaning more toward using Node.js as a backend API, but I know SSR has its advantages, especially for SEO and initial load times. Would love to hear what others are doing—what’s your approach, and why?

16 Comments
2025/02/04
06:52 UTC

1

Implementing clerk for protected routes

I have a react + express app written in typescript. I’m new to using clerk and have successfully set it up on the frontend. However, I have a protected route wrapped in a Provider that calls a request to the backend to see if the user is authenticated. I’m using the requireAuth() middleware that clerk provides, but I keep getting hit with a cors error.

From my knowledge cors is already set up correctly using app.use(cors({credentials: true, origin: http://localhost:5137})).

Have anyone ran into a similar issue before? Can provide code upon request.

1 Comment
2025/02/03
18:29 UTC

6

RPC like alternatives to tRPC?

Self explanatory, recently I started to use ts-rest, which ones do you like ?

12 Comments
2025/02/03
18:20 UTC

0

serving static files with Express.js.

im running into an issue where my React app isn't displaying correctly when using express.static() to serve the build files. Only the CSS (like the background color) is loading, but none of the HTML elements are showing up.

My github repo : https://github.com/Tisiaka1/Debugg.git

1 Comment
2025/02/03
18:11 UTC

1

Node Mailer Help

I created a website using React for my mom's business and it has a contact us at the bottom where people can enter their name, email, and message and Node Mailer sends the message to a business email. It worked but it is not working anymore. When I tried doing some research on Google, this is what I found

"Starting January 2025, less secure apps, third-party apps, or devices that have you sign in with only your username and password will no longer be supported for Google Workspace accounts. For exact dates, visit Google Workspace Updates. To continue to use a specific app with your Google Account, you’ll need to use a more secure type of access that doesn’t share password data. Learn how to use Sign in with Google."

How can I fix this issue or is there a better automated email system I can use instead of Node Mailer

2 Comments
2025/02/03
16:56 UTC

6

Hosting

I want to host my Node application in Monster ASP
where I can add ASP, Node and PHP applications
there is a little problem I don't know what is really happening
it says

Application has thrown an uncaught exception and is terminated: Error: Cannot find module 'on-finished' Require stack: - D:\Sites\site17233\wwwroot\node_modules\finalhandler\index.js - D:\Sites\site17233\wwwroot\node_modules\express\lib\application.js - D:\Sites\site17233\wwwroot\node_modules\express\lib\express.js - D:\Sites\site17233\wwwroot\node_modules\express\index.js - D:\Sites\site17233\wwwroot\index.js - C:\Program Files (x86\iisnode\interceptor.js at Module._resolveFilename (node:internal/modules/cjs/loader:1149:15) at Module._load (node:internal/modules/cjs/loader:990:27) at Module.require (node:internal/modules/cjs/loader:1237:19) at require (node:internal/modules/helpers:176:18) at Object.<anonymous> (D:\Sites\site17233\wwwroot\node_modules\finalhandler\index.js:17:18) at Module._compile (node:internal/modules/cjs/loader:1378:14) at Module._extensions..js (node:internal/modules/cjs/loader:1437:10) at Module.load (node:internal/modules/cjs/loader:1212:32) at Module._load (node:internal/modules/cjs/loader:1028:12) at Module.require (node:internal/modules/cjs/loader:1237:19))

where the application is running in my local machine and I hosted in Railway and everything was perfect. Any solution ?

Edit
if you want to host a node.js app using that service. You MUST upload node_modules and when I upload them they get corrupted so I uploaded them manually and the problem solved thanks everyone

9 Comments
2025/02/03
14:40 UTC

0

Looking for Cloud-Based GST Filing, E-Way Bill and E-Invoice Software (Source Code)

Hi all,

I'm looking for an India-based, cloud-based software (built with React preferred) that includes the following features:

  • GST Filing
  • E-Way Bill Generation
  • E-Invoice Creation

If you have a source code like this, please DM me with a demo and your pricing.

Thanks!

0 Comments
2025/02/03
12:01 UTC

1

Affordable SQL Server Hosting with RDP in the US – Recommendations?

Hey everyone,

I’m looking for recommendations on reliable and affordable hosting providers that offer Microsoft SQL Server hosting with Remote Desktop access (RDP) in the United States.

We are starting with a single server but plan to expand over time, so scalability is important. I’ve looked into AWS and Azure, but they seem quite expensive, so I’d love to hear about other cost-effective alternatives.

1 Comment
2025/02/03
08:14 UTC

1

RUST WASM or SQL Functions

I'm building a spreadsheet-like engine (100 sheets, 50-100 rows each) in my Node JS app, where cells can hold arbitrary math expressions referencing global variables (e.g., gh-1). When a variable changes, all dependent cells must recalc. Is SQL (stored procs/triggers) viable, or should I use Rust compiled to WASM for the expression engine? Thoughts?

2 Comments
2025/02/03
06:57 UTC

10

Question about shared dependencies in monorepos (pnpm workspaces)

I'm going to use an imaginary app client and library utils as examples here. Also assume there are no buildable/publishable libraries, all libraries are only used in apps.

I see that the official recommendation is to install dependencies (read: npm packages) to each individual package.json, so pnpm i --filter client react. However, I can't really find anything that talks about sharing dependencies amongst each other, so I'm asking for your opinions/best practices.

I use dayjs instead of vanilla Date. I also use Zod for runtime validation. These will be used in every package. Do I still install it in each individual package? When is it okay to put it in root package.json?

What about packages that are only directly referenced in utils? Let's say I download the uuid package, with utils having a function generateUUID() that references it. Do I now have to install uuid in every package that calls the function too? If so, doesn't dependency management become a nightmare?

5 Comments
2025/02/03
05:09 UTC

1

Using Nodemailer and Oauth2 on Publish mode...

So trying to set up nodemailer and I believe I should set it to publish mode since the refresh keys expire every 7 days otherwise in testing mode?

Anyways, seems like a huge PITA to get verified... anyone familiar with the process?

This is just for a simple 'contact us' form on a business page.

Like i got this:

You've configured your app in a way that requires verification . To complete verification, you will need to provide:

An official link to your app's Privacy Policy A YouTube video showing how you plan to use the Google user data you get from scopes A written explanation telling Google why you need access to sensitive and/or restricted user data All your domains verified in Google Search Console

Like ??? Privacy policy? Youtube video? what the heck.

3 Comments
2025/02/03
05:06 UTC

13

What's the best way to manage/organise a lot of custom scripts in my package.json file?

I writing out a lot of automated tests for specific pages and components. As such I have 40+ scripts in my `scripts:{}` object in pacakge.json.

I'm just curious if there was any established way of tidying these up? Eg: can I group similar scripts together on their own file and 'import' them into package.json?

When I try to Google this I only get information on how to tidy up all the scripts you get from `node_modules`, not how to organise custom scripts.

Many thanks in advance!

4 Comments
2025/02/03
00:41 UTC

0

Hono vs Elysia

3 Comments
2025/02/02
22:17 UTC

0

Does using Redis even make sense here?

Our application uses Redis to store customs ids (depending on multiple factors) on 5 different tables, we are not using it to store a whole response.
For example, we have items with custom Id that starts at 'I100', so when we want create 20 new items, we get the id from redis instaed of the db.

10 Comments
2025/02/02
21:36 UTC

0

[webpack-cli] Failed to load '/Users/user/Desktop/../berry_me/.erb/configs/webpack.config.renderer.dev.dll.ts' config

I am facing a pretty frustrating issue while trying to get this Electron template to run (it was running a few hours before).

Initially it said when I tried to do npm install

npm error Invalid property "node" 

which I hoped to fix by following this to this Stack Overflow Post.

But now it is showing this error, which I am out of my wits to solve. Please help, I need to work on a project and I can't even open the template. :-(

I have redacted my name from the paths.

[webpack-cli] Failed to load '/Users/./berry_me/.erb/configs/webpack.config.renderer.dev.dll.ts' config [webpack-cli] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/./berry_me/.erb/configs/webpack.config.base' imported from /Users/./berry_me/.erb/configs/webpack.config.renderer.dev.dll.ts     at finalizeResolution (node:internal/modules/esm/resolve:275:11)     at moduleResolve (node:internal/modules/esm/resolve:860:10)     at defaultResolve (node:internal/modules/esm/resolve:984:11)     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:719:12)     at #cachedDefaultResolve (node:internal/modules/esm/loader:643:25)     at #resolveAndMaybeBlockOnLoaderThread (node:internal/modules/esm/loader:678:38)     at ModuleLoader.resolveSync (node:internal/modules/esm/loader:701:52)     at #cachedResolveSync (node:internal/modules/esm/loader:662:25)     at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:390:50)     at new ModuleJobSync (node:internal/modules/esm/module_job:342:34) {   code: 'ERR_MODULE_NOT_FOUND',   url: 'file:///Users/./berry_me/.erb/configs/webpack.config.base' } npm error code 2 npm error path /Users/./berry_me npm error command failed npm error command sh -c ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll npm error A complete log of this run can be found in: /Users/./.npm/_logs/2025-02-02T17_36_27_573Z-debug-0.log
0 Comments
2025/02/02
17:46 UTC

1

I'm having issues with working with Lit in Express

I am trying to use Lit components in the backend, compile them, and return plain HTML, but it's not working. I am working with typescript files and using Node 23, no ts-node, my problem is that I get syntax errors, for example:

property () name         = "";  	\^    	SyntaxError: Invalid or unexpected token  	at compileSourceTextModule (node:internal/modules/esm/utils:338:16)  	at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:106:18)  	at ModuleLoader.<anonymous> (node:internal/modules/esm/translators:549:10)  	at #translate (node:internal/modules/esm/loader:470:12)  	at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:517:27)  	at async ModuleJob.\_link (node:internal/modules/esm/module\_job:115:19)

Node.js v23.6.0

This is my entire server.ts file

import express from "express";
import { html, LitElement } from "lit";
import { property } from "lit/decorators"
import { render } from "@lit-labs/ssr";
import { collectResult } from '@lit-labs/ssr/lib/render-result.js';

const app = express();

class MyComponent extends LitElement {
	@property() name: string = "";
	render() {
		return html"<div>Hello ${name} </div>";
	}
}

app.get("/", async (req, res) => {
	// Create an instance of your component
	const component = new MyComponent();

	// Render to string
	const ssrResult = render(component.render());
	const renderedHtml = await collectResult(ssrResult);

	return res.send(renderedHtml);
});

app.listen(3000, () => {
	console.log("listening on 3000");
});

Has any of you ever worked with this? I can't find a guide or anything that makes lit work in express
I had to replace the ` for this post to "

3 Comments
2025/02/02
16:12 UTC

6

Railway or Render for Cron jobs with storage

I am looking to host a scraper nodeJS script. Once every day it calls 20,000 API endpoints and should store the data (10kb per endpoint = 20mb per day = 10GB per year) in a SQL database. Cron job takes about 30 minutes - 1 hour per day. I would then like a frontend behind authentication where users can view this data.

Both Render and Railway support easy nodeJS cronjobs, but find it hard to compare them. Which one would cost me more? Which one would be best suited for my use case? Any other providers I should consider (I want easy deployment, not a VPS)?

6 Comments
2025/02/02
08:36 UTC

0

Access is denied when run the project

How can I solve this issue? I'm using IObit Malware Fighter antivirus, which usually blocks the project execution and notifies me. If I allow it, there's no issue. However, today, whenever I try to create a project, I'm getting this issue, and IObit doesn't notify me. Even when I disable the antivirus, I still get the same error. I've checked the file permissions, and everything seems fine.

https://preview.redd.it/wy0l5q5i3oge1.png?width=1199&format=png&auto=webp&s=bfdaa2e4602f524234458f23701812a44c5cdb8e

2 Comments
2025/02/02
06:12 UTC

31

We built an app that helps you improve your Node.js skills — looking for feedback 🚀

Hello Node.js experts,

My friend and I are building a free app to help users enhance their Node.js and JavaScript skills, and would like to see if it is useful for you.

What we've built:

  • Skill Trees: Visual guides to discover essential skills and concepts, specifically for JavaScript and Node.js developers.
  • Quizzes: Test your knowledge and identify gaps to improve your expertise in your focus areas.

You’re welcome to try it out — It’s 100% free:

👉 skill-up.io

👉 skill-up.io/skill/node-js

Skill tree and quizzes

If you like it, feel free to sign up to track your progress. All contents are free, and we’d appreciate it if let us know which feature is most useful to you:

  • Skill trees
  • Skill quizzes
  • Resources

We’d love to help you more! Let us know what you need and we’ll build it. You can reach out to us by joining our Discord server. Thank you.

8 Comments
2025/02/01
21:28 UTC

0

What’s next after Jonas’s Node.js course? Need project ideas for real experience!

Just finished Jonas’s Node.js course and looking for what to focus on next. I want to build more than just basic CRUD apps. Any suggestions on advanced topics, frameworks, or project ideas that will help me gain real-world experience?

Appreciate any advice!

8 Comments
2025/02/01
18:34 UTC

0

AI driven code reviews, built by nodejs.

Couscous is a VS Code extension that uses AI to analyze your code quality against best practices and team conventions, you configure. It safes lots of time for senior engineers who see repeated mistakes in code reviews.

  1. Define conventions and best practices.
  2. Click ctrl/cmd +1.
  3. Watch couscous show you confirmations or violations.

Features

🧠 AI-powered code analysis using Deepseek or OpenAI models ( support for local is coming )

🥣 Couscous icon for compliant files (score > 70%)

💩 icon for code lines needing improvement

🔍 Inline violation highlighting

💡 AI-generated improvement suggestions

✅ Quick-fix code actions

✅ Programming languages agnostic

Demo Link:

https://www.youtube.com/watch?v=FTv8iDcKs1M

GitHub repo:

https://github.com/ARAldhafeeri/couscous

VS code market place:

https://marketplace.visualstudio.com/items?itemName=AhmedRakan.couscous

10 Comments
2025/02/01
18:12 UTC

2

Issue with nested creation in Prisma

Information about Prisma Schema, Client Queries and Environment (optional)

model Friend {
  id                 Int              @id @default(autoincrement())
  userId             Int
  friendId           Int
  addedAt            DateTime
  removedAt          DateTime?
  createdAt          DateTime         @default(now())
  updatedAt          DateTime         @updatedAt
  user               User             @relation("UserFriends", fields: [userId], references: [id])
  friendUser         User             @relation("FriendOfUsers", fields: [friendId], references: [id])

  @@unique([userId, friendId])
}

model User {
  id               Int               @id @default(autoincrement())
  name             String
  email            String?
  avatar           String?
  createdAt        DateTime          @default(now())
  updatedAt        DateTime          @updatedAt
  friends          Friend[]          @relation("UserFriends")
  friendOf         Friend[]          @relation("FriendOfUsers")
}

Take a look at the schema. Trying to create a Friend, while creating the FriendUser on the fly:

return await this.prisma.friend.upsert({
                    where: {
                        userId_friendId: {
                            userId: user.id,
                            friendId: friendUserId ?? 0
                        }
                    },
                    update: {
                        removedAt: null
                    },
                    create: {
                        userId: user.id,
                        alias: contact.name,
                        relationshipTypeId: (await this.getRelationshipType('Phone Number')).id,
                        addedAt: new Date(),
                        friendUser: {
                        create: {
                                name: contact.name,
                                avatar: contact.image
                            }
                        }
                    }
                });

But failing:

Type '{ userId: number; alias: string; relationshipTypeId: number; addedAt: Date; friendUser: { create: { name: string; avatar: string | null; }; }; }' is not assignable to type '(Without<FriendCreateInput, FriendUncheckedCreateInput> & FriendUncheckedCreateInput) | (Without<...> & FriendCreateInput)'.
  Types of property 'friendUser' are incompatible.
    Type '{ create: { name: string; avatar: string | null; }; }' is not assignable to type 'undefined'.

I guess it's because the type in the create only expects for scalars and not relations, but then how to achieve what I'm trying to do? Are Interactive Transactions the only way, creating the user beforehand?

  • OS: Windows 11
  • Database: PostgreSQL
  • Node.js version: 22.13.0
1 Comment
2025/02/01
16:56 UTC

0

I made a file based routing library for express.js applications

0 Comments
2025/02/01
16:56 UTC

39

A new package manager by the creator of npm - vlt (volt)

I found this yesterday accidentally. It looks pretty cool.

"Explore Your Dependencies Visually Whether you're in the browser, or prefer the command line, vlt query has you covered."

https://www.vlt.sh/client

46 Comments
2025/02/01
11:54 UTC

7

Static Files Authentication

I want to know how to authenticate the user before giving them access to the files in the static folder. Right now, anyone with the URL can access the images in that folder, which I don't want. I want to check the role assigned in the database, match it with their token, and then grant access to preview the image. How can I do that?

I am using disk storage right now to store the image in the uploads folder

4 Comments
2025/02/01
08:09 UTC

32

Wait until you're fully ready or just crack a job?

Sometimes, I feel you don’t need to be fully prepared to get a job. You just need to know how to prepare for an interview, crack it, and get hired. After getting the job, you learn things under pressure because you don’t want to lose it.

I see many people on Twitter who only know how to build basic CRUD apps, yet they have jobs. I know more than them, but I kept waiting for the 'ready' moment before applying, and that wasted a whole year.

I want a job. I'm a 2023 graduate and still jobless. I think I should start applying, no matter what I know or whether I feel ready or not.

What are your thoughts on this?

24 Comments
2025/02/01
04:30 UTC

4

Nodejs open source projects

Hey everyone,

I'm a seasoned nodejs developer, and, as you can tell, things got pretty boring.
So, that said, I really want to start contributing to open source projects, be it small and on the verge of starting the project, or be it bigger, with lots of features already added.

Also, if you guys have any ideas that we can start developing, please shoot me a DM.
Thanks !

8 Comments
2025/01/31
09:24 UTC

0

JavaScript Hoisting In 5 Minutes

1 Comment
2025/01/31
20:37 UTC

6

What is the best strategy to host a NodeJS backend that will process around 500MB(down/up) per user?

My application is write in NodeJS and it process files via upload and after processing, send back to user to download. This files can reach around 250mb and i will delete after processing, soo i do not need a big storage.

Expected to have 100 users/day

I never choose a cloud by myself, so i need help to chose the best way to host this application, and, VERY IMPORTANT... i do not have a infinite budget 🤣

At this moment i am using Vercel to host my front-end, and is fine... i just need to choose a right host for my processing.

13 Comments
2025/01/31
18:51 UTC

Back To Top