case studies

Save the enquiry before delivering the notification

A first-party conversion implementation that separates durable lead capture from retryable external notification delivery.

Context

The public form gathers project constraints and attribution so the private CRM can evaluate the enquiry. Visitors may retry if the network fails before they see confirmation.

The constraint

A synchronous notification dependency can make a successful lead write look like a failed enquiry. A careless retry can create a second lead, while analytics code can introduce unrelated failures.

The approach

Lead creation and outbox enqueueing share a transaction. A submission key and payload hash make matching retries idempotent. A worker claims notification jobs, signs requests and applies bounded retries after persistence.

Architecture

From brief to follow-up
  1. 01Visitor submits a qualified brief
  2. 02Validated, idempotent API operation
  3. 03Lead + notification job commit together
  4. 04Worker delivers a signed event
  5. 05Private CRM follow-up

Decisions and tradeoffs

Success is shown only after the backend confirms persistence. Analytics emits a browser event after that acknowledgement and remains optional.

Notification delivery is at least once. The receiving endpoint must use the event ID as an idempotency key. Failed delivery retains the lead and a retryable job.

Implementation

The form preserves input on error. First-touch campaign fields are stored for a limited browser session and carried to the saved lead; confirmation contains a reference without exposing the brief.

Inspect the API implementation

Evidence and outcomes

The integration checks cover matching retries, conflicting keys, consent validation, persisted attribution, notification failure and recovery. They do not claim a production conversion rate.

Explore backend engineering

Stack

NestJS

PostgreSQL

Prisma

Next.js

A clear next step

Bring us the constraint.

Share the product, the problem and what a useful outcome looks like. We’ll discuss the scope before committing to delivery.

Discuss your project
Start a project