Briefle
LearnGlossaryPricing

Briefle words · Code & architecture

Database transaction

A group of database writes that either all succeed or all fail together.

Say it to an AI

Express 5 + Prisma handler for payment.succeeded webhooks that credits the user's wallet. Delivery is at-least-once, so make it idempotent: use event.id as the idempotency key in a unique-keyed table and insert it plus the balance increment in one database transaction.

How an expert would brief the stronger version of “Wallet top-up webhook”.

See it

Try it as a puzzle →

Endpoint in a savings app that tops up a user's wallet when the payment provider reports a successful card payment.

Study A · the stronger one
Study B · the weaker one

Why: A wraps the event-id insert and the balance update in db.$transaction, so an event can't be marked as seen without the money being added.

Related words

  • Edge case
  • Guard clause
  • Swallowed exception
  • Fail fast
  • Side effect
  • Log level
  • Custom error class
  • instanceof check

Room 4 · Errors & edge cases

Learn “Database transaction” in a five-minute lesson

Start free
AI can build almost anything. The bottleneck is saying what you want.
WordsPricingTermsPrivacyRefundsContact
© 2026 Briefle