See what's new

Testlify
HR & recruitment
Last updated on: 10 November 202618 min read

MERN stack developer interview questions: 40 to ask in 2026

40 questions to ask MERN developers on MongoDB, Express, React and Node.js, with what good answers cover, red flags and a simple scorecard.

MERN stack developer interview questions: 40 to ask in 2026

These MERN stack developer interview questions help hiring teams check whether a candidate can build and run a full web application with MongoDB, Express, React and Node.js. The 40 questions cover JavaScript, front end, API, database and system design, plus practical tasks and behavioral prompts. Each one lists what a strong answer covers and a red flag to listen for. Recruiters and engineers can then score the same answer the same way. Use the 1 to 4 scorecard at the end, and screen candidates with a skills test first so interview time goes to people who can code.

TL;DR / Key Takeaways
  • Ask about all four layers: MongoDB, Express, React and Node.js, plus plain JavaScript. A good MERN hire is solid in each, not brilliant in one.
  • Screen with a skills test before the first call, then use 35 technical questions, 3 practical tasks and 2 behavioral questions in the interviews.
  • Junior candidates should explain the basics clearly. Senior candidates should talk about trade-offs: indexes, caching, auth tokens, scaling and failure handling.
  • Score every answer on a 1 to 4 scale with written anchors, so interviewers compare evidence instead of impressions.
  • Common red flags: no hooks knowledge, JWTs stored without a reason, no indexes on large collections and no plan for errors.
  • 84% of developers use or plan to use AI tools, so set a clear AI policy for take-home tasks and check understanding live.
Summarise this post with:ChatGPTGeminiClaudeGrokPerplexity

What does a MERN stack developer do?

A MERN stack developer builds web applications in JavaScript from database to browser: data in MongoDB, an API in Express running on Node.js, and the user interface in React. Because one language covers every layer, one developer can design a schema, write the API and ship the screen that uses it.

The stack stays popular because its parts are among the most used tools in web work. In the Stack Overflow Developer Survey 2025, 66% of respondents used JavaScript, 48.7% used Node.js, 44.7% used React and 24% used MongoDB. That popularity cuts both ways for hiring: many candidates list the stack, but far fewer have run it in production.

If your team needs a refresher on the database layer, the Testlify glossary explains MongoDB in plain language. To check single layers before the interview, Testlify also has an Express.js test and a React test.

Build your dream team — Book a product demo

Which skills should MERN stack developer interview questions test?

MERN stack developer interview questions should test four layers and the glue between them. The database layer (MongoDB) covers schema design and query speed; the API layer (Express) covers routing, middleware, errors and security; the front end (React) covers state and rendering; the runtime (Node.js) covers async code. Shared skills are JavaScript, REST design, testing and deployment.

MERN stack developer interview questions mapped to skills by layer: MongoDB, Express, React and Node.js

Shift the weights to the job. A product team with a heavy dashboard should weigh React more; a team building data-heavy APIs should weigh MongoDB and Express more.

How should you structure a MERN stack developer interview?

A MERN stack developer interview works best in five steps: an online skills test, a short recruiter screen, a technical round, a practical task and a team round. Screening skills first means only candidates who can code reach the hour-long technical interview, which saves engineer time on every role.

MERN stack developer interview process in five steps, from skills test to team round

Keep the interview structured. The US Office of Personnel Management describes a structured interview as one where every candidate gets the same questions in the same order, and every answer is scored against the same rating scale. Pick 8 to 12 questions from the lists below for each round, write them into the scorecard and use them for every candidate on that role.

If you want ready-made MERN stack interview questions scored automatically before anyone joins a call, run them as an online test at step 1 and save the live interview for follow-ups. Our guide on evaluating MERN stack developer skills with an assessment covers how to set that step up.

Pro tip: Give the candidate the stack and the format of each round in advance. Strong developers prepare better answers, and you learn more from them.

Which JavaScript and Node.js questions should you ask?

JavaScript and Node.js questions should check how the candidate thinks about asynchronous code, because almost every bug in a Node.js API comes back to timing: a missing await, a blocked event loop or an unhandled promise.

1. How does the Node.js event loop work?

What a strong answer covers: The call stack runs synchronous code; finished async work queues callbacks; the event loop moves them onto the stack when it is empty. Strong candidates mention microtasks (promises) running before timers and how CPU-heavy work blocks every request. The MDN guide to the JavaScript execution model is a good reference for interviewers.

