Backend interview questions
37 questions, easy to hard. Read one, then answer it out loud: an AI interviewer follows up, hints when you're stuck and grades your answer.
Backend interviews test how you build servers people rely on: HTTP, REST and GraphQL APIs, authentication, error handling, background jobs and caching.
HTTP and Web Servers
A junior developer has only ever called APIs through a library and asks what an HTTP request and response actually contain. Walk them through the parts of each, using a request to load a user's profile as the example.
What a strong answer covers
- What a request carries: what you want done, to which resource, plus metadata and sometimes a payload.
- What comes back: an outcome code, metadata and usually a payload.
- Concrete header examples and what each is for.
- Why every request has to identify the user again.
Common mistake: Describing the library or framework you use instead of what actually travels over the wire.
- Safe and Idempotent Methods
- easy
- Pro
A teammate built a link in an email that deletes an account when it's opened, using a plain GET request. Explain what safe and idempotent mean for HTTP methods, which common methods are which, and why this link is a problem.
- Cookies Explained
- easy
- Pro
Your app sets a session cookie when a user signs in. Explain how cookies are set and sent, and what the main cookie attributes do and why a session cookie should use them.
- How a Web Server Handles Requests
- medium
- Pro
Explain what happens inside a typical web framework from the moment a request reaches your server to the moment the response is sent, including routing and middleware.
- Reverse Proxies
- medium
- Pro
Your Node app runs behind a reverse proxy such as nginx. Explain what a reverse proxy does, why you'd put one in front of an application server, and one problem it can cause for the app if you're not careful.
- HTTP/1.1, HTTP/2 and HTTP/3
- medium
- Pro
A colleague asks whether switching from HTTP version one point one to version two or three would make your site faster. Explain the main differences between the three versions and when the upgrade helps.
- Stream a Large Response
- hard
- Pro
An export endpoint builds a two-gigabyte CSV file in memory before sending it, and the server keeps running out of memory. Explain how you'd stream the response instead, and what you need to watch out for.
REST and GraphQL in Practice
Your sign-up endpoint trusts whatever JSON the client sends, and the database has filled with empty names and impossible ages. Explain how and where you'd validate request input on the server.
- Consistent Error Responses
- easy
- Pro
Every endpoint in your API reports errors differently: some return plain text, some a message field, some an empty body. Explain how you'd design one consistent error format and make sure every endpoint uses it.
- Filter and Sort a Collection
- medium
- Pro
Clients want to filter your list of orders by status and date range, and sort by date or total. Explain how you'd design the query parameters and implement them safely on the server.
- Handle File Uploads
- medium
- Pro
Users can upload profile photos to your API. Explain how you'd handle the upload on the server safely and efficiently, from the request to where the file ends up.
- GraphQL Resolvers and Batching
- medium
- Pro
A GraphQL query asks for fifty posts and each post's author, and your logs show fifty-one database queries. Explain how resolvers cause this and how a batching loader fixes it.
- Limit GraphQL Query Cost
- hard
- Pro
Someone sends your public GraphQL API a deeply nested query, friends of friends of friends ten levels down, and it takes the server down. Explain how you'd protect a GraphQL API from expensive queries.
Authentication and Sessions
- Follow a Login
- easy
Walk me through what happens on the server, step by step, when a user types their email and password and presses sign in, until they see their dashboard on the next page load.
- Inside a JWT
- easy
- Pro
Your API uses JSON Web Tokens. Explain what's inside one, how the server checks it, and what you should never put in it.
- Role-Based Access Checks
- medium
- Pro
In your project management app, any signed-in user can edit any project by changing the ID in the URL. Explain the bug and how you'd implement permission checks properly.
- Build a Password Reset
- medium
- Pro
Design the forgot-password flow for your app, from the user entering their email to them signing in with a new password, and explain how you'd keep it secure.
- Access and Refresh Tokens
- medium
- Pro
Your mobile app keeps users signed in for months, but access tokens expire after fifteen minutes. Explain how access and refresh tokens work together and how you'd handle a stolen refresh token.
- Sign In with Google
- hard
- Pro
You're adding a Sign in with Google button. Explain the OAuth authorisation code flow with OpenID Connect from the click to the user having a session in your app, including the security checks along the way.
Errors and Logging
- Structured Logging
- easy
- Pro
Your server logs are free-text sentences, and finding every error for one customer means writing fragile text searches. Explain structured logging and how you'd change your logs.
- Choose Log Levels
- easy
- Pro
Your production logs are so noisy that real errors get lost, and your team argues about what counts as a warning. Explain the common log levels and give a rule of thumb for when to use each.
- Trace a Request with IDs
- medium
- Pro
A user reports that checkout failed, and the request passed through your API, a payment service and a background worker. Explain how request or correlation IDs let you follow it through all three.
- Never Swallow Errors
- medium
- Pro
You find code that catches every error, logs nothing, and returns an empty list, and customers have been seeing empty pages for a week without anyone noticing. Explain good error-handling practice in server code.
- Keep Secrets Out of Logs
- medium
- Pro
During an audit you find passwords, access tokens and full card numbers in your application logs. Explain how this happens and how you'd stop it happening again.
- Health Checks
- hard
- Pro
Your health check endpoint queries the database and every downstream service, and when one minor service went down, the platform restarted all your app servers in a loop. Explain how to design health checks properly.
Background Jobs and Queues
When a user signs up, your endpoint sends a welcome email, resizes their avatar and syncs them to the CRM before responding, and sign-up takes eight seconds. Explain how you'd move this work into background jobs.
- Retries and Dead Letters
- easy
- Pro
Some of your background jobs fail because an email provider is briefly down, and others fail every time because of a bug. Explain how you'd retry jobs and what should happen to ones that never succeed.
- Idempotent Job Handlers
- medium
- Pro
Your queue promises at-least-once delivery, and a few customers were charged twice when a worker crashed after charging but before marking the job done. Explain why this happens and how to make job handlers safe to run twice.
- Scheduled Jobs
- medium
- Pro
Your app runs a nightly cron job to send invoices, but after you scaled to three servers every customer got three invoices, and one night the job ran so long it overlapped with the next run. Explain how to run scheduled jobs safely.
- The Outbox Pattern
- hard
- Pro
When an order is placed, your code saves it to the database and then publishes an order placed message to a queue. Sometimes the save succeeds but the publish fails, and the warehouse never hears about the order. Explain the outbox pattern and how it fixes this.
One large customer imports a million records, which creates a million jobs, and every other customer's jobs wait for hours behind them. Explain how you'd make your job processing fair.
Runtimes and Caching
Your Node.js API is fast until one user uploads a big spreadsheet to be parsed, and then every other request hangs for several seconds. Explain why this happens and how you'd fix it.
- Threads, Processes and Async
- easy
- Pro
A colleague asks how a Node server, a Python server with several worker processes, and a Java server with a thread pool each handle many requests at once. Compare the three models and their trade-offs.
- Connection Pooling
- medium
- Pro
After moving your app to serverless functions, the database starts refusing connections with a too many connections error during busy periods. Explain what a connection pool is and how you'd fix this.
- Cache-Aside in Code
- medium
- Pro
You're adding Redis in front of a slow product details query. Explain how you'd implement the cache-aside pattern in code, including keys, expiry and what happens when a product is updated.
- Prevent a Cache Stampede
- hard
- Pro
The cached homepage data expires every five minutes, and each time it does, hundreds of requests hit the database at once and it slows to a crawl. Explain what's happening and several ways to prevent it.
- Graceful Shutdown
- hard
- Pro
Every time you deploy, a handful of users get connection errors and some background jobs are left half finished. Explain how a server should shut down gracefully.
Questions about practising
- How should I prepare for backend interview questions?
- Practise answering them out loud, not just reading them. Explaining an answer under follow-up questions is what interviews test. Work through the 37 questions here from easy to hard, and revisit the ones you struggle with.
- Can I practise backend interview questions with an AI?
- Yes. Open any question and start a voice session: an AI interviewer asks it, follows up on your answer, gives hints when you're stuck and grades your answer with written feedback when the call ends.
- Are these backend interview questions free?
- 5 of the 37 questions are free to practise. Sign in with Google, no card needed. Pro unlocks the rest, plus practice calls to your phone.