5 Backend Interview Questions


Preparing for a backend engineering interview can be a challenging yet rewarding experience. Based on my experience as a technical recruiter I will give you a few tips and, more importantly, tell you what you can expect during a technical interview.

How would you implement authentication in web services?

To implement authentication in our system, we’ll use Token-based authentication. When the user successfully logs in, the system generates a token (for example JWT), the token is securely stored by the client and attached as a header to the request to authenticate the user.

This is only one example of authentication implementation, there are other strategies for example Cookie-Based. Always describe the one that you’re most familiar with.

What are the pros and cons of using Microservices Architecture?

Microservices are small independent components of the application, usually separated based on business/functional parts of the application.

Add table

You can also mention when it is recommended and when you should avoid using a microservices architecture. If you already worked with microservices, say something about your experience.

Explain the differences between Relational (SQL) and Non-relational (NoSQL) databases

Relational databases store data in structured tables, and primary keys can identify all records in the databases.

In NoSQL databases, data don’t need to be structured and can be stored as a document, key-value, etc.

You should also mention your experience with both types of databases. Explain real-life scenarios for database type selection.

Describe the key principles of RESTful API design. Can you walk us through designing and implementing a RESTful API, including considerations for resource naming, HTTP methods, and versioning?

Naming

Use nouns rather than verbs. This ensures that endpoints represent entities or objects. Use plural nouns for resource names to maintain consistency. For example, use /comments instead of /comment for the endpoint representing a collection of comments. Choose clear and meaningful names for resources, avoiding abbreviations and acronyms.

HTTP methods

GET (Read): Use for retrieving resources. The endpoint should be idempotent, meaning repeated requests yield the same result. POST (Create): Use for creating new resources. It should not be idempotent, as each request creates a new resource. PUT (Update): Use for updating existing resources. The entire resource should be sent in the request payload. DELETE (Delete): Use for deleting resources. It should be idempotent. PATCH (Partial Update): Use for partial updates to existing resources. It’s more bandwidth-efficient than PUT, as it only sends the modified fields.

Versioning

Include version information in the API to handle changes gracefully without breaking existing clients. This can be achieved through URI versioning (/v1/resource) or using custom headers.

How would you handle a huge amount of requests?

Here are serval strategies to archive high scalability in web services:

  • Load balancing — Distribute incoming traffic across multiple servers to prevent any single server from becoming a bottleneck.
  • Horizontal Scaling — Increase the number of server instances to handle more requests. Utilize cloud services to add or remove instances based on demand dynamically.
  • Caching — Implement caching mechanisms to store and serve frequently requested data without repeatedly processing it. This reduces the load on the backend.

There are more possibilities like CDNs, asynchronous processing, etc.