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 16

Pydantic: Reusable Validation with Annotated Types
intermediate2 min read

Pydantic: Reusable Validation with Annotated Types

Pydantic's Annotated attaches validation logic directly to a type, making it reusable. Define a custom type like SquareNumber once and apply it to any model field, ensuring consistent validation without repeating code.

intermediate2 min read

FastAPI: Validating Models with Pydantic's Field

Pydantic's Field adds guardrails directly to your data model's attributes. Use it to enforce constraints like string length (max_length=50) or numeric ranges (gt=0), making your models self-validating.

intermediate2 min read

From Dev Server to Production: Running FastAPI with Workers

Your dev server is a single process. For production, you need a process manager to run multiple Uvicorn worker processes, handling concurrent requests and providing fault tolerance.

Exclude a FastAPI Endpoint from OpenAPI Docs
intermediate1 min read

Exclude a FastAPI Endpoint from OpenAPI Docs

Hide an endpoint from your API docs by setting include_in_schema=False. Use this for internal or deprecated endpoints. The footgun: this only hides the endpoint from documentation; it remains fully functional and accessible if the URL is known.

FastAPI: Documenting Additional API Responses
intermediate2 min read

FastAPI: Documenting Additional API Responses

Document every possible API response, not just the happy path. The responses decorator parameter lets you define alternative status codes and schemas, like a 404 error model, making your OpenAPI docs complete.

intermediate2 min read

Testing Async FastAPI with pytest-asyncio

To test async code, your tests must also be async. pytest-asyncio lets you write async def test_... functions to await operations like database checks after an API call.

intermediate2 min read

Run One Test with Many Inputs using pytest.parametrize

Run one test function with many inputs using @pytest.mark.parametrize, avoiding repetitive code. It's ideal for checking a function against various inputs, edge cases, and expected failures. The footgun: mutable parameters like lists are passed by reference.

intermediate2 min read

Custom FastAPI Middleware: The BaseHTTPMiddleware Helper

FastAPI's BaseHTTPMiddleware lets you wrap endpoints to run code before and after they execute. Use it to add custom headers or log request times. The footgun: reading request.body() in the middleware will break the endpoint, as the body can only be read…

intermediate2 min read

Refresh Tokens: Persistent Sessions Without Re-Authentication

A refresh token is a long-lived credential used to get a new, short-lived access token without re-authenticating. It's how apps keep you logged in for weeks. The footgun is storing it insecurely, letting attackers mint access tokens forever.

FastAPI RBAC: Using OAuth2 Scopes for Permissions
intermediate2 min read

FastAPI RBAC: Using OAuth2 Scopes for Permissions

Treat OAuth2 scopes as a list of permissions. Instead of checking a user's role, you check if their token has the required scope (e.g., items:write) for an endpoint. FastAPI's Security dependency automates this check.

FastAPI: Fine-Grained Permissions with OAuth2 Scopes
intermediate2 min read

FastAPI: Fine-Grained Permissions with OAuth2 Scopes

Think of OAuth2 scopes as permissions on a keycard. A token gets you in the building, but scopes like items:read or items:write define which rooms you can enter. Use them in FastAPI to grant granular access.

intermediate2 min read

API Keys: Simple Server-to-Server Authentication

An API key is a simple secret token a client sends to prove its identity, often in a request header. It's ideal for machine-to-machine communication where a user login flow is unnecessary. Footgun: Never send keys in URL query parameters.

HTTP Basic Auth: Simple but Insecure Access Control
intermediate2 min read

HTTP Basic Auth: Simple but Insecure Access Control

HTTP Basic Auth is a simple gatekeeper for your API, prompting users for a username and password directly in the browser. It's useful for internal tools, but never use it over unencrypted HTTP as credentials are sent in a trivially decodable format.

intermediate2 min read

Beanie: Python Objects as MongoDB Documents

Beanie maps Pydantic models to MongoDB documents, letting you interact with the database using Python objects instead of raw queries. Use it in async apps like FastAPI for rapid, type-safe CRUD.

Motor: Don't Block Your Python App on MongoDB
intermediate2 min read

Motor: Don't Block Your Python App on MongoDB

Motor is the async bridge for Python apps to talk to MongoDB without blocking. Use it in FastAPI or other async frameworks to keep your server responsive during database queries.

intermediate2 min read

Alembic: Version Control for Your Database Schema

Alembic is like Git for your database schema, providing versioned, reversible changes. Use it with SQLAlchemy to evolve your database structure alongside your code. The footgun is that autogeneration can miss changes; always review generated scripts.

intermediate2 min read

SQLAlchemy 2.0: Async Without Blocking the Event Loop

SQLAlchemy 2.0 wraps its synchronous core with an async API, letting you await database calls without blocking your app's event loop. Use it in frameworks like FastAPI.

Python's Asyncio Subprocesses: Non-Blocking Shell Commands
intermediate2 min read

Python's Asyncio Subprocesses: Non-Blocking Shell Commands

Run external commands without blocking your async app's event loop. asyncio.create_subprocess_shell lets you launch processes and await their results, keeping your server responsive.

asyncio Queues: Coordinating Asynchronous Tasks
intermediate2 min read

asyncio Queues: Coordinating Asynchronous Tasks

An asyncio queue is a channel for coroutines to safely exchange data. It's ideal for producer-consumer patterns, like a web crawler feeding URLs to parsers. The main footgun: it's not thread-safe and must be used within a single event loop.

Coordinating Asyncio Tasks with Locks and Events
intermediate2 min read

Coordinating Asyncio Tasks with Locks and Events

asyncio sync primitives are traffic signals for coroutines, preventing collisions over shared state. Use a Lock for exclusive access or an Event to signal multiple tasks to proceed. Footgun: these are for asyncio tasks only, not OS threads.

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