live site:-wellora
description: How I built a production-grade, highly resilient healthcare landing page and form processing pipeline with zero-duplicate lead protection, multi-layer telemetry, and automated health monitoring.
When building web applications where every submission countsβsuch as healthcare platforms, demo booking forms, or high-intent lead pipelinesβa simple <form action="..."> just doesn't cut it.
If your backend relies on basic database inserts or unindexed spreadsheet scans, you face three major vulnerabilities:
- Race conditions & duplicate spam when users double-click or spammers flood your endpoint.
- Silent pipeline failures when third-party service credentials (like Google OAuth tokens or Turnstile keys) expire unnoticed.
- Sluggish response times caused by un-indexed full scans.
To solve this, I engineered Wellora Healthcareβa modern, high-conversion landing page powered by an enterprise-grade backend pipeline featuring SHA-256 hash fingerprinting in MongoDB Atlas, Cloudflare Turnstile bot protection, Google Sheets API v4 lead logging, and an automated 360Β° health checkup suite.
Here is how it works under the hood.
π οΈ The Tech Stack
Frontend
- React 19 + TypeScript + Vite: Ultra-fast build toolchain with strict type safety.
- Vanilla CSS (Design System & Micro-animations): Glassmorphism, HSL tailored color palette, high contrast & accessibility-first design tailored for seniors and caregivers.
- Cloudflare Turnstile React Integration: Invisible, privacy-focused bot verification without painful CAPTCHAs.
Backend & Infrastructure
-
Node.js + Express 5: Clean API architecture exported seamlessly as Vercel Serverless Functions (
/api/demo-request,/api/health). -
MongoDB Atlas Free Tier: SHA-256 identity hash indexing (
emailHash&phoneHash) with database-enforced unique constraints (E11000). - Google Sheets API v4: Direct RSA-SHA256 JWT service account authentication for zero-third-party-zapier dependency.
-
Telemetry & Parsing:
ua-parser-jsfor browser/OS/device identification and multi-layer IP header detection.
ποΈ System Architecture
sequenceDiagram
autonumber
participant Client as π» User Browser
participant API as π Express API (Vercel)
participant CF as π‘οΈ Cloudflare Turnstile
participant Mongo as π MongoDB Atlas (Dedup Index)
participant GS as π Google Sheets API v4
Client->>API: POST /api/demo-request
API->>API: 1. Validate inputs & honeypot check
API->>CF: 2. Verify Turnstile security token
CF-->>API: β Verified Human
API->>Mongo: 3. Query SHA-256 (emailHash OR phoneHash)
alt Duplicate Found
Mongo-->>API: Match exists
API-->>Client: 201 "Request received." (Silent Dedup)
Note over API: Log [DEDUP] marker internally
else Unique Submission
Mongo-->>API: No match found
API->>GS: 4. Append row (IST Timestamp + User Metadata)
GS-->>API: β Row appended
API->>Mongo: 5. Insert { emailHash, phoneHash, createdAt }
Mongo-->>API: β Unique index enforced
API-->>Client: 201 "Request received."
end
β‘ What Makes This Special?
1. Sub-15ms Duplicate Detection via Dual SHA-256 Hashes
Scanning an entire Google Sheet for existing emails or phone numbers becomes exponentially slower as your lead database grows (~500msβ1.5s per submission).
Instead of storing raw PII in a secondary lookup database, we generate deterministic SHA-256 cryptographic hashes of the normalized email and phone number:
// server/hashService.ts
import { createHash } from "node:crypto";
export function hashEmail(email: string): string {
const normalized = email.trim().toLowerCase();
return createHash("sha256").update(normalized).digest("hex");
}
export function hashPhone(phone: string): string {
const digitsOnly = phone.replace(/\D/g, "");
return createHash("sha256").update(digitsOnly).digest("hex");
}
In MongoDB Atlas, we enforce two independent unique indexes:
db.identities.createIndex({ "emailHash": 1 }, { unique: true });
db.identities.createIndex({ "phoneHash": 1 }, { unique: true });
Why This Is a Game-Changer:
- Lightning Fast: Hash lookups execute in 5β15ms, a 97% latency reduction compared to spreadsheet API scans.
-
Race-Condition Proof: If two identical requests hit the server at the exact same millisecond, MongoDB's unique index catches the duplicate via
E11000 DuplicateKeyErrorat the database engine level. - Privacy-First: The dedup database stores zero plaintext PIIβonly 64-character SHA-256 strings.
2. Silent Anti-Spam UX
When a duplicate submission or honeypot bot trap is triggered, the API returns a graceful 201 Request received. success response, but suppresses the database write and logs a [DEDUP] marker on the server console.
Why?
- Spammers get no feedback: Malicious bots cannot probe your system to determine which emails or phones exist in your database.
- Users don't freak out: Double-clicking users see a reassurance message without terrifying red error banners.
3. Native Google Sheets API v4 Integration (No Zapier Needed)
Instead of relying on third-party webhooks (like Zapier or Make) which add monthly costs and failure points, the backend signs a native RSA-SHA256 JWT using Google Service Account credentials:
// server/googleSheetsService.ts
function createServiceAccountJwt(email: string, privateKey: string): string {
const issuedAt = Math.floor(Date.now() / 1000);
const header = encodeBase64Url(JSON.stringify({ alg: "RS256", typ: "JWT" }));
const claims = encodeBase64Url(
JSON.stringify({
iss: email,
scope: "https://www.googleapis.com/auth/spreadsheets",
aud: "https://oauth2.googleapis.com/token",
iat: issuedAt,
exp: issuedAt + 3600,
})
);
const unsignedToken = `${header}.${claims}`;
const signer = createSign("RSA-SHA256");
signer.update(unsignedToken);
signer.end();
return `${unsignedToken}.${signer.sign(privateKey, "base64url")}`;
}
4. Rich Metadata & Telemetry
Every submission records enriched lead context:
-
Kolkata (IST) 12-Hour AM/PM Timestamp: Formatted using
Intl.DateTimeFormat(10 Aug 2026, 08:36:34 PM IST). -
Clean Browser & OS Parsing: Powered by
ua-parser-js(Chrome 128.0.0.0 / Windows 10 (Desktop)). -
Multi-Layer IP Fallback: Inspects
x-vercel-forwarded-forβx-forwarded-forβx-real-ipβcf-connecting-ipβsocket.remoteAddress. -
Vercel Geo-IP Decoding: Automatically extracts
CityandRegion.
5. Automated 360Β° Health Monitoring (GET /api/health)
Production health isn't just "is the server running?". It's "are all external services authorized and working?".
The built-in health endpoint (/api/health?deep=true) tests:
- API Uptime & Memory: Node process readiness.
- Cloudflare Turnstile Config: Secret key format and readiness.
- Google Sheets OAuth: Live token issuance check.
- MongoDB Atlas Index: Connection pool health.
Combined with GitHub Actions scheduled workflows, the system automatically alerts via email or Discord webhook if Google credentials expireβbefore any customer experiences a failure.
π Benchmarks & Performance Comparison
| Metric | Traditional Spreadsheet Scan | Our SHA-256 MongoDB Architecture |
|---|---|---|
| Dedup Latency | ~300ms β 1,500ms | 5ms β 15ms (97% faster) |
| Race-Condition Safety | β Prone to duplicate rows | β Database-enforced atomic unique index |
| Data Privacy | Plaintext stored in dedup DB | SHA-256 hashes only |
| Uptime Monitoring | Manual checks | Automated deep health API + GitHub Actions |
π‘ Key Takeaways
- Decouple Dedup from Storage: Use fast, indexed hash lookups for dedup while keeping your primary lead storage (Google Sheets/Postgres) simple and append-only.
-
Enforce Uniqueness at DB Level: Never rely solely on application-level
findOne()checks; database unique indexes prevent multi-request race conditions. - Build Health Probes Early: Deep health endpoints that audit OAuth token issuance save hours of production debugging.
π¬ What do you think?
How do you handle zero-duplicate lead pipelines in your apps? I'd love to hear your thoughts in the comments below! π
(If you found this article helpful, give it a π and a bookmark!)


Top comments (0)