Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 141

Node.js & Express2 min read

How does Node.js handle thousands of connections on one thread?

This tests non-blocking I/O: Node.js runs one thread for an event loop while the OS handles sockets via epoll or IOCP, resuming callbacks when data arrives. Mention the thread pool for DNS and fs work. A red flag is claiming threads spawn per request.

Node.js & Express2 min read

express-validator: Validate at the Edge

express-validator stops garbage before it hits your logic. Use it on any route that accepts user input like form data, query strings, or JSON payloads. The biggest mistake is validating but forgetting to check validationResult, so invalid requests pass.

Node.js & Express2 min read

Operational vs Programmer Errors in Node

Operational errors are expected problems like a failed network request; programmer errors are bugs like reading undefined. Handle the first gracefully, crash the second. The footgun is catching programmer errors and continuing, which corrupts process state.

Node.js & Express2 min read

Validation Checks Rules; Sanitization Cleans Input

Validation checks if input fits your rules and rejects failures. Sanitization cleans allowed input so it cannot cause harm. Validate at the boundary to enforce shape, then sanitize before rendering. Never swap them; scrubbing a bad date does not make it valid.

Node.js & Express2 min read

Bcrypt: Hash Passwords with Salt and Slowness

Bcrypt salts and slows every password hash so identical passwords never look the same and brute force stays expensive. Use it in register and login routes before the database. Never compare hashes with plain string equality; always call bcrypt.compare().

Node.js & Express2 min read

MongoDB Aggregation Pipeline: Server-Side Assembly Line

MongoDB's aggregation pipeline reshapes documents stage by stage on the server. Use it for reports, joins, or analytics without pulling whole collections into your app. Running $sort or $group before $match scans excess documents and kills performance.

Node.js & Express2 min read

JWT Authentication: Signed Claims, Not Sessions

A JWT is a signed JSON blob that lets a server trust a client without storing session state. Express APIs use it to stay stateless across load-balanced servers. The footgun is stuffing secrets inside because the payload is only Base64, not encrypted.

Node.js & Express2 min read

Callback Hell: The Pyramid of Doom

Callback hell is what happens when nested async callbacks indent so deeply the code forms an unreadable pyramid. You see it in legacy Node.js when chaining database queries or file reads.

Node.js & Express2 min read

Node.js Built-in SQLite Driver

Node.js bundles a SQLite driver in node:sqlite. Open a file with new DatabaseSync(path), then run SQL with exec() or prepared statements. Use it for local tools and caches. DatabaseSync is synchronous, so running it on a web server main thread blocks requests.

Node.js & Express2 min read

ODM: Your Database as JavaScript Objects

ODM translates JavaScript objects to database records and back, letting you work with plain objects instead of raw queries. It removes boilerplate in Node.js apps but hides the real queries underneath.

Node.js & Express2 min read

Node.js DNS: lookup vs. resolve

Node.js splits DNS into two paths: dns.lookup uses getaddrinfo for IPs, while the dns.resolve family fetches records like MX or TXT. Use lookup for connections and the resolve family for service discovery.

Node.js & Express2 min read

Node.js Callbacks: Functions That Run Later

A callback is a function you pass to run later when an event fires or work finishes, keeping Node.js free to handle other work. HTTP servers use them to respond to connections without blocking.

npx: Execute Packages Without Installing Them
Node.js & Express2 min read

npx: Execute Packages Without Installing Them

npx runs Node.js tools without installing them globally, fetching the latest version on demand. Use it for one-off scaffolding like create-react-app or CI build scripts. The footgun: it may silently run a stale cached copy if you omit a version tag.

Monitoring & SRE2 min read

SLOs Tied to User Journeys, Not APIs

A user-journey SLO measures the full flow a person experiences, not one microservice's health. If checkout is 99.9% up but payments fail, the metric lied. Teams drown in green per-service dashboards while users are furious.

Monitoring & SRE2 min read

DevOps Is Culture, SRE Is Engineering

DevOps is a cultural philosophy for fast, safe delivery; SRE is the engineering discipline that implements it with error budgets and SLOs. They are complementary, not rival job titles. The footgun is hiring SREs and declaring DevOps done.

Monitoring & SRE2 min read

AWS Fault Injection Simulator

AWS Fault Injection Simulator is a controlled chaos button: it breaks resources on purpose to prove your failover works before real disasters. Run it before peak traffic to validate auto-healing.

Most LLM Apps Need Workflows Not Agent Frameworks
MLOps & Infrastructure1 min read

Most LLM Apps Need Workflows Not Agent Frameworks

Most LLM apps ship faster and more reliably as deterministic workflows than autonomous agents. Plain Python with structured outputs and local functions beats CrewAI and LangGraph for debugging. Map control flow in code before importing any agent framework.

ORPilot JSON IR Ends Solver Lock-In
MLOps & Infrastructure1 min read

ORPilot JSON IR Ends Solver Lock-In

ORPilot's open-source IR captures optimization models as solver-agnostic JSON, letting teams swap solvers or update data without calling the LLM again. It separates model structure from solver syntax, making LLM-generated OR models reproducible in production.

Default Churn Thresholds Waste $86 per Customer
MLOps & Infrastructure1 min read

Default Churn Thresholds Waste $86 per Customer

90% of 36 IBM Telco churn analyses use F1 and a 0.5 threshold, assuming equal costs for false positives and negatives. That is wrong by 13x, burning $86 per customer, or $8.6M at 100k subscribers. Swap accuracy for profit curves tied to LTV and CAC.

MLOps & Infrastructure2 min read

Design a cost-aware ML training platform for heterogeneous hardware

Tests hardware abstraction and cost-aware cross-accelerator scheduling. Strong answers cover a device-agnostic spec, a performance predictor, a cost-per-step model, and bin-packing against spot prices. Red flag: ignoring per-step cost and migration overhead.