Backend developer interview questions and how to answer them
Backend developer interviews ask how you design APIs, model and query data, keep a service correct under concurrency, and keep it running when something fails. Alongside a general coding round, expect questions on databases and indexes, caching, queues, authentication and debugging production problems. The best answers name a trade-off every time: what you gain, what it costs, and when you would choose the other option.
By Evin JohnPublished 5 min read
Areas a backend interview covers
| Round | Format | What is assessed |
|---|---|---|
| Coding | One or two problems in a shared editor | Data structures, clean code, testing your own solution |
| API and data design | Design the endpoints and tables for a small product | Modeling, naming, constraints and query patterns |
| System design | A larger service, for mid-level and senior roles | Scaling, storage choices, failure handling |
| Debugging or code review | Read a service's code or logs and find the problem | Practical judgment and production experience |
| Behavioral | Past projects, incidents and collaboration | Ownership and communication |
API design questions
- Design a REST API for a bookstore. Use nouns for resources, the standard HTTP methods, sensible status codes, and consistent error bodies. Mention filtering, sorting and pagination for list endpoints.
- What makes a request idempotent, and why does it matter? Repeating it has the same effect as doing it once. It matters because clients retry after timeouts. For payments and order creation, an idempotency key lets the server detect a repeat.
- PUT versus PATCH? PUT replaces the whole resource, PATCH changes part of it.
- Offset pagination or cursor pagination? Offsets are simple but slow on deep pages and unstable when rows are inserted. Cursors stay fast and consistent, at the cost of jumping to an arbitrary page.
- How do you version an API? In the path or a header. The important part is not breaking existing clients: add fields, do not remove or rename them without a deprecation period.
- REST, GraphQL or gRPC? REST for public and simple resource APIs, GraphQL when clients need flexible shapes of data, gRPC for internal service calls where speed and strict contracts matter.
Database questions
| Question | Substance of the answer |
|---|---|
| How does an index speed up a query, and what does it cost? | A sorted structure, commonly a B-tree, that avoids scanning the table. Every write must update it, and it uses storage |
| A query is slow. What do you do? | Read the query plan, check for a missing or unused index, look at the rows scanned versus returned, then consider rewriting or caching |
| What is the N+1 query problem? | One query for a list and then one more per item. Fix with a join or a batched fetch |
| What does ACID mean? | Atomicity, consistency, isolation and durability. Give an example such as a transfer between two accounts |
| What are isolation levels? | Rules for what concurrent transactions can see. Lower levels allow anomalies such as non-repeatable reads in exchange for less locking |
| Optimistic or pessimistic locking? | Optimistic checks a version on write and retries on conflict, good when conflicts are rare. Pessimistic locks the row first, good when they are common |
| When would you choose a NoSQL store? | Simple access by key at high volume, flexible documents, or very wide scale. You give up joins and some transactional guarantees |
Composite indexes are a favorite follow-up. Know that column order matters: an index on (customer_id, created_at) helps a query that filters by customer and sorts by date, and does not help one that filters only by date. Storage trade-offs are covered further in SQL versus NoSQL.
Concurrency and reliability questions
- Two requests buy the last item at the same moment. What happens? Describe the race, then a fix: a conditional update that only succeeds while stock is above zero, a row lock inside a transaction, or a unique constraint.
- How do you call a service that sometimes fails? Set a timeout, retry a limited number of times with exponential backoff and jitter, and only retry operations that are safe to repeat.
- What is a circuit breaker? After repeated failures it stops calling the dependency for a while and fails fast, which protects both sides.
- When would you use a message queue? To move slow work out of the request, absorb spikes, and decouple services. Mention at-least-once delivery, which means consumers must tolerate duplicates.
- What is a dead-letter queue? A place for messages that keep failing, so they can be inspected without blocking the rest.
- How do you keep two systems consistent without a distributed transaction? An outbox table written in the same transaction as the data change, with a process that publishes events from it.
Caching questions
Expect "where would you add a cache, and how do you keep it correct?" Describe cache-aside reads, a time to live, and invalidation on write. Then raise the hard parts yourself: stale data, many requests rebuilding the same missing key at once, and what happens when the cache is down. There is a full treatment in the caching guide.
Security questions
- How should passwords be stored? Hashed with a slow, salted algorithm designed for passwords, such as bcrypt or Argon2. Never encrypted for later reading, never with a fast general-purpose hash.
- Sessions or tokens? Server-side sessions are simple to revoke. Signed tokens avoid a lookup but are hard to revoke before they expire, so keep them short-lived.
- How do you prevent SQL injection? Parameterized queries everywhere. Never build SQL by joining strings with user input.
- Authentication versus authorization? Who you are versus what you may do. Many real breaches come from skipping the second check on an object the user does not own.
- How do you handle secrets? Out of the code and the repository, in a secrets manager or environment configuration, rotated and scoped to what each service needs.
Debugging and production questions
- "Latency doubled after a deploy. Walk me through it."Confirm with metrics, compare against the previous version, check which endpoints and which dependency calls slowed, and roll back if users are affected while you investigate.
- "Memory grows until the service restarts."Look at what is retained: unbounded caches, listeners never removed, or large responses held in memory. Take a heap profile and compare over time.
- "Errors appear for one customer only."Reproduce with their data, check for an unusual size, encoding or configuration, and search logs by request ID.
Interviewers listen for observability habits: structured logs, metrics for rate, errors and duration, and tracing across services. Saying "I would add a log line and redeploy" as the first step is a weak answer for a senior role.
Behavioral questions for backend roles
- Tell me about an outage you were involved in. What did you change afterward?
- Describe a technical decision you disagreed with. What did you do?
- Tell me about a migration or refactor you led. How did you reduce the risk?
- How do you decide when code is good enough to ship?
How to prepare
Pick one service you have built and be ready to draw it: endpoints, tables, indexes, the slowest query, and the worst failure it has had. Most backend interviews can be answered from one well-understood system. Then practice explaining trade-offs out loud. If you rehearse with Natively, an interview copilot for Mac and Windows, it keeps a transcript of your mock session on your computer, and in practice sessions it can read a schema or code snippet from a screenshot and answer questions about it.
Questions people ask
What questions are asked in a backend developer interview?
API design, database indexes and transactions, the N+1 query problem, race conditions, retries and timeouts, caching, message queues, password storage, and debugging a production problem.
How do I answer backend design questions well?
State the trade-off every time: what the choice gains, what it costs, and when you would pick the alternative. Raise failure cases yourself before the interviewer asks.
What database topics should a backend developer know?
How indexes work and what they cost, reading a query plan, ACID, isolation levels, optimistic and pessimistic locking, and when a NoSQL store fits better than a relational one.
What is idempotency, and why do interviewers ask about it?
An idempotent request has the same effect whether it is sent once or several times. Clients retry after timeouts, so payment and order endpoints need it to avoid duplicates.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
