Tag: Node.js
49 posts
-
ES2024 JavaScript Features: Object.groupBy, Promise.withResolvers, Resizable ArrayBuffer and the RegExp v Flag
What ES2024 really added: Object.groupBy and Map.groupBy, Promise.withResolvers, resizable ArrayBuffer and transfer, well-formed strings and the RegExp v flag.
-
Real-Time Apps with WebSocket and Socket.io: RFC 6455 Frames, Rooms and Redis Scale-Out
Build real-time features with WebSocket: native API, Socket.io, chat patterns, Redis scaling, plus RFC 6455 handshake, frames, text vs binary.
-
OAuth 2.0 & JWT authentication — token login and refresh flows
JWT and OAuth 2.0: sessions vs tokens, authorization code flow, PKCE, token endpoint, scopes and consent, Node.js/Passport, Google and Kakao.
-
Logging in Node.js with Winston: Levels, Transports, Formats, Structured Logs and Child Loggers
Logging in Node.js with Winston: log levels, transports, formats, structured logging, error logging, child loggers, and a production setup.
-
Running Node.js in Production with PM2: Cluster Mode, Ecosystem Files, Logs and Zero-Downtime Reloads
Deploying Node.js with PM2: cluster mode, ecosystem files, monitoring, log management, auto-restart on reboot, zero-downtime reloads and environment variables.
-
pnpm in Practice: Content-Addressable Store, Strict node_modules, Workspaces, and Migration
How pnpm stores packages (hard links plus a symlinked node_modules), why its strictness breaks code that relied on phantom dependencies, workspaces and filtering, pnpm 10 changes, migrating lockfiles with pnpm import, and Docker/CI setup.
-
MongoDB Modeling with Mongoose: Schemas, Query Operators, Middleware Hooks, Methods and Virtuals
Modeling MongoDB data in Node.js with Mongoose: connections, schema definitions, CRUD, query operators, middleware hooks, instance and static methods, and virtual fields.
-
File Uploads in Express with Multer: Storage Engines, Filters, Limits and Sharp Thumbnails
Handling file uploads in Express with Multer: storage engines, file metadata, type filtering, size limits, error handling, and resizing images into thumbnails with Sharp.
-
Node.js + Nginx Reverse Proxy Setup
Production Nginx reverse proxy for Node.js: proxy headers and trust proxy, Let's Encrypt TLS, buffers and timeouts, limit_req rate limiting, WebSocket upgrades, upstream load balancing, and response caching.
-
Redis Caching Patterns in Node.js: Cache-Aside, Write-Through, Refresh-Ahead and Stampedes
Redis caching in Node.js with working code: cache-aside, write-through, write-behind and refresh-ahead compared, stampede locks, pub/sub invalidation, eviction policy, and what happens when Redis is down.
-
Sending Email from Node.js with Nodemailer: SMTP Services, HTML Templates, Attachments and Pooling
Complete Nodemailer guide for sending emails in Node.js. Learn SMTP, attachments, HTML emails, templates, and building transactional email systems.
-
Authentication with Passport.js: Local Login, Google and GitHub OAuth, JWT and Session Stores
Adding authentication to Node.js with Passport.js: local username/password login, protected routes, Google and GitHub OAuth, JWT strategy, combining strategies, and production session stores.
-
Securing Express with Helmet: CSP, HSTS, Frame Options and the Headers That Matter
Hardening Express apps with Helmet: what each security header does, configuring Content Security Policy and HSTS, clickjacking and MIME-sniffing protection, and referrer policy.
-
Background Jobs and Workflows with Inngest: Steps, Fan-Out, Retries, Concurrency and Cron
Background jobs and multi-step workflows with Inngest: per-step retries, fan-out, concurrency and rate limits, cron schedules and an LLM pipeline example.
-
Validating Data with Joi: Schemas, Conditional and Async Rules, abortEarly and stripUnknown
Complete Joi guide for data validation in Node.js: schema design, async validation, abortEarly/stripUnknown security tradeoffs.
-
Koa.js APIs: Context, Onion-Model Middleware, Routing, Auth and File Uploads
Building Node.js APIs with Koa: the context object, async onion-model middleware, routing, a REST API example, authentication, file uploads, database access and validation.
-
Running Node.js Projects on Deno 2: npm Compatibility, What Works, and What Breaks
How Deno 2 runs npm packages and Node.js code: npm: specifiers vs package.json, node_modules modes, CommonJS vs ESM rules, lifecycle scripts, native addons, and how the permission model interacts with npm dependencies during a migration.
-
Managing Environment Variables with dotenv: Multi-Environment Files, Defaults, Validation and Secrets
Managing environment variables in Node.js with dotenv: loading .env files, ES modules, custom paths, multi-environment setups, defaults, validation, and keeping secrets out of git.
-
Drizzle ORM in Production: Transactions, Relational Queries vs Joins, Migrations and Pooling
Drizzle ORM in production: transaction isolation levels, relational query vs. join trade-offs, safe migrations, and connection pooling.
-
CORS in Express: Allowed Origins, Credentials, Preflight Requests and Dynamic Origins
Configuring CORS in Node.js and Express: why browsers block requests, allowing specific or dynamic origins, cookies and credentials, preflight requests, and per-route settings.
-
Password Hashing with bcrypt in Node.js: Cost Factors, the 72-Byte Limit and Thread Pool Pitfalls
Hashing passwords with bcrypt in Node.js: choosing a cost factor, the 72-byte input limit, thread pool saturation, reset tokens, and the login and ORM-hook pitfalls that quietly weaken it.
-
Background Jobs with Bull and Redis: Retries, Priorities, Delays and Cron Jobs
Running background jobs in Node.js with Bull: job processing, retries, priorities, delayed and repeatable jobs, progress events, and building a reliable Redis-backed queue.
-
Prisma ORM in TypeScript: Schema Design, Dev vs Prod Migrations, Relations and Raw SQL
Model data in schema.prisma, use migrate dev locally and migrate deploy in production, query relations with typed results, and fall back to raw SQL.
-
RabbitMQ in Production: Acks, Prefetch, Durability, Quorum Queues and Dead-Lettering
Why RabbitMQ loses or duplicates messages: manual acks, prefetch, durable queues plus persistent messages, publisher confirms, quorum queues and DLX retries.
-
Socket.IO v4 in Production: Rooms, Acks, Missed Events and Redis Scale-Out
How Socket.IO v4 really works: why a raw WebSocket client can't connect, CORS, acks with timeouts, volatile emits, connection state recovery, sticky sessions and Redis.
-
Building APIs with NestJS: Modules, DI, DTO Validation, Guards, Interceptors and TypeORM
Build production-grade APIs with NestJS. Covers modules, controllers, services, guards with proper DI, TypeORM (and why synchronize:true is dangerous in production), interceptors, exception filters, and testing.
-
Jest Mocking in Depth: Module Mocks vs spyOn, Async Pitfalls, Snapshots and Test Isolation
Jest mocking, snapshot, and coverage reference: module mocks vs. spies, async pitfalls, test isolation, and threshold configuration.
-
JWT Authentication in Node.js: Refresh Token Rotation, HttpOnly Cookies and Revocation
Implement JWT authentication in Node.js and Next.js: short-lived access tokens, rotating refresh tokens with reuse detection, HttpOnly cookie storage, CSRF, Redis revocation, and when sessions are the better choice.
-
Event Streaming with Kafka: Partitions, Consumer Groups, Dead Letter Queues and Production Config
Build Kafka producers and consumers in TypeScript with kafkajs: partition keys, consumer groups, manual offset commits, dead letter queues and production settings.
-
Drizzle ORM Basics: TypeScript Schemas, Type-Safe Queries and drizzle-kit Migrations
Learn Drizzle ORM fundamentals: TypeScript-first schema definition, type-safe queries, and drizzle-kit migrations — no separate schema DSL, no codegen step.
-
Elasticsearch in Practice: Mapping Design, Analyzers, Shard Sizing and Relevance Tuning
Elasticsearch mapping design, analyzer pitfalls, shard sizing trade-offs, and relevance tuning for production search.
-
Desktop Apps with Electron: Main vs Renderer, Secure Preload IPC, Auto-Update and Packaging
Build cross-platform desktop apps with Electron. Covers main/renderer processes, IPC, native APIs, auto-update, performance optimization, and distribution.
-
A Systematic Debugging Method: Reproduce, Isolate, Test a Hypothesis, and Read Stack Traces
A step-by-step debugging method (reproduce, isolate, test a hypothesis) plus stack traces, common JavaScript and Python errors, DevTools and Node.js debugging.
-
Finding Memory Leaks: Heap Snapshots in Node.js, tracemalloc in Python, Heap Dumps in Java
Tell a leak from high memory use, then find it with heap snapshots and Clinic.js in Node.js, tracemalloc in Python, and heap dumps and jstat on the JVM.
-
Axios in Practice: Instances, Interceptors, Error Handling and Cancellation
Using Axios for HTTP requests in JavaScript and Node.js: instances, request configuration, response shape, error handling, interceptors, cancellation, and concurrent requests.
-
Getting Started with Node.js: Install, Setup, and Hello World
Node.js tutorial for beginners: install Node and npm on Windows, macOS, and Linux, run Hello World, use npm scripts, and understand modules, fs and HTTP.
-
TypeScript REST API Project | Express & Layered Architecture
A TypeScript REST API tutorial covering Express, tsconfig, DTOs with Omit/Partial, a router/controller/service/database layering pattern, a consistent ApiResponse envelope, and curl examples for user CRUD.
-
Node.js Database Integration: MongoDB, PostgreSQL, and MySQL
Connect Node.js to MongoDB (Mongoose), PostgreSQL (pg, Sequelize), and MySQL (mysql2): connection pools, CRUD, transactions, REST examples, indexes.
-
Node.js Authentication and Security: JWT, bcrypt, and Sessions
Secure Node.js APIs: bcrypt password hashing, JWT access tokens with pinned algorithms, rotated and hashed refresh tokens, where to store tokens in the browser, sessions with a shared store, Passport OAuth, and the defaults that make auth code insecure.
-
Node.js Testing: Jest, Mocha, and Supertest
Test Node.js apps with Jest matchers and mocks, async tests, Supertest for Express APIs, MongoDB memory server, integration tests.
-
Node.js Performance: Clustering, Caching, and Profiling
Node.js performance in practice: measure before tuning, cluster across cores, cache without stampedes, fix N+1 queries, keep the event loop free, and profile with --cpu-prof and clinic.js.
-
Node.js Module System: CommonJS and ES Modules Explained
CommonJS vs ES modules in Node.js: require vs import, exports vs module.exports, resolution, caching, circular dependencies and "Cannot find module" fixes.
-
Node.js Async Programming: Callbacks and Promises
Learn Node.js async I/O: callbacks, error-first style, Promises, async/await, the event loop, streams, and patterns for APIs and file pipelines.
-
Express.js for REST APIs: Routing, Middleware Order, Error Handling and What Changed in Express 5
Build REST APIs with Express: how the middleware chain runs, routers, validation, centralized error handling, Express 5 changes (async errors, path syntax), and production settings.
-
Node.js File System (fs): Promises API, Streams, Atomic Writes, and Watching Files
The Node.js fs module in practice: sync vs callback vs fs/promises, reading and writing JSON safely with atomic writes, directories, streams with pipeline, error codes, fs.watch vs chokidar, and the race conditions in exists-then-open code.
-
Starting JavaScript: ECMAScript, Browser vs Node.js, Core Syntax and var vs let vs const
JavaScript tutorial for beginners: ECMAScript and runtimes, core syntax, and var vs let vs const—with examples you can run in the browser or Node.js.
-
Deploying Node.js on EC2: Security Groups, IAM Roles, IMDSv2, systemd and Nginx
Deploy a Node.js app on a single EC2 instance the safe way: SSM instead of open SSH, IAM roles instead of keys, IMDSv2, gp3, systemd or PM2, Nginx and HTTPS.
-
API Rate Limiting: Fixed Window, Sliding Log and Token Bucket, and Making Them Atomic in Redis
How fixed window, sliding log, and token bucket rate limiters actually behave, how to make them atomic in Redis, and the proxy, clock, and retry pitfalls that break them in production.
-
Node.js & JavaScript Error Handling Best Practices
Node.js error handling for production: operational vs programmer errors, the three ways errors propagate, cause and captureStackTrace, fire-and-forget promises, EventEmitter error events, unhandled rejections, Express error middleware, and retries.