1. DNS: find the server’s address for the name. 2. Connect: TCP and TLS handshake (the padlock). 3. Request: the browser sends GET /. 4. Server processes it and returns HTML. 5. Browser parses HTML, downloads CSS/JS/images, builds the page and paints it.
Say it like this in the interview
“DNS resolution, possibly cached; TCP connection and TLS handshake; HTTP request with headers and cookies; possibly a CDN or load balancer, then the app server and database; response with status and headers; then the browser parses HTML, builds the DOM and CSSOM, fetches sub-resources, runs JavaScript, lays out and paints. I can go deeper into any step.”
“GET retrieves data and must be safe; POST creates or triggers actions; PUT replaces a resource and is idempotent; PATCH partially updates; DELETE removes and is idempotent. Idempotent means repeating the request has the same effect as doing it once.”
2xx = success: 200 OK, 201 Created, 204 No Content.
3xx = go elsewhere: 301 moved permanently, 304 not modified (use your cache).
4xx = your (client’s) fault: 400 bad request, 401 who are you?, 403 I know you but no, 404 not found, 409 conflict, 422 validation failed, 429 too many requests.
“2xx success, 3xx redirection, 4xx client errors, 5xx server errors. The ones people mix up: 401 means unauthenticated, 403 means authenticated but not allowed. 502 usually means the proxy couldn’t reach the app, for example PHP-FPM or Node is down.”
The server tells the browser how long a response can be reused. When it expires, the browser asks “has it changed since this version?” and the server can reply “no, use your copy” (304).
Say it like this in the interview
“Cache-Control sets freshness, like max-age, no-store, private or stale-while-revalidate. ETag or Last-Modified enables conditional requests with If-None-Match, returning 304 Not Modified to save bandwidth.”
URLs are nouns (posts, comments); the HTTP method is the verb. No /getPosts or /deletePost.
GET /api/posts?page=2&limit=20&tag=php
POST /api/posts
GET /api/posts/42
PATCH /api/posts/42
DELETE /api/posts/42
GET /api/posts/42/comments
POST /api/posts/42/comments
Say it like this in the interview
“Plural nouns, nested resources where ownership is clear, HTTP methods as verbs, correct status codes, filtering and pagination via query parameters, consistent error format, and versioning like /v1. Authentication via tokens or cookies, rate limiting, and OpenAPI docs.”
Offset (?page=500) = “skip 10,000 rows, then give me 20”: the database still walks past 10,000 rows, and new items shift pages. Cursor (?after=id_123) = “give me 20 after this one”: fast at any depth and stable.
Say it like this in the interview
“Offset is simple and allows jumping to page N but gets slow on deep pages and skips or duplicates items when data changes. Cursor/keyset pagination uses an indexed column, WHERE id < :cursor ORDER BY id DESC LIMIT 20, which is fast and stable; ideal for feeds and infinite scroll.”
Give each payment attempt a unique ticket number. If the server sees the same ticket again, it returns the original result instead of charging again.
Say it like this in the interview
“Idempotency keys: the client generates a unique key per operation and sends it in a header; the server stores the key with the result, and on a retry with the same key returns the stored response. Combined with a unique database constraint and the payment provider’s own idempotency support.”
REST: many fixed endpoints, each returns a fixed shape. GraphQL: one endpoint; the client asks for exactly the fields it needs, in one request.
Say it like this in the interview
“GraphQL avoids over- and under-fetching and suits complex frontends with varied data needs, with a typed schema. Costs: caching is harder than HTTP caching, N+1 resolvers need DataLoader, and query complexity must be limited for security. REST is simpler and cache-friendly for most CRUD APIs.”
When you need to change the API in a way that would break existing apps, you release a new version and keep the old one working for a while.
Say it like this in the interview
“URL versioning like /v1 is simplest and most common; header or media-type versioning is an alternative. I avoid breaking changes by adding fields, and deprecate old versions with notice and sunset dates.”
Tell clients how many requests they have left and when they can try again.
Say it like this in the interview
“Return 429 Too Many Requests with Retry-After, plus headers like RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. Algorithms: fixed window, sliding window or token bucket, stored in Redis for distributed systems.”
Consistent shape, the right status code, a message a developer understands, and details for fixing it, never internal stack traces.
Say it like this in the interview
“Correct status code, a consistent body, for example Problem Details (RFC 9457) with type, title, detail and field errors, a request ID for support, and no internal details leaked.”
gRPC is a faster, strongly-typed way for services to talk to each other using binary messages over HTTP/2. REST with JSON is simpler and works everywhere, including browsers.
Say it like this in the interview
“gRPC uses Protocol Buffers and HTTP/2, giving typed contracts, efficient binary payloads and streaming, ideal for internal service-to-service calls. REST is human-readable, cacheable and browser-friendly for public APIs.”
A webhook is another service calling your URL when something happens (“payment succeeded”). You must check it really came from them, and handle it even if they send it twice.
Say it like this in the interview
“Verify the signature, usually an HMAC of the raw body with a shared secret, and the timestamp to prevent replays; respond 2xx quickly and process in a background job; make handlers idempotent using the event ID because providers retry; and log events for debugging.”