Red flag: Says Node.js is "multi-threaded so it never blocks".

2. What is the difference between callbacks, promises and async/await?

What a strong answer covers: Callbacks nest and spread error handling; promises chain and centralize errors; async/await is promise syntax that reads like synchronous code. Good candidates mention try/catch with await and Promise.all for parallel calls.

Red flag: Uses await inside a loop for independent calls and cannot say why it is slow.

3. What is a closure, and where have you used one?

What a strong answer covers: A function that keeps access to variables from the scope where it was created. Real examples: a counter, a memoized function, a React hook that reads state.

4. How do let, const and var differ?

What a strong answer covers: Block scope versus function scope, hoisting and the temporal dead zone, and why const prevents reassignment but not mutation of an object.

5. How do you handle errors in an async Node.js application?

What a strong answer covers: try/catch around awaited calls, a central error middleware in Express, logging with context, and a process-level handler for unhandled rejections that logs and restarts cleanly.

Red flag: Swallows errors with an empty catch block.

6. What are streams in Node.js, and when would you use one?

What a strong answer covers: Streams process data in chunks instead of loading it all into memory. Good uses: file uploads, CSV exports, piping a large MongoDB cursor to a response.

7. How do CommonJS and ES modules differ in Node.js?

What a strong answer covers: require versus import, synchronous versus static loading, the "type": "module" setting in package.json and how mixing both causes errors.

8. How would you stop a CPU-heavy task from blocking your API?

What a strong answer covers: Move it to worker threads, a job queue or a separate service; never run it inside the request handler.

Which React questions show real front-end skill?

React questions show real skill when they move past definitions to state, rendering and data fetching. A candidate who only knows class lifecycle methods learned React before 2019 and has not kept up; most current code uses function components and hooks.

9. What problem do React hooks solve?

What a strong answer covers: Hooks let function components hold state (useState) and run side effects (useEffect) without classes, and let teams share logic through custom hooks.

10. When does useEffect run, and how do you avoid an infinite loop?

What a strong answer covers: After render, again when a dependency changes; cleanup runs before the next effect and on unmount. Loops come from setting state that is also a dependency, or from objects recreated on each render.

Red flag: Leaves the dependency array off by habit, or disables the lint rule.

11. Why does React need a key on list items?

What a strong answer covers: Keys let React match items between renders. Using an array index breaks when items are inserted, sorted or deleted, and can mix up input state.

12. How does the virtual DOM affect performance?

What a strong answer covers: React compares the new element tree with the previous one and updates only what changed. Strong candidates add that the virtual DOM is not free, and that avoiding unnecessary renders matters more.

13. How do you manage state that many components need?

What a strong answer covers: Lift state up first, then Context for low-frequency values like theme or user, and a store such as Redux Toolkit or Zustand for complex shared state. Server data often belongs in a fetching library like React Query rather than global state.

14. How do you handle forms and validation in React?

What a strong answer covers: Controlled versus uncontrolled inputs, a form library such as React Hook Form or Formik, schema validation, and validating again on the server because client checks can be bypassed.

15. How would you find and fix a slow React page?

What a strong answer covers: Measure first with React DevTools Profiler, then fix the cause: memoize expensive work with useMemo, stabilize callbacks, split code with lazy loading and virtualize long lists.

16. How do you call your Express API from React safely?

What a strong answer covers: A single API client, loading and error states, cancelling requests on unmount, sending credentials only where needed and never putting secrets in front-end code.

Key takeaway: For React, listen for "it depends, and here is how I would measure it". Candidates who jump to useMemo everywhere have learned rules, not reasons.

Which Express and API questions should you ask?

Express and API questions should check how the candidate designs routes, handles errors and protects data, because the API is where security mistakes in a MERN application usually happen.

17. What is middleware in Express, and in what order does it run?

What a strong answer covers: Functions with access to the request, response and next; they run in the order they are registered. Examples: body parsing, logging, auth checks, rate limiting and a final error handler with four arguments.

18. How do you design a RESTful API for a resource like orders?

What a strong answer covers: Nouns in paths, HTTP methods for actions, correct status codes (201 on create, 404 when missing, 422 on validation), pagination and versioning.

19. How do you implement authentication in a MERN application?

