Backend
-
Node
Fix JWT Errors: jwt malformed, jwt expired, invalid signature and invalid token
Each jsonwebtoken error has a specific cause. “jwt malformed” means the value is not a token at all, often the text "undefined". “jwt must be provided” means it was empty. “invalid token” usually means the Bearer prefix was not removed. “invalid signature” means the secret differs from the one that signed it. “jwt expired” means the expiry time has passed.
-
Node
Fix “Error: Cannot find module” in Node.js (MODULE_NOT_FOUND)
Node.js shows “Cannot find module” when it can’t locate a file or package you required or imported. If the name is a package, run npm install for it in the project folder. If it is your own file, fix the relative path: start it with ./ or ../, match the exact letter case, and in ES modules include the file extension such as .js.
-
Node
Fix “Error: listen EADDRINUSE: address already in use” in Node.js
The error “EADDRINUSE: address already in use” means another process is already listening on the port your Node.js server wants, usually an older copy of your own app. Find it with lsof -i :3000 (macOS and Linux) or netstat -ano | findstr :3000 (Windows), stop it, or start your server on a different port. Then add graceful shutdown so the port is released every time.
-
Node
Fix “Cannot use import statement outside a module” in Node.js, Jest and the Browser
The error “Cannot use import statement outside a module” means code with import was loaded as CommonJS or as a classic script. In Node.js, add "type": "module" to package.json or rename the file to .mjs. In Jest, use babel-jest, native ES module mode or Vitest. In the browser, load the file with .
-
Node
Zod vs Joi vs Yup: Which Validation Library Should You Use?
Pick Zod for TypeScript and full-stack projects, because one schema gives you both validation and types and it works in React and Express. Pick Joi for JavaScript-only Node.js APIs where its mature, expressive rules shine. Pick Yup if your forms already use Formik and you mostly validate in the browser.
-
ExpressJS
Fix “Blocked by CORS Policy” in a MERN App (React + Express)
The browser blocks your React app from reading the API response because Express did not send the right CORS headers. Install the cors package and add app.use(cors({ origin: "http://localhost:5173" })) before your routes. If you send cookies, also set credentials: true on the server and credentials: "include" (or withCredentials in Axios) on the client, and never use origin "*" with credentials.
-
ExpressJS
Fix “TypeError: Missing parameter name” After Upgrading to Express 5
Express 5 uses a stricter route syntax, and a bare * in a route path now throws “Missing parameter name”. Give every wildcard a name, for example change app.get("*") to app.get("/{*splat}") and "/files/*" to "/files/*splat". Also change optional parameters such as "/:id?" to "{/:id}", and replace regular-expression characters in route strings with an array of paths.
-
ExpressJS
Fix “Cannot set headers after they are sent to the client” in Express
This error means your code tried to send a second response to a request that was already answered. The usual fix is to add return before res.json() or res.send() inside an if block, so the function stops after responding. Also check for next() called after a response and for callbacks that run twice.
-
Backend
SvelteKit as a Backend: Server Routes, Form Actions and When to Use It
SvelteKit is a full-stack framework: besides Svelte pages, it runs server code in +page.server.js load functions, +server.js API routes, form actions and hooks. That lets one project handle pages, data loading, form submissions and JSON APIs. Choose it for full-stack web apps; keep a separate Express or NestJS API when many different clients share a large backend.
-
Backend
GraphQL vs REST: Which API Style Should You Use?
Choose REST for most APIs: it is simpler, works with HTTP caching out of the box, and every developer knows it. Choose GraphQL when many different clients (web, mobile, partners) need different shapes of deeply related data, and you want them to fetch exactly what they need in one request.
-
Backend
Building Microservices With NestJS: A Practical Step-by-Step Guide
NestJS microservices use @nestjs/microservices: a service listens on a transport such as TCP, Redis, NATS or RabbitMQ, handlers use @MessagePattern for request-response and @EventPattern for fire-and-forget events, and other services call them through a ClientProxy with send() or emit(). Start with a modular monolith and split out services only when you have a clear reason.
-
Backend
How to Migrate an Express App to Express 5 (Step by Step)
To upgrade to Express 5, use Node.js 18 or newer, run npm install express@5, then fix the breaking changes: wildcard routes must be named (/*splat), optional parameters use braces ({/:id}), old methods such as res.send(404) and req.param() are gone, and rejected promises in async handlers now reach your error handler automatically.












