With the EU Cyber Resilience Act (CRA) and enterprise vendor security reviews requiring a Software Bill of Materials (SBOM) for nearly every B2B contract, engineering teams often need a fast way to turn package.json, requirements.txt, go.mod, or Cargo.toml into a valid CycloneDX v1.5 JSON manifest.
Most online converters upload your manifest to a backend server—exposing private internal package names and pinned versions before you've patched CVEs.
Here is how you can parse multi-ecosystem manifests into Package URLs (purl) and serialize a compliant CycloneDX v1.5 SBOM 100% locally in vanilla browser JavaScript (plus a live zero-upload web tool and open-source Python CLI).
1. Parsing package.json, requirements.txt, go.mod & Cargo.toml into purl Identifiers
CycloneDX relies on the Package URL (purl) specification (pkg:<ecosystem>/<name>@<version>). In under 50 lines of zero-dependency JavaScript, we can support all four major ecosystems:
function parseManifestToComponents(raw) { const comps = []; const txt = (raw || '').trim(); if (!txt) return comps; // 1. Node.js package.json if (txt.startsWith('{')) { const pkg = JSON.parse(txt); const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) }; for (const [name, range] of Object.entries(deps)) { const version = String(range).replace(/^[\^~>=<]+/, '') || 'latest'; comps.push({ type: 'library', name, version, purl: `pkg:npm/${encodeURIComponent(name)}@${encodeURIComponent(version)}` }); } return comps; } // 2. Go go.mod if (txt.includes('module ') || txt.includes('require (')) { for (const line of txt.split(/\r?\n/)) { const m = line.trim().match(/^([a-zA-Z0-9.\-_/]+)\s+(v[0-9]+\.[0-9]+\.[0-9]+[^\s]*)/); if (m && m[1] !== 'module' && m[1] !== 'go') { comps.push({ type: 'library', name: m[1], version: m[2], purl: `pkg:golang/${m[1]}@${m[2]}` }); } } if (comps.length) return comps; } // 3. Rust Cargo.toml & Python requirements.txt for (const line of txt.split(/\r?\n/)) { const clean = line.split('#')[0].trim(); if (!clean || clean.startsWith('[')) continue; const cargo = clean.match(/^([a-zA-Z0-9_-]+)\s*=\s*"([^"]+)"/); if (cargo) { comps.push({ type: 'library', name: cargo[1], version: cargo[2], purl: `pkg:cargo/${cargo[1]}@${cargo[2]}` }); continue; } const [pyName, pyVer] = clean.split(/==|>=|~=|<=|>/); if (pyName && !pyName.trim().includes(' ')) { const n = pyName.trim(); const v = (pyVer || 'latest').trim(); comps.push({ type: 'library', name: n, version: v, purl: `pkg:pypi/${encodeURIComponent(n)}@${encodeURIComponent(v)}` }); } } return comps; } 2. Wrapping Components in a CycloneDX v1.5 Envelope
Once you have the components array, wrapping it in the CycloneDX 1.5 JSON schema requires bomFormat, specVersion, a RFC 4122 urn:uuid: serial number, and a metadata block:
function buildCycloneDxSbom(appName, components) { return { bomFormat: 'CycloneDX', specVersion: '1.5', serialNumber: `urn:uuid:${crypto.randomUUID()}`, version: 1, metadata: { timestamp: new Date().toISOString(), component: { type: 'application', name: appName, version: '1.0.0' } }, components }; } Try It Live in Your Browser (Zero Uploads, MIT Open Source)
We packaged this parser into two standalone client-side tools so you can generate SBOMs and procurement documents without sending manifest files over the network:
- Standalone CycloneDX v1.5 SBOM Studio: https://itsolutions-global.vercel.app/sbom-generator
- Full Vendor Security Dossier (User-Attested SIG-Lite Matrix + GDPR Art. 28 DPA + SBOM): https://itsolutions-global.vercel.app/compliance-dossier
- Pure-Python CLI (
NexusShieldSAST + SBOM):pip install it-solutions-suite(GitHub)