Iurii RoguliaIurii Rogulia
AboutAI EngineeringServicesProjectsAI SkillsStackTestimonialsPhrasesBlog
Contact
Iurii ships.

Iurii Rogulia, senior full-stack software engineer. Professionally building software since 2001.

Think of a numberThink of a birthday
Hourly ratesChecklistsPrivacy PolicyCookie Policy

Business

TMI Iurii Rogulia
VAT ID: FI29845875
DUNS: 368664211
Lappeenranta, Finland 🇫🇮

  1. Home
  2. /
  3. Projects
  4. /
  5. HTPBE.TECH – Has This PDF Been Edited?

Iurii Detects: HTPBE.TECH – Has This PDF Been Edited?

September 25, 2024

SaaS platform for PDF authenticity verification with a public REST API. Detects edits through 5-layer analysis of metadata, xref structure, digital signatures, and content.

Live Demo

Stack

Next.jsReactTypeScriptNode.jsTailwind CSSNixpacks

Libraries

Drizzle ORMfast-checkNextAuth.jspdf-libpinopolytypoVitestZod

Databases

PostgreSQLRedis

Services

CloudflareCloudflare R2CoolifyGitHub ActionsGoogle AnalyticsMollieResendSentryUmamiUpstashvatnode API

Topics

APIAuthBillingCron JobsPDFRate LimitingSaaSSchema.orgSecuritySEOWebhooks

Key Results

  • Answers a costly question in seconds – has this signed document been edited since it was signed?
  • Self-service instead of enterprise procurement – from $15/month, no sales calls, NDAs, or annual contracts
  • Every verdict is explainable – a 0–100 risk score with the specific markers behind it, not a black-box guess
  • Handles real-world documents – files up to 10 MB, uploaded straight from the browser to object storage
  • On-premise option for regulated teams – an Enterprise Docker deployment so documents never leave the organisation
HTPBE.TECH – Has This PDF Been Edited?

The Business Problem

When a bank receives a signed loan contract, or a law firm gets a countersigned agreement, or an HR team processes an employment certificate – how do they verify the document has not been edited after signing? Most organisations have no reliable answer. They look at the signature icon in Acrobat and assume that means something. Often it does not.

Enterprise PDF verification tools charge $1–$1.50 per document and require sales calls, NDAs, and annual contracts before you can run a single test. There was no self-service option for teams that need to verify dozens or hundreds of documents a month without going through an enterprise procurement process. The gap was obvious: a product that works via API, explains what it found, and costs less than a coffee per day.

The Solution

I built a self-service SaaS that answers one question fast and clearly: has this signed PDF been edited since it was signed? Upload a document – or send it through the API – and within seconds you get a 0–100 risk score with the specific evidence behind it, not a black-box verdict you have to trust blindly.

The verdict is reliable because it is deterministic. A legitimate PDF has one internal revision table; every later edit adds another. That single, checkable fact – combined with metadata analysis, digital-signature validation, and fingerprinting of known editing tools – is more dependable than any heuristic guess, and it is reproducible: the same document always yields the same explained result.

Around that engine I built the full commercial product: sign-up, separate live and test API environments, tiered billing (a self-built billing layer handling mandates, proration, dunning, and EU VAT), and algorithm versioning so that when the detection logic improves, an older stored result is automatically flagged rather than silently trusted. For banks, law firms, and other regulated teams whose documents cannot leave their own infrastructure, an Enterprise Docker option runs the whole thing on-premise, addressing GDPR, HIPAA, and PCI DSS requirements. The API promo block on the site uses a looping SVG animation of the verification flow that I built separately.

Results

What previously required an enterprise contract and per-document billing is now available via API for $15/month. Teams at banks, law firms, and HR departments can integrate PDF verification into their own workflows without a procurement process.

MetricValue
Analysis time18 s in-thread cap, 20 s worker hard limit
Max file size10 MB, direct upload to Cloudflare R2
Detection markers7+ deterministic (iLovePDF, PDF24, QPDF, etc.)
Algorithm versionsv2.0.0 → v2.47.0
Database schema26 tables, per-period credit pool with ledger
Pricing tiers$15–$499/month + Enterprise on-premise