What a strong answer covers: Hashing passwords with bcrypt or argon2, issuing a short-lived access token and a refresh token, and a clear choice on storage: httpOnly cookies reduce exposure to XSS, while tokens in localStorage are easier but riskier.

Red flag: Stores plain-text passwords or long-lived tokens in localStorage without knowing the trade-off.

20. What is the difference between authentication and authorization?

What a strong answer covers: Authentication proves who the user is; authorization decides what that user may do. Strong candidates check ownership on every request, not only on the front end.

21. What is CORS, and how do you configure it?

What a strong answer covers: A browser rule that blocks cross-origin requests unless the server allows them. Configure an allow-list of origins in the cors middleware, never a wildcard with credentials.

22. How do you protect an Express API from common attacks?

What a strong answer covers: Input validation, NoSQL injection protection (rejecting $ operators in user input), rate limiting, secure headers with Helmet, dependency updates and secrets in environment variables. Candidates who know the OWASP Top 10 can name the risk behind each control.

23. How do you handle errors consistently across an API?

What a strong answer covers: One error middleware, custom error classes with status codes, a stable error response shape, and logs with a request id so support can trace a failure.

Which MongoDB questions separate juniors from seniors?

MongoDB questions separate juniors from seniors at schema design and performance. A junior can write CRUD queries; a senior knows when to embed or reference data, which indexes a query needs and how to read an explain plan.

24. How does MongoDB differ from a SQL database?

What a strong answer covers: Documents in collections instead of rows in tables, flexible schemas, and joins done through embedding or $lookup. Good candidates say when they would still pick SQL, such as heavy multi-table reporting.

25. When do you embed data, and when do you reference it?

What a strong answer covers: Embed data read together and bounded in size (an order and its line items); reference data that grows without limit or is shared (users and their comments). The 16 MB document limit is a useful detail.

26. How do indexes work in MongoDB, and how do you pick them?

What a strong answer covers: Indexes stop full collection scans. Compound indexes follow the equality, sort, range order; explain() shows whether a query uses one; too many indexes slow writes.

Red flag: Has never looked at a query plan.

27. What is the aggregation pipeline used for?

What a strong answer covers: Stages such as $match, $group, $sort, $project and $lookup to filter, summarize and join data on the server. Strong candidates put $match first so the pipeline can use an index.

28. What does Mongoose add on top of the MongoDB driver?

What a strong answer covers: Schemas, validation, middleware hooks and population of references. Senior candidates mention the cost: lean() for read-heavy endpoints and care with large populate chains.

29. When do you need transactions in MongoDB?

What a strong answer covers: Multi-document transactions on a replica set when several writes must succeed together, such as moving stock and creating an order. Good schema design makes them rare.

30. How would you speed up a slow MongoDB query?

What a strong answer covers: Find it with the profiler or slow query logs, run explain(), add or fix an index, project only needed fields, paginate with a range on an indexed field instead of large skip values, and cache hot reads.

Which senior MERN stack developer interview questions test system design?

Senior MERN stack developer interview questions should test system design: how the candidate scales an app, keeps it reliable and ships it safely. Ask these only for mid-level and senior roles, and let the candidate draw or talk through a design for 10 to 15 minutes per question.

What junior, mid-level and senior candidates should show in MERN stack developer interview questions

31. How would you design a MERN app for 100,000 daily users?

What a strong answer covers: Stateless Node.js servers behind a load balancer, a CDN for the React build, MongoDB indexes and a replica set, Redis for sessions or hot data, and monitoring before launch.

32. How would you add real-time updates, such as live notifications?

What a strong answer covers: WebSockets or Socket.IO, scaling across servers with a pub/sub layer, and falling back to polling where connections drop.

33. How do you deploy a MERN application and manage configuration?

What a strong answer covers: Docker images, a CI pipeline that runs tests, environment variables per environment, zero-downtime deploys and a rollback plan.

34. How do you test a MERN application?

What a strong answer covers: Unit tests with Jest, API tests with Supertest against a test database, React Testing Library for components and a few browser tests with Playwright or Cypress for key flows.

35. Would you choose server-side rendering or a single-page app, and why?

What a strong answer covers: SSR (often with Next.js) helps SEO and first load; a single-page app is simpler for logged-in dashboards. The answer should depend on the product, not on preference.

Which practical coding tasks should you set?

