← Back to Archive
Social Good / Web3 Events Case Study

HuddleUp Protocol

A decentralized event platform that incentivizes social good by airdropping crypto rewards to verified volunteers.

Neo4j (Graph DB) NestJS Solidity Web3Auth Next.js PYUSD (PayPal Stablecoin)

Architecture Overview

A hybrid architecture using a Graph Database (Neo4j) to model complex social relationships (Sponsors, Organizers, Participants), synchronized in real-time with an on-chain Solidity escrow contract via WebSocket event listeners.

The Challenges

Graph Data Modeling

Problem

Social events have complex, many-to-many relationships (User X sponsored Event Y, attended Event Z, and organizes Event A). Modeling this in a standard SQL database results in messy join tables and slow queries.

Solution

Used Neo4j (Graph Database) to model users and events as nodes with typed relationships (`PARTICIPANT_OF`, `SPONSOR_OF`). This allows efficient traversal queries (e.g., 'Find all events sponsored by friends of User A') that are impossible in SQL.

events.service.ts

Physical-to-Digital Bridge

Problem

We needed a trustless way to prove a user was physically present at a beach cleanup or charity drive before releasing funds.

Solution

Implemented a cryptographically signed QR Verification flow. The user generates a QR code containing their wallet signature. The organizer's app scans it and calls the `verifyParticipant()` smart contract function. The contract validates the organizer's permission and instantly transfers the PYUSD reward to the attendee.

qr.service.ts

Hybrid State Sync

Problem

Users interact directly with the blockchain (e.g., 'Join Event' transaction). If the off-chain database (Neo4j) isn't updated immediately, the UI looks broken.

Solution

Built a robust WebSocket Event Listener using `ethers.js`. It subscribes to contract events like `ParticipantJoined` and `EventFunded`. When an event fires, a dedicated handler atomically updates the Neo4j graph state, ensuring the 'Social Graph' always reflects the 'On-Chain Truth'.

web3.service.ts