Question library
Explained questions for the decisions developers make.
App Router vs Pages Router?
Next.js provides two routing systems: the Pages Router organizes page files, while the App Router uses nested route segments, layouts and React Server Components. They have different data-fetching and rendering conventions. Knowing which router a project uses prevents mixing APIs and assumptions from different architectures.
Server Component vs Client Component?
A Server Component runs in the server environment and does not ship its component implementation to the browser as interactive JavaScript. A Client Component is part of a client boundary and supports state, effects and browser events. In Next.js, Client Components can still contribute server-generated HTML on the initial load, so client does not mean browser-only rendering.
How should I secure and organize a frontend?
Frontend architecture organizes components, data access and state so a feature can be understood and changed without tracing the whole app. Security defines which data and actions each user may access, and the backend must enforce it independently of visible controls. A clear API layer and explicit loading/error states also make failures easier to handle consistently.
What makes a good REST API?
A REST-oriented API exposes resources through consistent HTTP operations and representations. A useful API contract explains identifiers, input rules, outcomes, errors and pagination so clients do not need to guess. The goal is predictable behavior and evolvable interfaces, not forcing every business operation into a simplistic CRUD shape.
MongoDB aggregation becomes slow. What do I check?
A slow aggregation often processes a much larger intermediate dataset than its final output suggests. Joins, unwinds, sorts and groups can expand work or exceed useful memory limits. Inspecting the pipeline stage by stage reveals where the expensive growth occurs.
What are Jest, React Testing Library and Supertest?
Jest provides test execution, assertions and tools for replacing dependencies. React Testing Library helps test components through behavior visible to users, while Supertest sends HTTP requests to an application for API assertions. They can be combined, but none automatically chooses meaningful cases or guarantees realism.
How do I resolve a merge conflict or find a bad commit?
A merge conflict means Git cannot automatically decide how competing changes should combine. Resolving it requires understanding the intended behavior, not just removing conflict markers. Bisect solves a different problem: it narrows the commit range that introduced a reproducible regression through repeated good/bad checks.
The container exits immediately. What should I check?
A container stays running while its main process remains alive. An immediate exit usually means the command finished, failed startup or was killed, rather than that Docker randomly stopped a healthy application. Logs, exit status and runtime configuration tell you which case occurred.
How were errors handled?
Error handling defines what happens when inputs, business rules or dependencies fail. A reliable API returns an appropriate response while preserving enough internal context for diagnosis. The answer should describe actual behavior rather than promise that errors were simply “handled centrally.”
How do I check performance?
A performance review checks whether the amount of work stays reasonable as input size and traffic increase. Database calls, large allocations and synchronous CPU work can be more important than small syntax choices. Use measurements for suspected hotspots rather than adding optimizations everywhere.
How do I check reliability?
Reliability means the operation behaves predictably when dependencies fail, time out or return uncertain outcomes. It includes recovery after a crash, bounded resource use and preservation of business state. A happy-path test cannot prove that retries, rollback and cleanup are correct.
Which edge cases and tests matter most?
Edge cases are valid boundary conditions and failure situations that ordinary examples may not exercise. Useful tests prove important rules under those conditions, including concurrent and repeated requests. The highest-value case is often where a missing record, denied access or partial failure changes control flow.
How to use this AI Engineering guide
A practical textbook for building AI applications, agents, and reliable client solutions.
Prompt engineering, zero-shot, and few-shot prompting
Prompt engineering is writing clear task instructions, inputs, constraints, and output expectations. Zero-shot prompting gives instructions without examples; few-shot prompting adds a small number of input/output examples. A prompt is part of the application…
Structured output and JSON output
JSON output is machine-readable data, such as an object with named fields. Structured output adds a declared schema so the response follows expected fields and types when the provider supports schema-constrained generation. Valid JSON, valid schema, and valid…
Functions, classes, modules, and exceptions
Functions package operations; classes group state and behavior; modules are importable Python files or packages. Exceptions represent errors that interrupt normal control flow until handled. These serve the same broad purposes as functions, classes, imports,…
Agents, chatbots, and workflows
An AI agent is software that uses a model to choose actions toward a goal, observes results, and decides what to do next within application limits. A chatbot describes a conversational interface; it may or may not contain an agent. A workflow defines the…
LangChain overview, models, prompts, and chains
LangChain is a framework ecosystem for assembling model-driven applications. Model wrappers, prompt templates, and composable operations make integration easier. A chain is a sequence of transformations or calls; it can be fixed and does not automatically…
Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.