Most salary calculators fail engineers in two ways: they ask you to upload your exact pay to a third-party server, and they only show a single-year gap instead of the 5-year compounding base penalty you actually suffer when future percentage raises stack on an artificially low base.

While building RaiseCode 2027 — a 100% client-side, bilingual (EN/KO) salary leverage audit and privacy-masked card generator — I kept the entire model in one zero-dependency module (site/engine.js) that runs identically in the browser and in Node.js tests.

Here are the three design patterns that made it clean, deterministic, and safe to share publicly.

1. Modeling the 5-Year Compounding Base Penalty

Being $15,000 underpaid in Year 1 doesn't cost you $75,000 over five years — it costs closer to $90,000+ because:

  1. Each annual merit cycle (4%) compounds on a smaller base, and
  2. The missed cash has an investment/opportunity cost (5% annualized).

In engine.js, we compute the market benchmark from a role-track p50/p75 table scaled by market tier (1.15 for Tier-1 hubs, 1.0 for Tier-2 metro, 0.86 for regional/remote), shift the target upward when active leverage signals are present (quantifiedWin, teamDependency, externalDemand, scarceSkill), and compound the gap over 5 years:

const signalCount = Object.values(signals).filter(Boolean).length; const targetBenchmark = signalCount >= 3 ? Math.round(marketP50 + (marketP75 - marketP50) * 0.65) : signalCount >= 1 ? Math.round(marketP50 + (marketP75 - marketP50) * 0.30) : marketP50; const gapAmount = Math.max(0, targetBenchmark - currentPay); const gapPct = Math.round((gapAmount / currentPay) * 100); // 5-year compounding loss (4% annual merit stacking + 5% opportunity cost) let fiveYearLoss = 0; for (let y = 0; y < 5; y++) { fiveYearLoss += gapAmount * Math.pow(1.04, y) * Math.pow(1.05, 4 - y); } fiveYearLoss = Math.round(fiveYearLoss); 

Working backwards from gapPct also stops people from asking for a timid 4% bump when their structural gap requires a 14%–22% market realignment.

2. Deterministic 8-Archetype Classification (No Black-Box LLM)

Instead of calling an API to invent vague advice, a deterministic priority tree maps every profile cleanly to one of 8 actionable negotiation archetypes (RC-01 through RC-08), from The Prime Flight Risk (externalDemand && scarceSkill && score >= 76) to The Golden Handcuff (currentPay >= marketP50 * 1.06 && gapPct <= 6, where pushing base cash fails and total-comp levers win):

let archetypeId = "leverage-architect"; if (currentPay >= marketP50 * 1.06 && gapPct <= 6) { archetypeId = "golden-handcuff"; } else if (signals.externalDemand && signals.scarceSkill && score >= 76) { archetypeId = "flight-risk"; } else if (signals.quantifiedWin && gapPct >= 8 && !signals.teamDependency) { archetypeId = "rainmaker"; } else if (levelIdx === 0 && (gapPct >= 8 || signalCount >= 2)) { archetypeId = "early-rocket"; } else if (levelIdx >= 3 && gapPct >= 10) { archetypeId = "over-titled"; } else if (signals.teamDependency && monthsSinceRaise >= 13) { archetypeId = "silent-backbone"; } else if (gapPct >= 16) { archetypeId = "quiet-giant"; } else if (signals.quantifiedWin && score >= 68) { archetypeId = "rainmaker"; } 

Because engine.js uses a tiny UMD wrapper (module.exports = api in Node, root.RaiseCodeEngine = api in the browser), all 8 archetypes, USD/KRW formatters, and NaN/zero-salary edge cases run under Node's built-in test runner with zero packages installed (node tests/test_engine.mjs).

3. Privacy-Safe Share Links & Canvas Export

Nobody wants to tweet their exact salary. When exporting a 9:16 Story / 16:9 X PNG card via HTML5 Canvas or generating a peer comparison link, we never serialize raw salary into the URL or default canvas output — only the archetype ID, leverage score, percentage gap, and target ask range:

function encodeShareParams(result) { const params = new URLSearchParams({ ref: result.archetypeId, s: String(result.score), g: String(result.gapPct), a: `${result.askLow}-${result.askHigh}` }); return params.toString(); } 

Everything stays in-browser — zero backend, zero login, zero PII transmitted.

Try It Live or Grab the Full 2027 Playbook Kit