Skip to content
tezvyn:

⚙️Backend Dev

Backend engineering, APIs, and databases

529 bites

Test yourself: Top 30 intermediate Backend Dev interview questionsMultiple choice, with the correct answer and why it is correct on every question. Free, no sign-in.

Intermediate everything in Backend Dev, page 12

intermediate2 min read

How does FastAPI distinguish required optional and default query parameters

Tests whether you know FastAPI infers query parameter optionality from Python signature defaults. Answer: no default means required, Optional[T] = None means optional, T = value sets a default, with all three in one signature.

intermediate2 min read

What is the difference between a path parameter and a query parameter?

Tests REST API design and FastAPI binding. A strong answer states path params identify resources in the URL while query params filter after the question mark, then codes user_id in the route and q: str | None = None in the function.

How do you structure concurrent API calls with asyncio.gather in FastAPI?
intermediate2 min read

How do you structure concurrent API calls with asyncio.gather in FastAPI?

Tests FastAPI async concurrency. Strong answer: async def endpoint with two async HTTP requests in asyncio.gather, cutting total latency from sum to max of the two. Red flag: using sync clients or threads instead of async I/O.

intermediate2 min read

Write an async decorator that logs execution time for FastAPI

Use functools.wraps, wrap perf_counter around awaited call, log ms, and place decorator above path operation.

How does FastAPI leverage Pydantic for request validation and serialization?
intermediate2 min read

How does FastAPI leverage Pydantic for request validation and serialization?

This tests your understanding of FastAPI's declarative validation. Explain that type hints trigger auto-parsing, Pydantic enforces schemas and errors, and return types auto-serialize responses. Red flag: manually parsing request.body() or json.loads in routes.

intermediate2 min read

Docker Compose for Local FastAPI Stacks

Docker Compose turns your laptop into a one-command datacenter. Define Postgres, Redis, and your FastAPI app in one YAML file and they boot as a networked stack.

intermediate3 min read

Custom Field Serialization with @field_serializer

@field_serializer is an exit-only adapter for one field: it reshapes data leaving the Pydantic model without changing internals. Use it to format decimals, mask secrets, or tweak datetimes for FastAPI JSON. Never use it for validation; it only runs on output.

intermediate2 min read

Per-Field Validation with @field_validator

@field_validator scrubs a single Pydantic field before it enters the model. Use it for rules like 'password must contain a digit' or 'port must exceed 1024'. It only sees one field at a time, so cross-field checks belong in a model validator instead.

intermediate2 min read

Serialize Pydantic Models with model_dump

model_dump turns a Pydantic model into a plain Python dict, bridging typed objects and JSON serializers in FastAPI endpoints. Call it when you need raw data before returning a response. Do not confuse it with model_dump_json, which emits a string, not a dict.

intermediate2 min read

Testing FastAPI Lifespan Events

FastAPI lifespan events only run when TestClient is used as a context manager. Use this to test startup logic like DB pools before endpoints. Using TestClient(app) without with skips lifespan, leaving your app uninitialized and tests silently wrong.

intermediate2 min read

express-validator: Validate at the Edge

express-validator stops garbage before it hits your logic. Use it on any route that accepts user input like form data, query strings, or JSON payloads. The biggest mistake is validating but forgetting to check validationResult, so invalid requests pass.

intermediate2 min read

Operational vs Programmer Errors in Node

Operational errors are expected problems like a failed network request; programmer errors are bugs like reading undefined. Handle the first gracefully, crash the second. The footgun is catching programmer errors and continuing, which corrupts process state.

intermediate2 min read

Validation Checks Rules; Sanitization Cleans Input

Validation checks if input fits your rules and rejects failures. Sanitization cleans allowed input so it cannot cause harm. Validate at the boundary to enforce shape, then sanitize before rendering. Never swap them; scrubbing a bad date does not make it valid.

intermediate2 min read

Bcrypt: Hash Passwords with Salt and Slowness

Bcrypt salts and slows every password hash so identical passwords never look the same and brute force stays expensive. Use it in register and login routes before the database. Never compare hashes with plain string equality; always call bcrypt.compare().

intermediate2 min read

MongoDB Aggregation Pipeline: Server-Side Assembly Line

MongoDB's aggregation pipeline reshapes documents stage by stage on the server. Use it for reports, joins, or analytics without pulling whole collections into your app. Running $sort or $group before $match scans excess documents and kills performance.

intermediate2 min read

JWT Authentication: Signed Claims, Not Sessions

A JWT is a signed JSON blob that lets a server trust a client without storing session state. Express APIs use it to stay stateless across load-balanced servers. The footgun is stuffing secrets inside because the payload is only Base64, not encrypted.

intermediate2 min read

Callback Hell: The Pyramid of Doom

Callback hell is what happens when nested async callbacks indent so deeply the code forms an unreadable pyramid. You see it in legacy Node.js when chaining database queries or file reads.

npx: Execute Packages Without Installing Them
intermediate2 min read

npx: Execute Packages Without Installing Them

npx runs Node.js tools without installing them globally, fetching the latest version on demand. Use it for one-off scaffolding like create-react-app or CI build scripts. The footgun: it may silently run a stale cached copy if you omit a version tag.

Explain the performance overhead of a cgo call
intermediate2 min read

Explain the performance overhead of a cgo call

Tests cgo transition penalties and scheduler semantics. A strong answer cites the ~100x overhead (~171ns vs ~1.8ns), notes C blocks an OS thread and starves the scheduler, and warns about memory copy taxes. Red flag: claiming cgo is free or ignoring blocking.

intermediate2 min read

Why must FFI-bound structs use #[repr(C)] and what breaks without it?

Repr(C) fixes field order, size, alignment to C rules for extern calls; omitting it lets Rust reorder or pad fields, causing UB.

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles