Early access

The Senior JavaScript Interview

You can build the feature. Can you defend the design?

What a senior answer sounds like, across React, Node.js and system design. Each question is tagged Junior, Mid or Senior. Answer it yourself first, then open the model answer and compare.

Includes 49 architecture scenarios, each ending with what a senior answer has to show.

The full book launches on 23 November. Sample readers get that email first.

By Petar Ivanov, author of The Conscious React and The Conscious Node. The T-Shaped Dev has 30K+ subscribers.

The gap

Mid-level answers are correct. Senior answers make a call.

You've shipped React apps and Node APIs for years, and the coding round goes fine. Then someone asks what you'd index on a 50-million-row table, or how checkout stays atomic once it splits into four services. What comes out is a list of correct terms.

That list is the mid-level answer. The senior answer uses the same tools, picks one trade-off, says what it costs, and says how you'd prove the choice was right. I put it this way in a post earlier this year: senior engineers are paid to decide, make trade-offs and reduce risk.

AI coding tools make the gap easier to see. They write the code in seconds, so the questions left for you are about the design: why this approach, what breaks first, and what you'd measure.

Where a correct answer stops

Q23.10 · What do you index, and when do indexes actually hurt?

The correct list

Index the columns your queries filter on, join on, and sort by.

Foreign keys. Postgres doesn't index the referencing column automatically.

Frequent WHERE columns, like email for login lookups.

ORDER BY columns on hot list queries.

Correct, and it stops at the list.

What it leaves out

  • The cost of each index on every write
  • When the planner ignores an index
  • How you'd prove an index helped
// Both cards quote one answer from Chapter 23. The book calls "index everything" the junior answer, then ends with what it calls the senior workflow.

The whole book is built around that difference. A Junior, Mid or Senior tag on each question names the level it tests, and the model answer shows what it takes to clear that level.

How it works

Answer first. Then open the answer.

Reading a good answer feels like progress. Saying your own answer first shows you what you actually know, and the reader is built around that order.

  1. Read the question

    Its tag names the level it tests: Junior, Mid or Senior.

  2. Answer it yourself

    Out loud or on paper. Commit to something before you look.

  3. Open the model answer

    Compare it with yours, line by line.

  4. Check the verdict and the follow-ups

    Where the answer has them, they show what to avoid and what an interviewer asks next.

Q7.7Chapter 7 · Hooks Deep DiveSenior

What belongs in a useEffect, what belongs in an event handler, and what belongs in neither?

Give it 60 seconds. Say your answer out loud before you open it.

Reveal the answer

The senior filter, in one line: effects synchronize your component with an external system. Everything else has a better home.

  1. Event handler: logic caused by a user action: POST on submit, navigate on click, show a toast, track an analytics event. If you can name the interaction that triggers it, it's a handler.
  2. Render: data derived from props or state: filtered lists, formatted names, totals. Compute it inline (memoize only if expensive).
  3. Effect: synchronization with something outside React: a subscription, a WebSocket, a browser API, a non-React widget, document title.
More

The common smells all appear on the React docs page "You Might Not Need an Effect". The same test catches the other smells. An effect that calls setState to transform data should become a value derived during render. An effect chain, where one effect's setState triggers the next, should become one computation in one place. Each unnecessary effect adds an extra render pass, a dependency array, and a place for stale bugs.

