Articles
Every adapting article, grouped by corpus and folder.
Next.js
caching
foundations
Build time, request time, and the client
Your code runs at one of three moments, and whether guessing wrong suspends or throws depends on whether the value can wait
File conventions and the route tree
The file conventions are a fixed wrapper stack, and each wrapper has a different relationship to the two rendering passes
Rules of the server boundary
Four scopes forbid different things, and the rules are enforced unevenly — one violation fails silently into a plausible value
Server and Client Components
The use client directive marks an entry point into the client module graph, spreading through import and never through JSX
Thinking in the App Router
A route is not static or dynamic but a static shell with holes, and every piece of data answers one of four questions
rendering
React
architecture
Micro-frontends: the decision
Micro-frontends buy independent deployment for independent teams, and most teams that reach for them do so too early
Module Federation in practice
Module Federation is runtime code sharing, and sharing exactly one React across host and remote is what decides whether it works
ecosystem
Accessibility in React
React ships inaccessible DOM as happily as accessible DOM, so almost every win comes from not fighting the platform
Performance profiling
Profiling is measurement, not optimization, and conflating the React layer with the browser layer is how it usually goes wrong
TanStack Router — the type-safe alternative
The capability React Router has no clean answer for is validated, typed search params, and it costs a generated route tree
effects
Custom Hooks
A custom hook buys a name and a boundary, never shared state, and the craft is what you extract rather than how you extract it
Effects and Synchronization
Reading useEffect as a lifecycle hook rather than a synchronization contract is the root of nearly every way it gets misused
Escape Hatches Audit
Three escape hatches exist because the ordinary tools cannot wait, and useLayoutEffect, useSyncExternalStore and flushSync each charge for it
useRef and the DOM
State is for values that drive renders and refs are for values that survive them, and React 19 removed most of the DOM ceremony
foundations
Component Composition
Composition rests on the owner versus parent distinction, and the ladder from children to render props is climbed only as far as forced
Components and Props
A component's props type is its public API, and designing it well is what makes invalid usage fail to compile instead of at runtime
Conditional Rendering and Events
Branching and event handling look trivial and hide real machinery, from unmount-versus-hide decisions to blur firing before click
JSX and Rendering
JSX is sugar for function calls that return plain objects, and reading it that way dissolves a whole class of React confusion
The Rules of React
React's rules are the load-bearing assumptions of the hook list, StrictMode, concurrent rendering and the Compiler, not etiquette
Thinking in React
React bets that your UI is a function of state, and most React bugs come from fighting that bet rather than from the API
recipes/auth
A refresh storm on 401 logs the user out
Parallel 401s each triggering their own token refresh is what logs the user out, and a single-flight refresh is the fix
Logout clears the token but not the cache
Clearing the token does not end the session, so logout needs one shared teardown that cancels, wipes and broadcasts across tabs
The protected page flashes before the redirect
Auth has three states, not two, and deciding in a route loader before the protected component mounts is what removes the flash
recipes/data-fetching
After "cancel" the list never refreshes — or after invalidate a ghost write returns
Cancel stops in-flight work and invalidate marks stale and refetches, and an optimistic mutation needs both in the right order
Cart rows each call useQuery in a .map — hooks explode or the API melts
A runtime-length list of queries needs useQueries or a batched endpoint, because calling useQuery inside a map breaks the hook rules
Checkout refetches on every visit — even 3 seconds later
Force a refetch on mount only where correctness demands it, and keep the cached data so the screen still paints while it runs
Infinite scroll loads page 80 and the tab runs out of memory
An infinite feed has to page forever without keeping forever, which means capping retained pages as well as virtualizing the DOM
mutateAsync crashes the page — or nested onSuccess hell blocks a multi-step signup
Default to mutate and reach for mutateAsync only when you genuinely need a promise, because its rejections are yours to catch
Persisted Query cache writes PII into localStorage — and survives logout
Persisting the query cache is safe only as an allowlist of public data with a user-scoped buster that logout actually clears
Pull-to-refresh on a Suspense infinite feed flashes the whole skeleton
A suspending refetch hides the list unless it runs in a transition, and Retry only works if the cached error is reset with it
Search Race Condition: Stale Results Overwrite Fresh Ones
Search-as-you-type needs a race policy, not just a debounce, because the network will happily deliver an old query last
Skimming the product grid fires dozens of prefetch GETs
Prefetch on intent rather than on hover, and give it a real staleTime, or the warm cache gets refetched the moment it is used
The Cancel button on a large upload does nothing
Mutations do not get the automatic abort signal queries do, so a working Cancel means threading your own controller through
The ops board sits stale while the operator stares at it
Stale does not mean refetch, so a watched dashboard needs an interval on that surface alone rather than a global polling default
The spinner never resolves after you navigate away and back
A spinner that never resolves is a loading flag that outlived its request, so derive loading from the request rather than storing it
recipes/forms-and-ux
recipes/micro-frontends
A remote's independent deploy silently breaks the host
A remote's exposed props are a versioned public API, so compatibility has to be checked at runtime and evolved additively
A shared store couples your remotes back into a monolith
A shared mutable store re-couples independently deployed remotes, so share server truth and versioned events instead of state
One remote 404s and the whole shell goes white
A remote that fails to load should degrade inside its own slot, or a three-minute CDN blip becomes a full product outage
One remote's CSS restyles another — depending on load order
Global selectors in one remote restyle another once load order decides the cascade, so scoping has to be structural not careful
The remote crashes with "Invalid hook call" — but only inside the shell
An invalid hook call only inside the shell means two copies of React, so federation has to treat React as a strict singleton
recipes/performance
A 900KB bundle loads before anyone sees the login screen
The initial download should carry only the first screen, with routes and heavy libraries pulled in on navigation or interaction
Switching to the "All transactions" tab freezes the page for six seconds
Ten thousand rows in one synchronous commit is the freeze, and virtualizing down to the visible window is what removes it
The hero paints five seconds late because the page is client-rendered
A client-rendered hero cannot paint until the JavaScript does, so the LCP element has to be in the initial server response
Typing Lag: The Re-render Storm
The fix for a typing-lag re-render storm is structural, and the diff contains no hand-written memo, useMemo or useCallback at all
recipes/routing
Clicking a lazy route blanks the screen before the page appears
Keep the current page on screen while the next chunk loads, because unmounting it first is what turns code splitting into a flash
Hitting Back dumps the user at the top of the list instead of where they were
Scroll restoration needs the list data loaded before render, otherwise the router restores a position the page does not have yet
URL params drift out of sync with component state
Mirroring the URL into state is what makes filters vanish on Back, so derive from the address bar during render instead
recipes/ssr-and-rsc
"use client" crept up the tree and shipped your whole page to the browser
The use client directive marks a boundary rather than a file, so everything below it ships and the boundary belongs at the leaves
The page flashes and the console floods with hydration errors
Hydration errors come from environment-divergent values in the first render, so read time, locale and storage only after mount
The Server Action succeeded, but the page still shows the old value
A successful write still shows stale UI until you invalidate the exact cache it came from, and the client cache is a second one
recipes/state-management
Context Re-Renders the Whole Tree
Splitting context by change cadence and pushing reads down to leaves fixes most context re-render storms, until it stops being enough
Server data in a Zustand store goes stale
Server state in a client store goes stale with nothing to refresh it, which is why a query cache owns it and Zustand keeps the rest
rendering
Error Boundaries
Without a boundary a single throw during render unmounts the entire tree, and the real skill is telling error state from error throws
How React Renders
Render is pure and disposable while commit is synchronous and atomic, and that split explains most of what React seems to do arbitrarily
Memoization and the Compiler
React Compiler inverts the memoization deal, so the job is now verifying it worked rather than hand-placing memo and useMemo
Portals and the Event System
A portal splits the React tree from the DOM tree, and every portal question reduces to asking which of the two governs the behavior
Rendering Lists and Keys
A key is an item's identity across renders, and identity decides what persists, which is why index keys corrupt state in real lists
state
Context
Context is a transport, not a store, so every reader re-renders on every change and nothing you wrap around a reader prevents it
State and useState
State is a snapshot plus a queue, and every classic useState confusion comes from reading it as an ordinary JavaScript variable
useReducer and State Structure
The choice is not useState versus useReducer but where the rules live, and most reducer pain turns out to be state shape pain
Angular
components
Angular DevTools
The official browser extension inspects your component tree, profiles change detection, and maps the injector hierarchy
Animations
Angular's animation DSL is a state machine — you declare states and transitions, and the runtime handles interpolation and cleanup
Change Detection
Change detection in v22 is re-engineered around signals — OnPush by default, zoneless new apps, and updates only where data changed
Component Interactions: Input, Output, and Two-Way Binding
Parent and child talk through inputs, outputs, and two-way bindings, and an Observable can serve directly as an output
Component Lifecycle
Angular calls lifecycle hooks in a fixed order, and knowing exactly when each one fires is what separates subtle bugs from solid components
Dynamic Components in Angular
Runtime component creation survived intact but its API did not, and setInput is now required for signal inputs to react
components/styling
Angular Material
Google's official component library ships accessible Material Design 3 components with build-time theming through CSS custom properties
Choosing an Angular UI Library
Angular Material is the safest long-term bet, while PrimeNG, NG-ZORRO, and the commercial suites win on breadth or data-heavy grids
View Encapsulation
Three encapsulation modes decide whether a component's styles stay private or leak, which explains most CSS that will not apply
components/templates
Angular Data Binding
Every Angular binding syntax is sorted by the direction data travels between the component class and its template
Built-in Control Flow
Built-in blocks replaced the structural directives with no imports to remember, a required track, and real TypeScript narrowing
Content Projection
Content projection passes markup written between a component's tags into its template, the Angular equivalent of a web component slot
Template Variables, ViewChild, and ContentChild
Template reference variables reach elements from the template, while ViewChild and ContentChild queries reach them from the class
dependency-injection
directives
Attribute Directives
Attribute directives change how an existing element looks or behaves, which is what separates them from structural directives
Composing Form Data Sources with Directives
Pairing a directive with an injection token lets one shared select control pick its data source declaratively at each call site
ng-template, ngTemplateOutlet, and ng-container
ng-template stores markup that never renders where it is defined, and ngTemplateOutlet decides when and where it lands
Structural Directives
Structural directives add, remove, and reshape the DOM, and the asterisk is shorthand for the ng-template they work through
forms
Angular Form Async Validators
Async validators cover the checks that need a server answer, such as whether the username someone typed is already taken
Angular Reactive Forms
The FormGroup runtime model is unchanged, but typed forms and nonNullable controls changed how you declare a form and how it infers
Angular Template-driven Forms
Template-driven forms build the model from directives in the template, with two-way binding keeping component state in sync
DisabledControlDirective for Reactive Forms
Reactive forms warn against the disabled attribute in templates, and a small directive is the supported way to keep disabling declarative
Signal Forms
Signal Forms drops FormGroup for a plain signal of data plus a field tree exposing value, errors, and touched as signals
foundations
Getting Started with Angular
Scaffolding a v22 app produces standalone components and an app config file rather than the AppModule the CLI used to generate
TypeScript Prerequisites for Angular
The TypeScript you need before Angular makes sense, from interfaces and generics to the utility types v22 code leans on
http
HTTP
HttpClient is a typed layer over the browser's Fetch API with an interceptor pipeline every request and response passes through
HTTP Error Handling
Angular wraps every HTTP failure into one HttpErrorResponse, and a status of zero is what tells network errors apart from server errors
HTTP Interceptors
Interceptors are middleware for HttpClient, one ordered place to attach auth headers, retry requests, or normalize errors app-wide
reactivity
Signal Inputs
Signal inputs arrive as read-only signals, so parent values feed computed and effect directly with no ngOnChanges plumbing
Signals
A signal tracks every place its value is read, which lets Angular update only the consumers that depend on what changed
toSignal & toObservable
These two helpers bridge Angular's two reactivity models, letting Observable sources and signal consumers meet in one component
reactivity/rxjs
Introduction to RxJS and Observables
Angular leans on RxJS everywhere, and the shift it demands is thinking in streams of values over time rather than single results
RxJS Combination Operators
Combination operators merge several Observables into one, and choosing between forkJoin, combineLatest, and zip is a timing decision
RxJS Creation Operators
Creation operators build Observables for you, so you stop hand-writing subscribe and teardown functions for every source
RxJS Error Handling and Conditional Operators
An error terminates an Observable, so catchError and retry exist to replace or restart the stream rather than resume it
RxJS Filtering Operators
Filtering operators drop values on their way through a stream, the Observable counterpart to filtering an array
RxJS Higher-Order Observables and Utility Operators
Higher-order operators map each value to an inner Observable, and the flattening strategy decides what happens when they overlap
RxJS Subjects, Multicasting, and Unsubscribe in Angular
A Subject multicasts one execution to many subscribers, which is also where unsubscribing in Angular stops being optional
RxJS Transformation Operators
Pipeable operators return a new Observable instead of mutating the source, and transformation operators reshape each value in flight
recipes/auth
App Initialization: Silent Token Restoration on Reload
A silent refresh call before the app renders is what keeps in-memory tokens from logging users out on every page reload
JWT Interceptor: Breaking the Circular Dependency
The cycle between an auth service and its JWT interceptor is an architecture problem, and extracting a token service is the fix
Step-up Authentication: Re-auth for Sensitive Actions
An interceptor can catch a step-up challenge, collect fresh credentials, and retry the original request without the caller knowing
Token Storage: Where Tokens Should Actually Live
Access tokens belong in memory and refresh tokens in an HttpOnly cookie, because anything in localStorage is readable by any script
recipes/components
Component Communication: When NgRx Is Overkill (And When It Isn't)
Where shared state belongs is usually answered by a scoped service and signals, with NgRx as the exception rather than the default
Virtual Scrolling: Rendering 10,000 Items Without Killing the Browser
Rendering only the visible window keeps a ten-thousand row list responsive, provided tracking and viewport height are set correctly
recipes/form-and-search
A Search Engine in Five Stages
Search as you type grows in five stages, from debounce and switchMap to URL-synced filters with stale-while-revalidate caching
Async Validation: Username Availability Without the Flicker
A server-backed availability check needs debouncing, deduplication, and explicit pending states or the field flickers and hangs
Dynamic Forms: Shape That Changes With User Input
Forms that change shape at runtime lose user input unless you cache removed control values and revalidate the controls yourself
Multi-Step Wizards: State That Survives the Back Button
A wizard's state has to outlive its step components, which is why the form model belongs in a subtree-scoped service
Optimistic Updates: UI That Feels Instant Without Lying
Applying the user's intent locally and rolling back on failure is what makes an interface feel instant without misreporting results
recipes/http
Request Deduplication: One Call When Five Would Fire
When several callers ask for the same resource at once, an in-flight cache collapses them into a single HTTP round trip
Retry with Backoff: Surviving Transient API Failures
Retrying with exponential backoff hides transient failures, but only if the policy separates retryable errors from terminal ones
Upload and Download Progress with HttpClient
One custom operator turns HttpClient's raw event stream into the status and percentage a progress bar can bind to directly
WebSocket Integration: Real-Time Data Without the Reconnection Hell
One shared connection with backoff reconnection and a heartbeat is what separates a working real-time layer from a demo
recipes/performance
Bundle Splitting: Beyond Lazy Routes
Lazy routes alone rarely shrink the initial bundle, because the weight usually sits in libraries the entry point still imports
Image Optimization: LCP Wins Without Rewriting Everything
NgOptimizedImage handles the sizing, format, and priority hints that most LCP problems come down to, without rewriting the page
Performance Auditing: "The App Is Slow, Where Do I Look?"
Pick one symptom and profile it before optimizing, because blind OnPush and trackBy changes usually spend the budget on nothing
Web Workers: Heavy Computation Without Freezing the UI
Moving CPU-heavy work to a worker keeps the UI responsive, and Comlink makes the message protocol read like ordinary method calls
recipes/reactivity
Custom RxJS Operators with takeUntilDestroyed
A custom operator can bake teardown into a polling stream, so consumers get cleanup on destroy without writing ngOnDestroy
Race Conditions: Picking the Right Higher-Order Operator
Most Angular race conditions are one wrong higher-order operator, and switchMap, exhaustMap, concatMap, and mergeMap each fix a different one
recipes/state-management
rendering
@defer Blocks
Deferred blocks code-split part of a template, so its dependencies download only when a trigger such as viewport entry fires
SSR & Hydration
Server rendering ships HTML the browser paints immediately, and hydration reuses that DOM instead of discarding and rebuilding it
ViewRef & Renderer2
The view container and renderer APIs cover the small share of DOM work that Angular templates cannot express declaratively
routing
Angular Router
The router still maps a config tree onto outlets, but provideRouter replaced RouterModule.forRoot and the routing module around it
Angular Router — Feature Modules, Child Routes, and Services
Child routes and per-feature route files keep a growing app's routing config from collapsing into one flat list at the root
Angular Router — Guards and Resolvers
Guards and resolvers hook into the router's navigation cycle, so access checks and data loading finish before a route renders
Angular Router — Lazy Loading Modules
Lazy loading defers a feature's code until someone navigates to it, so the initial bundle carries only what the first screen needs
Router Outlets
An outlet marks where the matched component is inserted, and named outlets let independent sections update from a single URL
routerLink & Directives
routerLink navigates inside the app instead of asking the browser for a new document, and routerLinkActive marks the current route
state-management
NgRx Signal Store
Signal Store keeps the NgRx family but drops the Redux ceremony, replacing actions and reducers with state signals and methods
NgRx Store
NgRx brings Redux to Angular with real boilerplate cost, paid back in predictable state transitions and time-travel debugging
NGXS
NGXS keeps unidirectional data flow but expresses actions as classes and state changes as decorated methods on a state class
testing
Component Harnesses
A harness puts a stable API in front of a component's DOM, so restructuring the template stops breaking every test that touched it
E2E Testing
End-to-end tests drive a real browser through whole user journeys, catching production-build and cross-component failures units miss
Integration Tests
Integration tests widen the boundary to a real component tree or route, faking only what genuinely sits outside the app
Unit Tests
TestBed builds a minimal Angular environment per spec, so one component runs with real DI and templates but fake dependencies
tooling
Angular Elements
Angular Elements wraps a component as a native custom element, so a React, Vue, or plain HTML page can embed it without Angular
Builders
Every CLI command delegates to a builder, a schema-validated task function you can configure precisely or replace with your own
Built-in i18n
Built-in i18n inlines translations at build time into one bundle per locale, costing nothing at runtime but tying language to the URL
Input Coercion: built-in transforms and CDK utilities
Built-in input transforms replaced the CDK setter dance for boolean and number inputs, leaving CDK coercion for the rest
Ionic
Ionic adds a platform-adaptive mobile UI layer to Angular, and Capacitor packages the same codebase into real iOS and Android apps
ngx-translate
Loading translation JSON at runtime buys instant language switching, at the cost of parsing and lookup work in the browser
Nx
Nx makes a monorepo practical by mapping project dependencies, then rebuilding and retesting only the projects a change affects
Progressive Web Apps (PWA)
Registering a service worker gives an Angular app offline support, cached repeat loads, background updates, and installability
Sass & SCSS
Angular compiles SCSS out of the box, so the real work is pairing Sass authoring features with component style encapsulation
Schematics
A schematic writes files through a virtual tree rather than the disk, which is what makes generation previewable and safe to abort
NestJS
foundations
Bootstrap and lifecycle hooks
The port is bound only after every bootstrap hook resolves, and shutdown hooks do not run until you opt in
Configuration and environment
Config is the only untyped, unvalidated, externally supplied input, so convert and validate all of it once, at boot
Controllers and routing
There is no routing table — precedence emerges from declaration order, which is why a shadowed route raises no error
Custom providers and injection tokens
Four provider forms collapse into one runtime decision, construct the class or call the factory and await it
Decorators and metadata reflection
Decorators annotate and the framework behaves, so a decorator that does nothing wrote the wrong key or the wrong target
Modules and the module graph
A module is a visibility boundary with an identity, and those two properties are enforced by different mechanisms
Providers and dependency injection
Nest injects tokens, not types, so every resolution error is a wrong token or a module that cannot see it
Scopes and lifetimes
Scope belongs to a dependency tree, declared in one place and taking effect upward through everything that injects it
TypeScript for Nest
Type erasure is a runtime property in Nest, because the framework reads your types back through reflection
request-lifecycle
Exception filters
Filters are the only layer where exactly one participant runs, so adding a filter can mean removing another
Execution context and Reflector
The execution context is a typed view over one arguments array, so switching it to the wrong transport fails silently
Execution order
The pipeline is a nesting rather than a list, so guards sit outside the interceptor chain and pipes run inside it
Guards
A guard runs before validation, so the body it reads is raw input and returning false always renders as 403
Interceptors
The handler arrives as a deferred observable, so an interceptor holds the decision to invoke it at all
Middleware
Middleware is the adapter's layer, wrapped just enough to reach filters and inject providers, and every limit follows
Pipes
A pipe sees one argument and learns its type from emitted metadata, so an interface DTO disables validation silently
validation
DTOs and class-validator
A DTO is not a type but a runtime object carrying metadata, so a nested property without @Type passes ValidationPipe silently
Serialization and response shaping
Serialization is the direction where a mistake leaks rather than rejects, and Exclude gives false confidence three ways
ValidationPipe in depth
Three of ValidationPipe's defaults are the opposite of its reputation, starting with transform being off