When I set out to build ResFlows.online, I wanted to avoid the two biggest traps of modern AI wrappers: sluggish 60-second response times and heavy, multi-step onboarding walls that kill user curiosity before they even test the product.

Instead of just stitching together an OpenAI call and a basic form, I designed the system around deterministic caching, stateless-to-stateful auth transitions, and privacy-first rate limiting.

Here is a deep dive into how I architected the application from end to end.

High-Level System Architecture

At a glance, the application runs on a unified full-stack Next.js architecture backed by PostgreSQL:

  • Client-Side Parsing: Browser-based PDF text extraction parses documents locally before transmission, ensuring raw binary files never bloat server memory or require object storage overhead.
  • Authentication & Edge Security: Route-level edge verification secured with stateless HS256 JWT HTTP-only cookies and passwordless email magic links.
  • Persistence & Caching Layer: PostgreSQL relational storage managed through Prisma 7, designed around content-addressable deduplication.
  • AI & Fallback Engine: Strict JSON-schema LLM inference paired with a deterministic client-side keyword-matching fallback for high availability.
  • Telemetry: Product analytics routed through a first-party reverse proxy to avoid ad-blocker interference.

1. The Request & Caching Pipeline

The core analysis pipeline is designed to minimize LLM token burn while keeping latency around ~2 seconds:

PDF Upload (Browser) ──► Text Extraction & Normalization │ ▼ Analysis Request ───────► Auth / Guest Quota Check │ ┌───────────┴───────────┐ ▼ ▼ [Cache Hit?] [Cache Miss] (SHA-256 Composite) Strict JSON Inference │ │ │ Persist Normalized │ Entities & Score └───────────┬───────────┘ ▼ Structured Score Card + Async Link Metadata Fetch 

Content-Addressable Deduplication

Users often re-run the exact same resume against a job description or tweak minor formatting. To prevent duplicate database rows and redundant LLM calls, I architected a content-addressable schema using SHA-256 hashes:

import crypto from 'crypto'; export function generateContentHash(...parts: string[]): string { return crypto .createHash('sha256') .update(parts.map((p) => p.trim()).join('||')) .digest('hex'); } 

Both job descriptions and extracted resume texts are hashed alongside the user's identity and enforced with unique database constraints, paired with a composite unique key on the resulting analysis record.

When an analysis request arrives, the server computes these hashes first. On a cache hit, it returns the stored score, summary, strengths, weaknesses, and extracted contact info immediately without touching the LLM or deducting from the user's quota.

2. Dual-Mode Auth & Zero-Login "Guest Architecture"

Originally, the workspace sat strictly behind an authenticated session wall. Cold visitors arriving from social links bounced immediately because they didn't want to verify a magic link before seeing the product in action.

To solve this without exposing my AI budget to abuse, I re-architected the entry flow into a dual-mode pipeline:

Incoming Scan Request │ ▼ [Valid JWT Cookie?] ├── Yes ──► Authenticated Flow (Check User Quota ──► Persist History) └── No ──► Guest Flow │ ▼ Extract IP + Salt Secret │ ▼ Compute SHA-256 Hash │ ▼ [Cookie Used OR Hash >= 1?] ├── Yes ──► Block & Prompt Magic-Link Signup └── No ──► Run AI Scan ──► Set Cookie & Increment Hash 
  1. Selective Edge Protection: Opened the primary analysis workspace to public traffic while keeping saved analysis history and administrative views locked behind JWT verification.
  2. Privacy-Safe IP Hashing: When an unauthenticated request arrives, the server extracts the client IP from request headers, salts it with a server secret, and stores only a one-way SHA-256 hash. Zero raw IP addresses are persisted in the database.
  3. Dual-Layer Quota Enforcement: Combining the database usage check with an HTTP-only browser cookie enforces a strict 1-scan guest limit. Once a guest sees their score and keyword gaps, they can seamlessly convert via a 1-hour passwordless magic link to unlock persistent history and additional scans.

3. Asynchronous Enrichment & Fallback Resilience

To keep the initial scan snappy, secondary tasks are decoupled from the critical path:

  • Non-Blocking Link Enrichment: Once the primary AI score renders, the client dispatches a separate, rate-limited background request to extract GitHub, LinkedIn, and portfolio URLs from the resume text and fetch their metadata asynchronously.
  • Graceful Degradation: If the upstream LLM provider experiences an outage or rate limit, the client automatically falls back to a local frequency-based keyword extraction algorithm so the user still gets an immediate baseline score instead of an error screen.

4. Ad-Blocker-Resistant Telemetry

Because a large portion of developer traffic uses content blockers or privacy browsers, standard third-party analytics scripts drop 30–40% of funnel events. I architected a first-party rewrite proxy on the application server to forward telemetry traffic seamlessly, while excluding the proxy path from edge authentication checks so session middleware never intercepts analytics payloads.

Browser Event (Funnel / Pageview) │ ├──► Direct to 3rd-Party Host ──[X] Blocked by uBlock / Brave │ └──► First-Party Proxy Path (Same Domain) │ ▼ Bypass Edge Auth Check │ ▼ Server Rewrite ──► Upstream Analytics Cloud (200 OK) 

Try the Architecture Live

You can test the zero-login guest pipeline right now with any PDF resume and job description:

👉 Launch ResFlows Analyzer

If you're building with Next.js 16, Prisma 7, or designing freemium AI pipelines, I'd love to hear how you handle caching and anonymous rate limiting in the comments!