Practical coding tasks should mirror the job and fit in 60 to 90 minutes live, or 2 to 3 hours as a take-home with a clear brief. Score them on working code, structure, error handling and how the candidate explains choices.

36. Build a small REST endpoint with validation

Ask for a POST /tasks endpoint in Express that saves to MongoDB, validates input and returns the right status codes. What good looks like: separate route and model, validation errors returned as 422 with a clear message, and a test or two.

37. Fix a buggy React component

Hand over a component that fetches data, re-renders forever and leaks state after unmount. What good looks like: the candidate reads before typing, fixes the dependency array, adds cleanup and explains each change.

38. Write a MongoDB aggregation for a report

Ask for total order value per customer for the last 30 days, sorted high to low. What good looks like: $match on date first, $group with $sum, $sort, and a note on the index that would make it fast.

Which behavioral questions reveal real project experience?

Behavioral questions reveal real experience when they ask for one specific project and then probe the details. Ask for the situation, the candidate's own part, the decision and the result, and follow up until you hear trade-offs.

39. Tell me about a MERN project you shipped. What would you change now?

What a strong answer covers: A clear role, a real constraint (deadline, scale, legacy code), a decision with a trade-off and an honest lesson.

Red flag: Describes only what "we" did and cannot explain any part personally.

40. Tell me about a production bug you traced across the stack.

What a strong answer covers: How the bug showed up, how they followed it from the React screen through the API to the database, the fix, and what they added (a test, an alert) so it would not return.

For more role variations, see our lists of full stack developer interview questions and MEAN stack developer interview questions.

How do you score answers and spot red flags?

Score answers on a 1 to 4 scale with a written anchor for each level, agreed before the first interview. Each interviewer scores alone, writes the evidence and only then compares notes, so the loudest opinion does not decide.

Score

Label

What it sounds like

4

Strong

Correct answer, explains trade-offs, gives a real example and knows the limits

3

Solid

Correct answer with a working example, few trade-offs

2

Partial

Knows the term, unclear on how or why, needs prompting

1

Weak

Wrong, vague or memorized wording that falls apart under one follow-up

Common red flags across MERN stack interviews:

  • Definitions without use: Can define the virtual DOM or middleware but cannot say where it mattered in their own code.
  • No security instinct: Trusts client-side validation, puts secrets in React code or cannot explain token storage.
  • No measurement: Talks about performance fixes without ever profiling a page or reading a query plan.
  • Outdated React: Answers every state question with class components and lifecycle methods.
  • Blames tools: Explains past failures only as the framework's fault.

Hiring managers new to engineering roles can use the scorecard as written; the "what a strong answer covers" notes above are enough to tell a 2 from a 4. For a wider view of the role, read our guide to hiring a full stack developer.

How do you keep coding rounds fair when candidates use AI?

Coding rounds stay fair when the AI rules are clear and every candidate follows the same ones. AI assistants are now normal at work: in the Stack Overflow Developer Survey 2025, 84% of respondents used or planned to use AI tools, and about half of professional developers used them daily. The same survey found 46% distrust the accuracy of AI output, which is why understanding still matters.

Three ways to handle it:

  • State the policy: Say in the invite whether AI tools are allowed on the take-home. If they are, ask candidates to note where they used them.
  • Check understanding live: Spend 15 minutes asking the candidate to change their own take-home code. People who wrote or truly understood it adapt quickly.
  • Proctor the screening test: For the early online test, use proctoring so scores reflect the candidate's own work. Testlify includes 20+ proctoring checks, such as tab and copy/paste tracking and AI assistance detection, explained on the anti-cheating and proctoring page.

How can a skills test shorten MERN hiring?

A skills test shortens MERN hiring by removing candidates who cannot code before anyone books an interview. With Testlify, you can combine a MERN role test with focused checks such as the Node.js test or the MongoDB test, add your own coding questions, and invite candidates from your ATS through 100+ integrations. Every result is scored automatically, so your engineers spend interview time on the 40 questions above only with candidates who already passed.

Ready to try it? Browse the 3,500+ tests in the Testlify test library or start a 7-day free trial, no credit card needed.

Frequently asked questions (FAQs)

Get started.

Hire on proof, not resumes.

Run your first skills-based assessment free — no credit card required.

We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking "Accept All", you consent to our use of cookies.