Questions tagged [node.js]
Node.js is an event-based, asynchronous I/O framework that uses Google's V8 JavaScript engine.
511 questions
3
votes
3
answers
1k
views
Is a SPA still a SPA if SSR is used?
I’m developing a system with separate front-end and back-end components:
The back-end is already implemented with Node.js and Express, exposing REST APIs.
The front-end must be a private SPA, ...
0
votes
2
answers
111
views
Should I instantiate controllers in route modules or use static methods?
I’m building a modular REST API using Node.js + Express + TypeScript.
My controllers are defined as classes. In my route files, I currently create a new controller instance, like this:
import { Router ...
1
vote
1
answer
197
views
Storing 100k keys for bulk retrieval from Azure
We're setting up a device-to-cloud channel using TLS-PSK (Pre-Shared Key), where each device uses a unique key to encrypt communications.
Each key is known only to the individual device that uses it ...
5
votes
4
answers
717
views
Is this too much for a modular monolith system? [closed]
A little background before I ask my questions. I've designed a system as an architect based on the requirements given to me by the client. The client has a team or two to three developers which are ...
2
votes
1
answer
238
views
How to design a plugin architecture in Node.js?
I have a Node.js application and I want users to be able to develop custom plugins. I have multiple ideas and I am unsure how good they are. I need some tips from more experienced developers.
My first ...
3
votes
3
answers
492
views
Is it a good idea to wrap node.js package functions in a micro-service architecture?
Our development team works with a micro-service node.js architecture. This means we work with a very large amount of repositories that currently each take care of their own dependencies.
To avoid ...
0
votes
1
answer
523
views
Should you use nested routes within NestJS for a "RESTfull" API
Here is an Example API for managing companies, employees, and their children. My entity relationships are as follows:
company -1:n-> employees -1:n-> children
I’ve structured the API routes ...
1
vote
3
answers
347
views
Where to handle Validation Errors in Business logic layer?
I'm currently designing a multi-layered application and am trying to figure out the best practice for error handling within the Business Logic Layer (BLL).
Should I handle errors directly within the ...
0
votes
0
answers
102
views
Edge Case For Cookie Based Token Management
I have a React frontend and a Nodejs backend that uses authentication via an OIDC service provider. After a user goes through the SSO authentication flow I store the token (containing a refresh token ...
-1
votes
2
answers
117
views
Long running process with shared and synced status between multiple browser windows?
is it practical to store the status of a long running process in a redis key to sync the status of process across multiple browser windows of the same page? ( including new browser windows opened when ...
-3
votes
1
answer
198
views
Is it a bad idea to use NodeJS + Python for back end development? [closed]
I'm working on a platform that consumes and transforms data to make reports and visualize those reports in a client app.
The team has experience with NodeJS and NestJS, and some of us have experience ...
2
votes
1
answer
134
views
Node Services and Enum Sharing
I will get to the question in a minute....
We have 2 in house services that either have an API contract between the 2 that involves an enum or the enum value is stored in a shared database.
I don't ...
1
vote
1
answer
707
views
What techniques can help me identifying unused dependencies for a production build?
I have certain dependencies in my project like sequelize-auto which are not required in production, since we only need to generate the models once during development. Even if we make changes to the ...
2
votes
1
answer
524
views
What really is a "web server" in relation to popular frameworks like Flask, Node.js, Apache?
In Flask you can run a "webserver". Well really it's a "WSGI Server". Well really you shouldn't be using core server features like serving files through HTTP at all, you should be ...
0
votes
0
answers
50
views
Balancing logic placement in the domain and general perfomance of the system
I am writing my first application using DDD (in Node with TS) and I started writing all the domain first -- before starting the repositories/DB and then the application, while writing unit tests for ...
1
vote
1
answer
184
views
Open source projects, SBOMs and security
I was just reading a StackOverflow question here, about extracting the version number from a node package.json file. And the simple
'read in the json and access the property in your build tool'
got ...
0
votes
0
answers
94
views
Using messaging and rest to communicate services at the same time
I have two microservices, USERS and PRODUCTS, the second one creates objects referred to first one so it needs first to check that exists
First I though in a redis cache, but then I realize that for ...
1
vote
2
answers
111
views
Are mature dependencies less risky than state of the art ones?
There are tools like dependabot or greenkeeper for npm and others for other languages. Now at first glance they improve security by keeping open source dependencies up-to-date. But I am wondering, do ...
0
votes
2
answers
2k
views
User authentication using cookies in a web app using API on different domains
I want to achieve user authentication and keep state with cookies between client and server.
Webapp runs with domain1, backend runs on domain2. I am having lots of trouble letting session cookies be ...
0
votes
2
answers
212
views
Microservice Web app - How will I handle User Login in my project management app
I've just started learning to use this architecture and I'm trying to build a simple project management app. The App works such that a user after registering, creates a workspace. This Workspace is ...
-1
votes
1
answer
1k
views
Should I use function-based exports/imports or classes?
What would make more sense, to use functions for exports/imports:
// globals/helpers.js
exports.fnOne = () => {}
// features/user.js
const {fnOne} = require()
Or class-based approach with static ...
-1
votes
1
answer
534
views
Right using monorepo for ts-node scripts
I have a repository with various tools/scripts written with ts-node and used in many projects.
Initially, it contained several automation/analytics scripts, one package.json file at the root, and one ...
1
vote
3
answers
2k
views
Best strategy to push client-side updates to server?
I'm just starting to build a web app using React.js, Next.js, Prisma, & PostgreSQL. In this web app, users can create "projects", which are represented by 10-15 rows in the database. ...
1
vote
3
answers
144
views
Selecting a large set of information from a database
So this is a topic I have never really tackled, so bare with me as I try to describe my issue and the scenario.
I have an API endpoint in my service that sends emails to a bunch of users. The set of ...
0
votes
2
answers
454
views
Extensive use of global variables in js codebase?
I've been tasked with refactoring/simplifying the architecture of a (relatively) large node.js codebase and it makes ample use of global variables. I don't have much experience with javascript so just ...
1
vote
1
answer
2k
views
What are the benefits of keeping npm packages up-to-date? [closed]
The company I work for is maintaining and developing a web application that uses many Node.js packages. A lot of these packages are really outdated. I can intuitively understand that it is good to ...
0
votes
1
answer
576
views
Should SSDP be considered as a go-to option for local network discovery in software development?
I am currently working on a Raspberry Pi based robotics project that I would like to connect to a realtime customized control panel/dashboard, mostly for debugging purposes. I created a test setup ...
4
votes
2
answers
695
views
What would be the reason for using asynchronous programming on a web server?
I have a python/php background and just about to start work on a NodeJS project which is why I have this question. I have worked a bit on frontend JS but this is the first time I will be using JS for ...
1
vote
1
answer
2k
views
Difference between Resolvers and Controllers?
I may be overthinking it, but are controllers and resolvers the same thing in web applications? Coming from the MERN stack, everyone used to call these request processing functions "controllers,&...
0
votes
1
answer
224
views
How should I handle routine health checks in a Node.js/Nest.js application?
I have a Nest.js application, and lately I've been thinking about how I can ensure that data is synchronized between two sources - my database and an external database.
For example - and to my ...
-2
votes
2
answers
189
views
best practice to recover or handle requests that is half completed or partially failed [closed]
Assume I have a request:
app.post('/order', ()=>{
// task 1
// task 2
// task 3
})
and task1 and task2 is completed but task3 failed.
for example a user paid order successfully but saving order ...
1
vote
1
answer
121
views
Designing a scheduled based system using Node.js
Just for the example:
I have a system which needs to fetch social media timeline on a specific time interval based on user preferences.
Let's say we have user A, B, C, and so on.
Let's say again we ...
0
votes
1
answer
282
views
Best practices to deal with realtime data in REST API, Postgres and Redis
Overview
Today we have a monolithic service that deals with realtime time data. The monolithic are composed by follow stack: Django + AuroraDB Cluster (Postgres AWS) + Varnish cache and cloudfront at ...
0
votes
3
answers
1k
views
Improve CI process by testing against docker image and fail docker build if test fails
Our CI process goes as this cycle (I think it is quite normal), unit test => build docker image => run function test against the image => if test fails remove the failed docker image, figure ...
0
votes
0
answers
652
views
Best practice architecture to implement Spotify Auth for a Flutter frontend app and Node.js backend?
I am currently building an application that uses the Spotify API to work with a user's playlists. My frontend is a Flutter app, which is connected to the backend, that is built with Node.js. Currently ...
-1
votes
1
answer
101
views
Where should my element invoked function be defined, and why?
I have a button element on index.html that invokes a function signIn:
<button onclick="signIn()">Sign-in</button>
I have a few basic options on where this function can be ...
-3
votes
1
answer
207
views
Ways & Methods switch between MongoDB Database after selecting a country. (MERNG)
I have a concept in which a user selects a country, which will either filter or go to that database; I was thinking of alternatives or options that would help in the process. These are my first plans ...
0
votes
1
answer
3k
views
Where should interfaces/model definitions live? -- Clean architecture
I'm working on a Node project (in typescript) that features a variation of clean architecture. I have a pretty clear understanding of the different layers of an application and how they depend on each ...
1
vote
2
answers
642
views
How to create an API on Node.js that needs to be updated once a day?
I want to create an api based on Node.js and Express.js. This api should return an array of products on /products. To get these products on my node server, I need to call a third party api. However, I ...
-2
votes
1
answer
120
views
Backend microservice design
I'm currently designing a new online platform where the frontend will be Angular using Angular Universal and the backend will be a sort of Node.js clustered microservices.
The question itself is what ...
1
vote
2
answers
500
views
QR Code Scanning with location check
I would like to make an order-system with QR-Codes which is online.
How I imagine it to work:
A customer visits a restaurant. There is a QR-Code on his table which takes him to a public webpage where ...
2
votes
3
answers
158
views
Should a process be responsible for scheduling itself?
I need to create a very small service which will programmatically make a database insertion once a day. As our stack primarily uses Node.js, we’re going to write a JS script responsible just for ...
0
votes
0
answers
38
views
Is there a way to add impending state changes to a queue on a node server, and is it necessary?
I'm writing an express/socket.io-powered game server for a web game. I have a central map of game state objects, each representing an ongoing match, like so:
// map of gameId -> game (primary ...
1
vote
1
answer
629
views
Connect two users of a socket.io Lobby
first of all i will explain you what i want to do.
I have a Web application where are multiple rooms like Room1, Room2, Room3…
Currently active users can join in one of these Rooms by clicking on it. ...
1
vote
2
answers
258
views
Make infinite loop handleable via delay?
I have a Node.js micro-service architecture-based back-end. Services communicate with each other via PubSub. E.g. upon a request to service A, service A messages either service B or service C via ...
1
vote
1
answer
202
views
How to avoid messy variable dependencies for ease of testing in Node?
I couldn't decide if the question belongs on Stack Overflow, but I went with SE Stack Exchange for the higher quality, broader answers. Bare with me.
Examples are in Node but I guess applies to a ...
3
votes
3
answers
566
views
Is there merit to keeping packages/dependencies in a legacy project up to date?
I have been assigned a ticket to update all node packages and dependencies in a react project to the latest possible version without breaking the application monolith as it is now; no further ...
1
vote
1
answer
644
views
What is the correct architecture for communication between an HTTP server and a WS server on the same machine running in separate processes?
I have a Node.js HTTP REST API server and a Node.js WS server. I separated them into 2 entrypoints so that they can be more easily debugged and run separated from each other, but now I need the REST ...
0
votes
0
answers
290
views
How to implement notification system based on time that runs in regular intervals
I have a MySQL database with nodeJS server. I want to implement a notification functionality which is as follows. Once a user registers, I want to (inform) send some particular information to the user ...
-1
votes
1
answer
673
views
Node.JS and HTTP2
We finished developing our prototype using Node.JS and Express.JS (which works with HTTP1.1) and I am trying to upgrade to HTTP2. However I am having a lot of troubles to do this.
I first discovered ...