Skip to content
tezvyn:

⚙️Backend Dev

Backend engineering, APIs, and databases

284 bites

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

Easy everything in Backend Dev, page 9

easy2 min read

FastAPI's APIRouter: Grouping Routes into Modules

Think of APIRouter as a mini-FastAPI app for organizing endpoints. It lets you group related paths, like all user routes, into a separate file. This is crucial for keeping large applications maintainable.

easy2 min read

FastAPI's Dependency Caching: One Request, One Call

FastAPI dependencies are singletons for the life of a request. If multiple parts of your code ask for the same dependency (e.g., a database session), FastAPI runs it once, caches the result, and shares it. The footgun: this cache is per-request, not global.

FastAPI: Using Classes as Dependencies
easy2 min read

FastAPI: Using Classes as Dependencies

Bundle related request parameters into a class instead of repeating them in every endpoint. FastAPI automatically creates an instance for you, cleaning up your code. This is ideal for shared logic like pagination. The footgun: FastAPI injects into __init__.

FastAPI's Depends: Let the Framework Handle Setup
easy2 min read

FastAPI's Depends: Let the Framework Handle Setup

Think of Depends as a pre-flight checklist for your API endpoints. You list required setup tasks, like getting a user or a database session, and FastAPI runs them for you. This is key for sharing logic like auth or database connections across many routes.

FastAPI: Returning HTML with HTMLResponse
easy2 min read

FastAPI: Returning HTML with HTMLResponse

Override FastAPI's default JSON output by using HTMLResponse to return a raw HTML string directly from an endpoint. It's for simple status pages or server-side rendered components.

easy1 min read

FastAPI: Reading Request Cookies

FastAPI treats request cookies like any other parameter. Declare them directly in your endpoint's function signature using Cookie(), and the framework will extract the value for you. Use this for reading session IDs or user preferences.

easy1 min read

Declaring Request Headers in FastAPI

Treat request headers like any other parameter in FastAPI. Declare them in your function signature to access values like User-Agent or X-Token. FastAPI automatically converts hyphens to underscores, so User-Agent is accessed via the user_agent

easy2 min read

FastAPI: Handling Form Data, Not Just JSON

FastAPI can handle classic HTML form data, not just JSON. Use Form to define expected fields in your endpoint, just like query parameters. It's ideal for login pages. The footgun: forgetting to pip install python-multipart will break form parsing.

Pydantic: Required vs. Optional Fields
easy2 min read

Pydantic: Required vs. Optional Fields

In Pydantic, a field is required by default. To make it optional, you must provide a default value, like name: str = "guest" or age: int | None = None. This is key for flexible API request bodies.

easy2 min read

Uvicorn Workers: Scaling Your FastAPI App

Uvicorn workers are like adding cashiers to a store. Instead of one process handling all requests, you run multiple, letting your FastAPI app use all CPU cores to serve more users concurrently.

easy2 min read

FastAPI Query Parameters: Beyond the URL Path

In FastAPI, function arguments not in the URL path become query parameters—the optional key-value pairs after a URL's ?. Use them for filtering or pagination, like /items?skip=0&limit=10. The footgun: omitting a default value makes the parameter required.

Path Parameters: Turning URL Parts into Variables
easy2 min read

Path Parameters: Turning URL Parts into Variables

Path parameters turn parts of a URL, like /users/123, into typed function arguments. FastAPI uses this to create endpoints for specific resources, like fetching a user by their ID. The footgun is forgetting type hints; without int, 123 is just a string.

FastAPI: Configure Endpoints with Decorators
easy2 min read

FastAPI: Configure Endpoints with Decorators

FastAPI's path operation decorators configure an endpoint's metadata and behavior. Use them to set status codes (status_code=201), group endpoints with tags, or mark them as deprecated.

FastAPI Application Instance: Your API's Central Hub
easy2 min read

FastAPI Application Instance: Your API's Central Hub

The FastAPI instance is your API's central switchboard, connecting incoming requests to your code. You create it once (e.g., app = FastAPI()) and use its decorators like @app.get to define all your endpoints. The footgun is creating multiple instances.

Python Enums: Give Names to Magic Numbers
easy2 min read

Python Enums: Give Names to Magic Numbers

Python's Enum gives meaningful names to "magic numbers" or strings. Use it for fixed sets of options like statuses or categories to make code self-documenting. The footgun: don't compare members to raw values; compare member to member for type safety.

Python Packages: Grouping Modules with __init__.py
easy2 min read

Python Packages: Grouping Modules with __init__.py

A Python package is a folder of modules treated as one unit. The __init__.py file marks the folder as a package and can run setup code. Use it to organize large codebases.

Python Data Classes: Write Less Boilerplate
easy2 min read

Python Data Classes: Write Less Boilerplate

Python's @dataclass decorator writes boilerplate code like __init__ and __repr__ for you, turning a class with type hints into a data container. Use it for API payloads or simple records.

Python Type Hints: Documentation Your Linter Can Read
easy2 min read

Python Type Hints: Documentation Your Linter Can Read

Type hints describe expected values, but Python itself does not enforce them while running. Static checkers and IDEs use the annotations before execution; libraries such as FastAPI can also inspect them for validation and API documentation.

easy2 min read

Creating a Basic Node.js Dockerfile

A Dockerfile is a recipe for building a portable image of your app. Use it to ensure your Node.js app runs identically everywhere, from your laptop to production.

PM2: The Process Manager for Production Node.js
easy2 min read

PM2: The Process Manager for Production Node.js

PM2 is a process manager that keeps your Node.js apps online. Use it to automatically restart crashed apps, run them in the background, and scale across CPU cores. The footgun is forgetting to run pm2 save to make your process list survive server reboots.

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