In plain words
An ORM is a library, such as Prisma or Drizzle, that lets your code work with database rows as ordinary objects and turns that into SQL for you.
Where you see it
A prisma/schema.prisma file, or a db/schema.ts full of pgTable calls if your agent chose Drizzle. In the code you'll see lines like prisma.order.findMany() where you might have expected SQL.
What goes wrong
- Two ways of talking to the same database
A project that already queries Supabase directly sometimes gains Prisma too, after one vague prompt. You now have two descriptions of the same tables, and they can disagree.
- Editing the schema file and stopping there
Changing schema.prisma doesn't change the database. Until a migration runs, the code and the database describe different tables.
- A query inside a loop
Loading 50 orders and then fetching each one's items separately sends 51 queries. Ask for the related data in the same query.
for (const o of orders) o.items = await prisma.item.findMany({ where: { orderId: o.id } });
What to tell your agent
Quick check
Sign in to earn +10 XP for itQuickBite's order history takes eight seconds to show 50 orders. The code loads the orders, then fetches each order's items one by one. Likely fix?