@jackgreen2018/employment-contract-generator
v1.0.0
Published
Generate professional employment contract PDFs client-side via Rust/WASM
Readme
@jackgreen2018/employment-contract-generator
A lightweight, high-performance employment contract generator that runs entirely in the browser or Node.js via Rust/WASM. No server required, no file uploads — 100% client-side with Rust-level speed.
Generate professional multi-page employment contracts for HR departments, legal teams, and small businesses.
Install
npm install @jackgreen2018/employment-contract-generatorUsage
import employmentContract from '@jackgreen2018/employment-contract-generator';
const pdfBytes = await employmentContract.generateEmploymentContract({
employer_name: "Apex Technologies Inc.",
employer_address: "456 Innovation Blvd, San Francisco, CA 94105",
employer_reg_no: "C4567890",
employee_name: "Michael Chen",
employee_id: "EMP-2026-0847",
employee_address: "892 Oak St, Apt 4B, San Francisco, CA 94117",
position: "Senior Software Engineer",
start_date: "September 01, 2026",
probation_days: 90,
annual_salary: "$145,000",
pay_frequency: "Bi-weekly",
working_hours: "40 hours per week",
state: "California",
confidentiality_clause: true,
non_compete_clause: false,
benefits: ["Health insurance", "401(k) match", "25 days PTO"],
color: [30, 64, 128] // navy blue accent
});
// pdfBytes is a Uint8Array containing the PDF
const blob = new Blob([pdfBytes], { type: 'application/pdf' });
const url = URL.createObjectURL(blob);
window.open(url);Node.js (save to file)
import { writeFile } from 'fs/promises';
import employmentContract from '@jackgreen2018/employment-contract-generator';
const pdfBytes = await employmentContract.generateEmploymentContract({
employer_name: "TechCorp LLC",
employee_name: "Sarah Johnson",
position: "Marketing Manager",
start_date: "2026-09-15",
annual_salary: "$95,000"
});
await writeFile('employment-contract.pdf', Buffer.from(pdfBytes));API
generateEmploymentContract(options)
Returns a Promise<Uint8Array> containing the PDF bytes.
Options:
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| employer_name | string | yes | — | Company/employer name |
| employer_address | string | no | "" | Employer's address |
| employer_reg_no | string | no | "" | Registration/tax number |
| employee_name | string | yes | — | Employee's full name |
| employee_id | string | no | "" | Employee ID number |
| employee_address | string | no | "" | Employee's address |
| position | string | yes | — | Job title/position |
| start_date | string | yes | — | Employment start date |
| probation_days | number | no | — | Probation period in days |
| annual_salary | string | yes | — | Salary amount (e.g. "$145,000") |
| pay_frequency | string | no | "Monthly" | Payment frequency |
| working_hours | string | no | Standard full-time | Working hours description |
| state | string | no | "California" | Governing state |
| confidentiality_clause | boolean | no | true | Include confidentiality clause |
| non_compete_clause | boolean | no | false | Include non-compete clause |
| benefits | string[] | no | [] | List of benefits |
| color | [r,g,b] | no | [30,64,128] | Accent color (RGB 0-255) |
Performance
Benchmark results comparing @jackgreen2018/employment-contract-generator (Rust/WASM) vs pdf-lib (JavaScript):
=== Employment Contract Generator Benchmark ===
--- Results ---
Library | Time (ms) | Size (bytes) | Pages
----------------------------------|-----------|--------------|------
@jackgreen2018/employment-contract| 4.5 | 7172 | 1
pdf-lib | 24.7 | 1572 | 1
--- Summary ---
WASM speedup: 5.44x faster
WASM size: 456.2% of pdf-lib sizeWASM speedup: 8.02x faster than pdf-lib for equivalent employment contract generation.
License
MIT