Avoid
const [submitted, setSubmitted] = useState(false);useEffect(() => {  if (submitted) postAnalytics("form_submitted"); // runs a render later, re-runs on remount}, [submitted]);
Prefer
const handleSubmit = () => {  postAnalytics("form_submitted");  setSubmitted(true);};
Avoid
Reacting to state to do what the handler already knew.
Prefer
The handler is the event.

Follow-ups an interviewer asks

Is fetching data an effect?

It's synchronization, so yes in raw React, but in application code a query library owns it; see Q7.17.

Why is the effect version of analytics worse than the handler?

It fires on remounts and StrictMode re-runs, not just the actual user action. It answers "state became X," not "user did X."

// This question is from the paid book. The free sample has 72 more in the same format.

Architecture scenarios

The round where mid and senior answers split

The book has 49 architecture scenarios with model answers, and each one ends with what a senior answer has to show. This one is from Chapter 29, Scalability & Distributed Patterns.

Architecture scenarioSenior

Your e-commerce checkout currently runs inside one service and one database transaction. The company is splitting into services: orders, payments, inventory, and notifications. A teammate proposes a distributed transaction so checkout "stays atomic." Peak traffic is 500 checkouts/sec, and product insists a customer must never be charged for an order that doesn't exist. Walk through your approach.

Write down your first three moves, then open the answer.

Show the senior answer

The senior answer, step by step

  1. Reject the distributed transaction, with reasons.

    • Pushes back with reasons

    2PC across four services means locks held across network calls, throughput capped by the slowest participant, and checkout available only when all four services are up simultaneously.

    Read the full step

    At 500/sec, coordination stalls become the outage. The atomicity requirement is real. The mechanism is wrong.

  2. Restate the invariant precisely.

    • Restates the invariant

    "Never charged for an order that doesn't exist" doesn't require atomicity. It requires ordering plus guaranteed follow-through.

    Read the full step

    Create the order first, charge second, and make sure every charge eventually resolves to a confirmed order or a refund.

  3. Design an orchestrated saga.

    • Restates the invariant

    The orders service (or a workflow engine like Temporal) drives a persisted state machine.

    Read the full step

    create order (pending) → reserve inventory → charge payment → confirm order → notify. Each step is a local transaction in one service. Compensations run in reverse on failure: charge fails ⇒ release inventory ⇒ mark order failed. Put the hardest-to-undo step (the charge) as late as possible. Orchestration over choreography here: checkout has branching and timeouts, and you want one legible place that answers "where is order 12345 stuck?"

  4. Make every hop reliable.

    • Handles failure

    Each service pairs a transactional outbox with its state change, so "inventory reserved" commits atomically with the event that announces it, with no dual writes.

    Read the full step

    All messaging is at-least-once, so every step is idempotent: the payment call carries an idempotency key derived from the order ID; consumers dedupe by message ID.

  5. Handle the stuck middle.

    • Handles failure

    The orchestrator persists saga state and enforces per-step timeouts.

    Read the full step

    A payment call that times out is ambiguous. The charge may have happened, so the recovery path queries the payment provider by idempotency key before deciding to retry or compensate. Never guess about money.

  6. Be honest in the UX and to product.

    Checkout returns "order placed, confirming" immediately; confirmation lands via push/email seconds later.

    Read the full step

    Frame eventual consistency as a product decision: a rare pending-then-refunded flow, in exchange for checkout that survives any single service being down.

  7. Operate it.

    • Handles failure

    Metrics on saga completion time, per-step failure rates, compensation counts.

    Read the full step

    Alert on sagas stuck past their timeout budget; a dead-letter path and an admin view for the ones that need a human.

What the interviewer is grading

  1. Pushes back with reasons

    Rejects 2PC with mechanism-level reasons rather than fashion.

  2. Restates the invariant

    Turns "atomic" into ordering plus follow-through, and places the charge last.

  3. Handles failure

    Covers duplicates, ambiguous timeouts and stuck sagas instead of narrating only the happy path.

The grading block, in the book's words
What the interviewer is grading: did you push back on 2PC with mechanism-level reasons rather than fashion; did you convert "atomic" into an ordering + follow-through invariant and place the charge last; and did you handle duplicates, ambiguous timeouts and stuck sagas instead of narrating only the happy path?
// From Chapter 29. Steps and the grading block are the book's text; the three criteria titles summarize its grading block.

My October review compared this answer blind against a free AI model's. The AI answer never turned "atomic" into ordering plus follow-through, and it skipped the payment call that times out without telling you whether the charge went through. The grading block checks for both.

Start with 3 chapters, free

72 questions and 3 architecture scenarios in the same format.

Send me the 3 chapters

Levels

Most of it sits at Mid and Senior

  • 594questions in Standard
  • 49architecture scenarios
  • 175self-test questions
  • 40question final exam

Questions by level

  • Junior
  • Mid
  • Senior
  • Standard594

    93 Junior273 Mid228 Senior

  • Free sample72

    11 Junior39 Mid22 Senior

Junior
You need this to get hired.
Mid
This separates a mid-level developer from a junior.
Senior
The developer-to-architect gap, including the "how would you design this?" round.
Standard has 594 questions, and 501 of them are tagged Mid or Senior. All 49 architecture scenarios are Senior.

What's inside

40 chapters in six parts, plus a final exam

640+ questions and architecture scenarios across the JavaScript stack. Standard covers Parts 1 to 5 and the final exam, and Part 6 comes with Premium.

Part 1 · 5 chapters

JavaScript & TypeScript Core

What this part covers

Closures, async code and the event loop, TypeScript from the basics to large codebases, and immutability.

  1. 1JavaScript Fundamentals
  2. 2Async JavaScriptIn the free sample
  3. 3TypeScript Essentials
  4. 4TypeScript at Scale
  5. 5Functional Patterns & Immutability

Part 2 · 10 chapters

React & Frontend

What this part covers

How React renders, hooks, composition, client and server state, performance, React 19 and Server Components, rendering strategies, frontend architecture and design systems. For a senior React interview, this is the part to start with.

  1. 6The React Rendering ModelIn the free sample
  2. 7Hooks Deep Dive
  3. 8Component Design & Composition
  4. 9State Management
  5. 10Server State & Data Fetching
  6. 11React Performance
  7. 12React 19 & Server Components
  8. 13Rendering Strategies
  9. 14Frontend Architecture
  10. 15Styling & Design Systems

Part 3 · 10 chapters

Node.js & Backend

What this part covers

The runtime, project structure, REST and GraphQL API design, errors and logging, security, databases, production performance and testing. This is where the senior Node.js questions live, from idempotency and backpressure to the event loop under load.

  1. 16Node Runtime & the Event Loop
  2. 17Modules & Project Structure
  3. 18Code Design & Patterns
  4. 19Node.js API Design (REST)In the free sample
  5. 20API Design: GraphQL
  6. 21Error Handling & Logging
  7. 22Security
  8. 23Database & Data
  9. 24Performance & Production
  10. 25Testing Node

Part 4 · 6 chapters

Full-Stack & System Design

Frontend system design interview scenarios, backend system design, distributed patterns, observability, and a bank of 20 more architecture scenarios.

  1. 26The Full-Stack Seam
  2. 27Frontend System Design
  3. 28Backend System Design
  4. 29Scalability & Distributed Patterns
  5. 30Observability & Production Readiness
  6. 31The Architecture Scenario Bank

Part 5 · 5 chapters

Engineering Craft & Tooling

Testing, CI/CD, the code review interview, and how to answer "How do you use AI?" in a senior interview.

  1. 32Testing Strategy
  2. 33Build Tooling & Bundling
  3. 34Git, CI/CD & Release
  4. 35Clean Code & Code Review
  5. 36AI-Assisted Engineering

The Final Exam

40 questions across every part, to find the gaps that are left.

Standard

Chapters 1 to 36 and the final exam. Web reader with try-then-reveal, plus EPUB.

Premium

Everything in Standard, plus Part 6 and both books (Complete editions): The Conscious React and The Conscious Node.

Free updates for the life of the product, in both tiers.

Fit

Who it's for, and who it isn't

It's for you if

  • You have 2 to 6 years of React or Node experience, and the next job title you want says "senior".
  • You get through the coding rounds and lose points in system design.
  • You're mostly frontend and the loop includes backend system design, or the other way round.
  • You haven't interviewed since some companies started running AI-assisted coding interviews and code review rounds.
  • You're already senior and want to find your blind spots before a loop or a promotion review finds them.

It's not for you if

  • You've never written React or Node. Start with my books, then come back.
  • You want LeetCode-style algorithm drills. This covers the other rounds.
  • You want video lessons. It's a book with an interactive reader.
  • You want a promised job offer. No book can honestly promise one.
Petar Ivanov

Who wrote it

Petar Ivanov

I've spent 8+ years building JavaScript systems in production. I wrote The Conscious React and The Conscious Node, and this book is built on both.

Last year I wrote about an interview I almost failed. "The interviewer hit me with tough questions on Hoisting and Closures in JavaScript. I knew the terms, but couldn't explain them clearly." Knowing a term and explaining it under pressure are two different skills. This book trains the second one, and closures and hoisting are in Chapter 1.

  • 8+ years building JavaScript in production
  • 2 books on React and Node architecture
  • 30K+ newsletter subscribers
  • 12 talks since 2020

The Conscious React: rated 4.9/5

What engineers say about my books and my newsletter

These quotes are about my earlier work. The Senior JavaScript Interview is new, so it has no reviews yet.

"It is a fantastic and easy read with simple to follow guidelines illustrated with examples. The book has been really beneficial and practical for me from day one."

Ivan LebanovHead Of Frontend Developmenton The Conscious React

"Petar is an incredibly versatile and experienced engineer. The T-Shaped Dev is your starting point no matter where you are in your SWE career."

Ákos KőművesSenior Software Engineeron The T-Shaped Dev

"Great newsletter to help you level up as an engineer! Petar shares very practical insights in a very detailed and understandable way."

Gregor OjstersekAuthor of Engineering Leadershipon The T-Shaped Dev

FAQ

Questions

Can't I just ask ChatGPT?

For a definition, yes, and you should. The gap shows up in the scenario round. In my October 2026 review I compared the book's answers blind against a free AI model's. The clear wins were all architecture scenarios, like the checkout one above, where the AI answer skipped the payment call that times out. On plain concept questions the AI answer was often close, so use it for those. You pay here for the selection and the order. That's 594 questions tagged by level, 49 scenarios that commit to a decision, and a reader that makes you answer before you look.

Is it up to date?

It's written for React 19.2 and 19.3, Express 5, Vite 8 and Tailwind v4, and it has a chapter on AI-assisted engineering. The October 2026 technical review ran or type-checked 325 of the 384 code blocks, and the failures were fixed. Updates are free for the life of the product.

I'm frontend only (or backend only). Is it for me?

Yes. Some senior frontend loops include a backend system design round, and the reverse happens too. Part 2 covers React and Part 3 covers Node, and Part 4 covers the seam and system design for both sides. If you're interviewing for a senior full stack role, the whole book applies. The level tags let you skim what you already know.

I have 3 to 5 years of experience. Is this for me?

Yes. The book is written for working developers. Focus on the Mid and Senior tags, which 501 of the 594 questions in Standard carry.

What's in the free sample?

Chapter 2, Async JavaScript; Chapter 6, The React Rendering Model; and Chapter 19, Node.js API Design (REST). That's 72 questions, 3 architecture scenarios and 15 self-test questions, free, in the same web reader plus an EPUB.

My interview is before 23 November. Will this still help?

The three free chapters are yours now. Work through them answer-first and write down every question you missed. That list is your study plan for the weeks you have. The full book opens on 23 November.

I have a few weeks. Where do I start?

Start with the part for your stack, Part 2 for React or Part 3 for Node. Then work through the architecture scenarios in Part 4, and take the final exam to find what's left. Skip the Junior questions you can already answer.

When does it launch, and what will it cost?

It launches on Monday 23 November 2026. Launch-week prices run until Monday 30 November at 23:59 PT: $79 for Standard and $149 for Premium. After that, they're $119 and $229. Standard has chapters 1 to 36 and the final exam. Premium adds Part 6, Career & the Interview Itself, and both books (Complete editions). If you already own one of my books, you'll get a credit toward this book, and the launch email has the details.

Refunds?

There's a 30-day money-back guarantee. Reply to your receipt for a full refund.

Did you use AI to write it?

It's built on my two books, The Conscious React and The Conscious Node. I used AI models in the October 2026 review: they checked 676 questions and scenarios and ran or type-checked 325 of 384 code blocks, and that review led to 285 technical fixes and 900 style fixes.

How is it different from your books?

The books teach patterns chapter by chapter. This one makes you answer first, tags every question by level, and adds new material on JavaScript and TypeScript fundamentals, system design and the interview itself. Both books come with Premium.

Free sample

Start with three chapters

72 questions and 3 architecture scenarios, free. Answer each one before you open it, and you'll see which of your answers already sound senior and which ones stop at the list.

  1. Today

    Get the free sample

    Three chapters in your inbox.

  2. 23 November

    The full book launches

    Sample readers get the email first.

  3. 30 November, 23:59 PT

    Launch-week prices end

    After that, Standard is $119 and Premium is $229.

30-day money-back guarantee

Every purchase has it. Reply to your receipt for a full refund.