7
← Back to Pattern Arsenal
extra

Repository

must know

Stage 1: Problem

Problem

You are building a user management service. It needs to:

  1. Find users by ID, email, or role
  2. Create and update users
  3. Check if an email is already registered
  4. Get paginated lists with filters

Currently, TypeORM queries are scattered across controllers, services, and even middleware.

How would you centralize data access so business logic doesn't know whether you're using TypeORM, Prisma, raw SQL, or an in-memory store?

Write your approach before continuing.


1 / 10 — Problem