47 questions

Hiring questions

The questions I ask when hiring developers, with the answers I look for. Read them before an interview, or switch to Practice and go through them like flashcards.

27 questions

From the note

backend

  • how to scale backend? horizontal scaling, vertical scaling, caching, event driven, async job processing, queues
  • how to optimize database queries? use indexes, use the explain command, simplify queries, use materialized views, cache
  • what is idempotent ? a request that can be called multiple times without changing the result, a good example is a payment, if the payment is made twice, the result is the same
  • how to make a function, request idempotent ? use an idempotency key, use an unique database index
  • how to make a system fault-tolerant? use retries using async job processing, handle error properly, use error code.
  • what to do when a webhook that you are waiting for does not arrive? create a pooling fallback
  • how to document backend archicture? use diagrams, state machine, sequence diagram
  • when to use a state machine? when you have a complex flow, like a payment, a subscription, a user registration
  • how to ensure the data system is consistent? create auditing tools to validate this, use state machines
  • how to test backend ? prefer integration tests like test input and output of API, GraphQL, jobs, database state avoid mocking databases.
  • how to implement event driven ? use a message broker like kafka, rabbitmq, sqs, sns, redis, bull
  • how to decouple backend ? create packages/repository per domain instead of feature, avoid circular dependencies, use event-driven
  • how to automate ci/cd? use github actions, gitlab ci, circle ci, jenkins, travis, docker, docker-compose, kubernetes
  • why observability is important? to understand the system, to understand the user, to understand the business, to understand the performance
  • how to implement observability ? apm, prometeus, sentry, grafana, tracing, metrics and logs
  • how to deploy backend? pure ec2, vps, eks, k8s, aws, gcp, azure, heroku, netlify, vercel, digital ocean
  • how to do data modelling ? prefer simpler models over complex models, fewer models and fields are better, prefer to avoid too many relationship and joins
  • when to use docker and docker compose ? to automate deployment and simplify dx for development
  • how to do database migrations? for sql you need structural and data migrations, for nosql you need to create a new collection and migrate the data
  • when to use cache ? to cache expensive operations, to cache oauth token with expirations
  • how to deal with eventual consistency? avoid read followed by write, read from primary, improve write and read concern
  • how to deal with distributed systems? use idempotent, use retries, use async job processing, use queues, use event-driven, use state machines
  • how to deal with external APIs? decouple the external API using port adapters, have a fallback for an API
  • how to deal with concurrency to update a shared resource like a ledger balance? conditional put, locks, database transactions
  • when to use REST API or GraphQL ? prefer GraphQL for internal products, and REST API for public APIs.
  • how to deal with security? use oauth, use jwt, use https, use cors, use csrf, use rate limit, use waf, use security
  • vercel vs serverless vs k8s vs ec2 ? vercel for MVP, ec2 for simple workflows, prefer k8s for complex workflows and to be able to move from cloud providers/on-premise/bare-metal, prefer serverless for event-driven workflows

20 questions

From the note

frontend

  • how to scale frontend? a good answer is to use a design system
  • how to scale css? use design system
  • What do you test on the frontend? integration test, test the behavior, using testing library, test that when filling out a form and clicking the submit button, the api is called with the correct data
  • how do you create a new page? does it start with a component and then break it down (top down), or does it start with base components and then compose them? a good answer would be to use top-down, because segmenting (componentizing) is very difficult if you don't know how it will be structured, another good answer is to use only the components that already exist in the design system
  • if a component doesn't exist in the design system for a page you need to do what do you do? A good answer would be to discuss with the designer whether to use an existing component or add the new component to the design system.
  • what is the tradeoff of adding a new component to a design system? the more components, the more complexity and work to maintain, the fewer simpler components
  • how to organize a design system? A good answer is to have documentation, using docusuarus and/or storybook
  • how do you deal with data fetching? The best answer would be relay, but it only works if you have graphql, another answer would be something more level and declarative like react-query, data fetching by hand is always an error
  • create a new component or a new prop? prefer a prop if the "new behavior" converges with the existing component, otherwise create a new component
  • how to start a new design system? decide the initial basic components, typography, scaping, buttons
  • what is important is a design system? consistency, maintainability, scalability, typography, basic components, storybook, documentation
  • when to use SSR? when you need perf and SEO, SSR is to render the frontend in the server and hydrate
  • what is hydration? it is the process of conciliating the server rendered html with the client rendered html
  • how to improve SEO? use SSR, use meta tags, use structured data, use sitemap, use robots.txt, make site fast
  • how to improve frontend performance? lazy loading, RSC, SSR, tree shaking, remove big packages
  • when to virtualize a list? when we are handling big number of items
  • when to memo a component? when you need to render a lot of number of this components
  • how to manage state? prefer local state using useState, only when needed use useContext, move data fetching to something else like relay, react-query
  • how to build complex forms with validations ? prefer use packages like formik and yup
  • how to deploy frontend ? you can deploy on s3 and expose then using nginx, cloudfront or cloudflare pages, any CDN works.
From both sides of the table

Notes on hiring and interviews