← Back to Archive
AdTech / Web3 Marketing Case Study

Infra DApp

A decentralized influencer marketing protocol with KPI-weighted rewards and cross-platform analytics aggregation.

NestJS Neo4j (Graph DB) Alacrity (EOSIO) Redis WebSockets AWS SES

Architecture Overview

A hybrid Web3 system. The 'Oracle Layer' (NestJS + Neo4j) normalizes off-chain social data, while the 'Settlement Layer' (Alacrity Blockchain) executes trustless payouts based on that data.

The Challenges

Algorithmic Attribution

Problem

Fairly distributing a fixed budget among thousands of influencers is complex. A simple 'Pay Per View' model drains the budget too fast. We needed a formula that weighted 'Quality' (Engagement Rate) over 'Quantity' (Views).

Solution

Implemented a normalized KPI Engine in Cypher (Neo4j). The reward formula `((influencer_kpi / sum_kpi) * budget * interactions)` dynamically adjusts payouts based on the influencer's relative performance against the pool, preventing budget overruns.

influencer.service.ts

Cross-Platform Normalization

Problem

A 'Like' on LinkedIn is worth more than a 'Like' on TikTok. Aggregating metrics from 7 different APIs with different rate limits and data shapes was a data engineering nightmare.

Solution

Built a 'Delta-Based' tracking system. We store platform-specific adapters that fetch raw metrics and normalize them into a unified 'Engagement Score'. We use Delta Arrays `[new_views - old_views]` to track campaign-specific performance, ensuring we only pay for traction generated *during* the active campaign window.

analytics.service.ts

Hybrid State Sync

Problem

The Blockchain (Token Balances) and the Graph Database (Campaign Analytics) had to be perfectly in sync. If the Graph said '1000 Views' but the Blockchain txn failed, the system would break.

Solution

Designed a transactional 'Checkpoint' system. Campaign actions (Deposits, Claims) execute on-chain first. The backend listens for the irreversible block signal and only then commits the 'Analytics Checkpoint' to Neo4j. This ensures off-chain stats never drift ahead of on-chain reality.

campaign.service.ts

Cryptographic Login

Problem

We needed influencers to login with their wallet (for payouts) but didn't want to build a dApp browser. Standard Web2 login was not secure enough for financial claims.

Solution

Implemented 'Time-Windowed' Signature Verification. The user signs a message containing a timestamp bucket (5-minute window). The server validates the signature against the public key and the current time bucket, preventing 'Replay Attacks' where a hacker intercepts an old login signature.

auth.service.ts