Project system brief

A neighborhood tool-lending platform built with Next.js, Clerk, Convex, and n8n. LendLoop supports public tool discovery, authenticated borrowing workflows, server-side role-based authorization, and resilient event-driven automation for notifications and overdue reminders.

Product Context

Product Context

A neighborhood tool-lending platform built with Next.js, Clerk, Convex, and n8n. LendLoop supports public tool discovery, authenticated borrowing workflows, server-side role-based authorization, and resilient event-driven automation for notifications and overdue reminders.

System Problem & Scope

System Problem & Scope

Homeowners and makers frequently purchase costly specialty tools that remain idle for long stretches, while neighbors lack affordable access. Existing sharing models suffer from lack of trust, unverified inventory, manual scheduling coordination, and missing accountability for loan returns.

Engineering Constraints

Engineering Constraints

Enforcing strict zero-trust authorization where client-supplied user identifiers are never accepted, guaranteeing atomic outbox event dispatch without dual-write discrepancies, and securing asynchronous n8n automation pipelines against replay attacks while preserving idempotency across scheduled reminder cron jobs.

System Architecture Flow

System Architecture Flow

Full-stack reactive architecture coupling Next.js 16 App Router with Convex ACID backend. Client interactions authenticate via Clerk JWTs, Convex server mutations enforce role and ownership checks while persisting business state and outbox events in a single transaction, and containerized n8n engines verify HMAC signatures to orchestrate notifications and idempotent write-backs.

6 System Stages
Active Stage: 01
01SERVICE

User Identity & Authentication

Active Stage
02CLIENT

Public Tool Directory

03DATABASE

Convex Application Backend

04QUEUE

Transactional Outbox Engine

05WORKER

n8n Workflow Automation

06SERVICE

Idempotent Secure Write-Back

STAGE 01

User Identity & Authentication

Clerk identity verification issues cryptographic JWTs; Convex server guards validate session claims without trusting client-side parameters.

STAGE 02

Public Tool Directory

Public catalog exposes tool name and category only, enforcing strict data minimization to protect community member privacy.

STAGE 03

Convex Application Backend

ACID queries and mutations execute business logic, prevent overlapping loan reservations, and enforce server-side RBAC across entities.

STAGE 04

Transactional Outbox Engine

Records notification and reminder events in the same atomic database commit as state transitions, preventing dual-write inconsistencies.

STAGE 05

n8n Workflow Automation

Validates signed HMAC SHA-256 payloads within a 5-minute replay window, dispatching notifications and scheduled overdue reminders.

STAGE 06

Idempotent Secure Write-Back

Bearer-authenticated HTTP callback updates outbox state to SUCCEEDED and commits delivery timestamps with compound idempotency locks.

Execution & Failure-Mode Explorer

How the architecture behaves under real faults

Primary stage: Transactional Outbox Engine

Convex commits the loan state transition and an outbox event atomically, then dispatches an HMAC SHA-256 signed payload to n8n.

Key Engineering Contributions

Key Engineering Contributions

Engineered zero-trust server-side RBAC guards in Convex, verifying Clerk identity tokens and enforcing role policies across listings, loans, and admin queries. Implemented the Transactional Outbox pattern and HTTP webhooks with canonical HMAC SHA-256 signatures, timestamp tolerances, and stale event recovery. Designed automated n8n workflows for borrow request notifications, daily overdue reminders with compound idempotency keys, and real-time activity status logging.

Reliability & Integrity Guarantees

Reliability & Integrity Guarantees

System reliability is enforced through transactional database ACID boundaries, automated stale outbox recovery workers, cryptographic replay-attack mitigation, strict compound idempotency keys preventing duplicate alerts, and automated Vitest unit/integration suites along with Playwright end-to-end browser tests.