The deterministic approach means results are reproducible, explainable, and fast. Enterprise option (Docker/Kubernetes) addresses GDPR, HIPAA, and PCI DSS requirements for fintech and legal clients.

Technical SEO

The category – ‘PDF authenticity verification API’ – is small enough that organic discovery from developers searching for the exact problem is the primary acquisition channel. That makes technical SEO load-bearing, not optional:

  • JSON-LD schema for SoftwareApplication, FAQPage, BreadcrumbList, and Organization – surfaces rich results for the long-tail queries this niche actually generates (‘detect if PDF was edited’, ‘verify digital signature PDF API’)
  • Server-rendered marketing, pricing, and blog pages via Next.js App Router – full HTML, no client-side data fetching on public pages
  • Per-post OG images – engineering content (how the 5-layer analysis works, PDF tampering markers) gets shared in developer communities, and the link previews need to render the article, not a generic banner
  • llms.txt describing the API, pricing, and the technical articles – the developer audience increasingly evaluates tools through ChatGPT and Perplexity before they ever click through
  • Sitemap auto-generated from blog and docs content, IndexNow ping on every deploy so new technical articles reach Bing within minutes
  • Core Web Vitals passing on mobile – minimal third-party scripts, fonts loaded without layout shift, images optimized

Under the Hood

For the technically curious, here is how the core pieces are built. One real constraint shaped the upload path: real-world contracts and scans regularly run to several megabytes, so the browser uploads straight to object storage instead of sending the file through the application server.

Client-Side Upload Straight to Cloudflare R2

A multi-step upload pattern: the browser asks the API for a presigned URL, uploads the PDF directly to Cloudflare R2, and then hands the object reference and a single-use token to a server action, which verifies the stored object and analyses it:

// hooks/useFileUpload.ts — Step 1: ask our API for a presigned PUT URL
const tokenRes = await fetch("/api/blob-token", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ filename: cleanFilename, size: file.size }),
});
const { uploadUrl, publicUrl, uploadToken } = await tokenRes.json();
 
// Step 2: browser → R2
await fetch(uploadUrl, {
  method: "PUT",
  body: file,
  headers: { "Content-Type": "application/pdf" },
});
 
// Step 3: the server action redeems the token, checks the object, analyses it
const result = await analyzePdf(publicUrl, file.name, /* …client ids… */ uploadToken);
 
// lib/services/upload-intent.service.ts — hard ceiling on what an upload intent can authorise
export const MAX_UPLOAD_BYTES = 10 * 1024 * 1024;

The /api/blob-token route checks the request origin as CSRF defence, rate-limits per IP (anonymous) or per user, rejects declared sizes above the 10 MB ceiling, and signs a short-lived PUT URL bound to the declared size under a staging/ prefix. Files up to 10 MB are accepted, and nothing under staging/ is analysed until the server has admitted the object.

5-Layer PDF Forensics with Algorithm Versioning

Analysis is split into independent layers. The critical marker is xref table counting: a legitimate PDF has one, each incremental update adds another. PDF 1.5+ complicates this with xref streams (different syntax):

// lib/services/pdf-structure.service.ts
private countXrefTables(pdfBuffer: Buffer): number {
  let count = 0;
  let pos = 0;
  while (pos < pdfBuffer.length) {
    // Classic xref tables: "xref\n" at start of line
    const xrefIdx = pdfBuffer.indexOf(Buffer.from('xref\n'), pos);
    // xref streams (PDF 1.5+): "/Type /XRef" in stream dictionary
    const xrefStreamIdx = pdfBuffer.indexOf(Buffer.from('/Type /XRef'), pos);
    const nextIdx = Math.min(
      xrefIdx === -1 ? Infinity : xrefIdx,
      xrefStreamIdx === -1 ? Infinity : xrefStreamIdx
    );
    if (nextIdx === Infinity) break;
    count++;
    pos = nextIdx + 5;
  }
  return count;
}

The algorithm is versioned (currently v2.47.0), and the version is saved with each result. When requesting /api/v1/result/{uid}, outdated results are automatically flagged with algorithmOutdated: true.

Subscription Quota as a Credit Pool with a Ledger

