Backend Developer interview questions and answers

Backend interviews focus on APIs, databases, performance and reliability. Expect questions on designing endpoints, writing efficient queries, handling failures and scaling a service as traffic grows.

Skills and knowledge

  1. What makes a good REST API?

    Sample answer: Clear resource names (/orders/123, not /getOrder), correct HTTP methods and status codes, consistent error bodies, pagination for lists, versioning so changes do not break clients, and authentication on every route. Good docs, for example an OpenAPI spec, matter as much as the code.

  2. How does a database index work, and when can it hurt?

    Sample answer: Most indexes are B-trees that keep values sorted so the database can find rows without scanning the whole table, like a book index. They speed up reads on filtered or sorted columns but slow down every insert and update, and use disk. Add them for real query patterns, not on every column, and check with EXPLAIN that they are used.

  3. What is idempotency and why does it matter?

    Sample answer: An operation is idempotent if doing it twice has the same effect as doing it once. Networks fail, so clients retry; without idempotency a retried payment could charge twice. A common fix is an idempotency key sent with the request, stored with the result, so a repeat returns the first result instead of acting again.

  4. Explain database transactions and isolation levels.

    Sample answer: A transaction groups changes so they all succeed or all fail (atomic), leave data valid (consistent), do not see each other's half-done work (isolated) and survive a crash (durable). Isolation levels trade safety for speed: read committed avoids dirty reads, repeatable read keeps rows stable within a transaction, and serializable acts as if transactions ran one at a time.

  5. How would you cache data in a backend service?

    Sample answer: Cache data that is read often and changes rarely, in memory or in Redis. Decide how it expires (a time to live, or deleting the key when the data changes), and plan for a cold cache so many requests do not hit the database at once. Never cache per-user private data under a shared key.

  6. When would you use a message queue?

    Sample answer: Use a queue such as Kafka, RabbitMQ or SQS when work does not need to finish before replying to the user (sending emails, resizing images), to smooth traffic spikes, or to let several services react to one event. Consumers must handle duplicates and failures, usually with retries and a dead-letter queue.

  7. Monolith or microservices: how do you choose?

    Sample answer: A well-structured monolith is simpler to build, test and deploy, and suits most small teams. Microservices help when separate teams need to release independently or parts need to scale very differently, but they add network calls, distributed failures and more operations work. Splitting later along clear boundaries is usually safer than starting split.

  8. How do you secure an API?

    Sample answer: Authenticate every request (OAuth tokens or signed sessions), check permissions on every object, not just the route, validate all input, use parameterised queries against SQL injection, rate-limit, keep secrets out of code, use HTTPS everywhere and log security events without logging passwords or tokens.

  9. What is the N+1 query problem?

    Sample answer: It happens when code loads a list with one query and then runs another query for each item, for example one for 100 orders and 100 more for their customers. It looks fine with test data but is slow in production. Fix it with a join, a single batched query using IN, or the ORM's eager loading.

  10. How do you paginate a large API result?

    Sample answer: Offset pagination (page 5 of 20) is simple but gets slow and can skip or repeat rows when data changes. Cursor pagination returns a token pointing at the last item seen, usually based on an indexed column like id or created time, which stays fast and stable. Always cap the page size.

  11. What is the difference between authentication and authorisation?

    Sample answer: Authentication checks who you are, for example with a password, a token or single sign-on. Authorisation checks what you are allowed to do, such as whether this user may edit this invoice. Both must be checked on the server for every request; hiding a button in the UI is not security.

  12. How would you design rate limiting for an API?

    Sample answer: Count requests per user or API key in a fast shared store like Redis, using a token bucket or sliding window. Return HTTP 429 with a Retry-After header when the limit is hit, set different limits per plan or endpoint, and put a coarse limit at the edge such as a gateway or CDN to absorb abuse.

Past experience

  1. Describe a performance problem you solved.

    Sample answer: Give the symptom with numbers (an endpoint taking 4 seconds), how you measured where time went (profiling, query logs, tracing), the cause (for example an N+1 query) and the fix (a join or batch load plus an index). Finish with the new number and how you watched it afterwards.

  2. Tell me about a database migration you ran on a live system.

    Sample answer: Explain the change and why it was risky, how you made it safe (adding columns before removing old ones, backfilling in batches, dual writes, a rollback plan), how you tested it on a copy of production data and how it went. Zero downtime is the goal to mention.

What would you do?

  1. A third-party API you depend on becomes slow. What do you do?

    Sample answer: Set strict timeouts so your threads are not tied up, retry with backoff only where it is safe, and add a circuit breaker that stops calling it for a while after repeated failures. Serve cached or reduced results where possible, show users a clear message, and alert the team. Longer term, move the call off the request path into a background job.

  2. Your service's memory keeps growing until it restarts. How do you investigate?

    Sample answer: Confirm the pattern in metrics and match it to traffic or deploys. Take heap snapshots at two points and compare which objects grow, look for caches without limits, listeners never removed or large responses held in memory. Reproduce under load locally, fix, and add a memory alert.

Open Backend Developer jobs

SSumUp
Berlin, Germany

Senior Backend Engineer (Golang) - Business Account

OnsiteEngineeringFull Time
Pay not listedToday · via Arbeitnow
DDeWarmte
The Hague, Netherlands

Backend Developer (Django)

OnsiteEngineeringFull Time
€5,000 – €6,500Today · via Arbeitnow
LLio
Munich, Bavaria, Germany

Senior Backend & Platform Engineer (all genders)

OnsiteEngineeringFull Time
Pay not listedToday · via Arbeitnow
HHims And Hers
Remote · United States

Sr. Software Engineer (Fullstack/Backend)

RemoteEngineeringFulltime
Pay not listedToday · via Hims And Hers careers (Ashby)
DDecathlontechnology
Villeneuve-d'Ascq, Germany

Backend Java Software engineer (f/m/d)

OnsiteEngineeringFull Time
Pay not listedToday · via Arbeitnow
AAirship
—

Backend Java Engineer

OnsiteEngineeringFull Time
Pay not listedToday · via Arbeitnow

More interview guides