Quota is not derived from counting checks rows. Each subscriber has a per-period credit balance in users.subscriptionCreditsRemaining; a credit is debited when an analysis is reserved and compensated back if no result is delivered, and every change is appended to subscription_credit_ledger. Credits used is the monthly allowance minus the balance, so a check that costs more than one credit is reflected immediately (the admin dashboard reads it the same way):

// lib/services/subscription-credit-pool.ts
export function creditsUsedThisPeriod(row: {
  requestsPerMonth: number | null;
  subscriptionCreditsRemaining: number | null;
}): number {
  if (row.requestsPerMonth == null) return 0;
  return Math.max(0, row.requestsPerMonth - (row.subscriptionCreditsRemaining ?? 0));
}

Dual-Environment API Keys (Live/Test)

Keys follow format htpbe_{live|test}_{43-random-chars}. Test keys only accept mock URLs from whitelist – developers can test integration without consuming quota:

// app/api/v1/analyze/route.ts
const keyEnv = getApiKeyEnvironment(apiKey); // 'live' | 'test'
 
if (keyEnv === 'test') {
  const TEST_URLS = ['https://htpbe.tech/samples/modified-high.pdf', ...];
  if (!TEST_URLS.includes(file_url)) {
    return Response.json({
      error: 'Test keys only work with official HTPBE sample URLs',
      test_urls: TEST_URLS,
    }, { status: 422 });
  }
}
// Live keys: fetch any public PDF URL, analyze, bill quota

LTV Validation (Avoiding False Positives)

Long-Term Validation (LTV) adds timestamps and certificates to signed PDFs – this is legitimate modification that shouldn’t trigger alerts:

// lib/services/pdf-ltv.service.ts
export function analyzeLTV(bytes: Uint8Array): LTVAnalysis {
  const text = new TextDecoder("latin1").decode(bytes);
 
  // Detect Document Security Store (DSS)
  const hasDSS = /\/Type\s*\/DSS\b/.test(text);
 
  // Detect Document Timestamp
  const hasDTS =
    /\/Type\s*\/DocTimeStamp\b/.test(text) || /\/SubFilter\s*\/ETSI\.RFC3161\b/.test(text);
 
  // ETSI PAdES-LTV compliance markers
  const isETSICompliant = hasDSS || hasDTS || /\/SubFilter\s*\/ETSI\.CAdES\.detached\b/.test(text);
 
  return {
    hasLTV: hasDSS || hasDTS,
    hasDSS,
    hasDTS,
    isETSICompliant,
    ltvDetails: isETSICompliant ? extractLTVDetails(bytes) : null,
  };
}
Iurii RoguliaAvailable

Need something similar?

I build custom solutions – from APIs to full products. Let’s talk about your project.

View all projects

Related projects

vatnode.dev – EU VAT Validation API
vatnode.dev – EU VAT Validation API
January 19, 2026
vatnode.dev – EU VAT Validation API

Developer-first SaaS API for EU VAT validation via VIES with Redis caching, change monitoring, and webhook notifications.

Stack

Next.jsReactHonoTypeScriptNode.jsTailwind CSSTurborepoDocker

Databases

PostgreSQLRedis
kri.rocks – Booking Website and Online Scheduling SaaS for Beauty Businesses
kri.rocks – Booking Website and Online Scheduling SaaS for Beauty Businesses
September 28, 2026

Vertical SaaS that gives a salon, barbershop or solo beauty specialist their own booking website in minutes.

Stack

Next.jsReactHonoTypeScriptNode.jsTailwind CSSTurborepoDocker

Databases

PostgreSQLRedis

Related posts

Next.js SaaS Checklist: Launch Production-Ready in 8 Weeks
January 19, 2026· 17 min
Next.js SaaS Checklist: Launch Production-Ready in 8 Weeks

40+ point production SaaS checklist: auth, Stripe billing, PostgreSQL, rate limiting, email, monitoring, and security – with honest 8-week build estimates.

Stack

Next.jsTypeScript

Databases

PostgreSQLRedis
API Key Management for a Public SaaS API
August 5, 2026· 14 min
API Key Management for a Public SaaS API

API key management for a public SaaS: hashing keys at rest, prefix + last-4 display, fail-closed validation, and revocation.

Stack

TypeScriptNode.jsHono

Databases

PostgreSQL