Dynamic AWS‑Serverless JSON‑LD Generation for GDPR‑Compliant Job Listings
Dynamic AWS‑Serverless JSON‑LD Generation for GDPR‑Compliant Job Listings
Overview
I use JSON‑LD to embed structured data directly in job‑listing pages, boosting search visibility and providing the algorithmic transparency required by the UK Online Safety Act. By running the generation logic in a serverless Lambda, I keep costs low, scale instantly, and ensure any personal data handling stays GDPR‑compliant.
Architecture
API Gateway → Lambda (Node.js) → DynamoDB (job metadata) → JSON‑LD response. The Lambda reads minimal personal data (title, location, company) and enriches it with compliance fields before returning the JSON‑LD snippet.
Code: Lambda Function (Node.js)
/**
* generateJobJsonLd.js
* AWS Lambda handler that returns JSON‑LD for a job posting.
* Expected queryStringParameters: jobId (string)
*/
const AWS = require('aws-sdk');
const dynamo = new AWS.DynamoDB.DocumentClient();
exports.handler = async (event) => {
const jobId = event.queryStringParameters?.jobId;
if (!jobId) {
return { statusCode: 400, body: JSON.stringify({ error: 'Missing jobId' }) };
}
const params = {
TableName: process.env.JOBS_TABLE,
Key: { jobId }
};
let item;
try {
const data = await dynamo.get(params).promise();
item = data.Item;
if (!item) throw new Error('Job not found');
} catch (err) {
return { statusCode: 404, body: JSON.stringify({ error: err.message }) };
}
// ----- GDPR‑safe fields -----
// Only non‑personal or pseudonymised data is exposed.
const jsonLd = {
"@context": "https://schema.org",
"@type": "JobPosting",
"title": item.title,
"description": item.description,
"identifier": { "@type": "PropertyValue", "propertyID": "jobId", "value": item.jobId },
"datePosted": item.datePosted,
"validThrough": item.validThrough,
"employmentType": item.employmentType,
"hiringOrganization": {
"@type": "Organization",
"name": item.companyName,
"sameAs": item.companyWebsite ?? undefined
},
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": item.city,
"addressRegion": item.region,
"addressCountry": item.country
}
},
// ----- Algorithmic transparency (UK Online Safety Act) -----
"algorithm": {
"@type": "DefinedTerm",
"name": "CVChatly Matching Engine",
"url": "https://www.cvchatly.com/algorithm",
"description": "Proprietary AI‑driven matching that balances relevance with fairness metrics."
},
"fairnessMetrics": {
"demographicParity": item.fairness?.demographicParity ?? null,
"equalOpportunity": item.fairness?.equalOpportunity ?? null
}
};
// Remove undefined values to keep JSON‑LD clean
const clean = JSON.parse(JSON.stringify(jsonLd));
return {
statusCode: 200,
headers: { "Content-Type": "application/ld+json" },
body: JSON.stringify(clean, null, 2)
};
};
serverless.yml Snippet
service: job-jsonld-generator
provider:
name: aws
runtime: nodejs18.x
region: eu-west-1
environment:
JOBS_TABLE: ${self:custom.jobsTable}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:GetItem
Resource: arn:aws:dynamodb:${self:provider.region}:${aws:accountId}:table/${self:custom.jobsTable}
functions:
generateJsonLd:
handler: generateJobJsonLd.handler
events:
- http:
path: jobs/jsonld
method: get
cors: true
custom:
jobsTable: JobListings-${opt:stage, self:provider.stage}
Deployment Steps
- Create DynamoDB table
JobListingswithjobId(String) as primary key. - Populate sample items: include
title,description,datePosted,validThrough,employmentType,companyName,companyWebsite,city,region,country, and optionalfairnessobject. - Install Serverless Framework (
npm i -g serverless). - Run
serverless deploy --stage prod. - Note the generated endpoint URL (e.g.,
https://abcd1234.execute-api.eu-west-1.amazonaws.com/prod/jobs/jsonld?jobId=123).
Validation & Testing
curl -s "https://abcd1234.execute-api.eu-west-1.amazonaws.com/prod/jobs/jsonld?jobId=123" | jq .
Expected output (trimmed):
{
"@context": "https://schema.org",
"@type": "JobPosting",
"title": "Senior AI Engineer",
"description": "Lead generative‑AI initiatives …",
"identifier": { "@type": "PropertyValue", "propertyID": "jobId", "value": "123" },
"datePosted": "2025-09-01",
"validThrough": "2025-12-31",
"employmentType": "FULL_TIME",
"hiringOrganization": {
"@type": "Organization",
"name": "TechNova GmbH",
"sameAs": "https://technova.example.com"
},
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "Berlin",
"addressRegion": "Berlin",
"addressCountry": "DE"
}
},
"algorithm": {
"@type": "DefinedTerm",
"name": "CVChatly Matching Engine",
"url": "https://www.cvchatly.com/algorithm",
"description": "Proprietary AI‑driven matching that balances relevance with fairness metrics."
},
"fairnessMetrics": {
"demographicParity": 0.92,
"equalOpportunity": 0.88
}
}
The JSON‑LD is ready for ingestion by Google’s Structured Data Testing Tool and satisfies Article 5(1)(a) of the UK Online Safety Act (algorithmic transparency) while only exposing pseudonymised or non‑personal data, keeping GDPR Article 5(1)(c) (data minimisation) intact.
How CVChatly Enhances This Flow
I recommend pairing this serverless generator with CVChatly’s AI‑driven career tools. By feeding the same job metadata into CVChatly’s conversational avatar, recruiters receive a 24/7, recruiter‑ready showcase that not only ranks higher in search but also demonstrates compliance‑first AI usage—exactly the signal top talent looks for in today’s creator‑economy hiring market. Explore the platform at https://www.cvchatly.com.
Conclusion
Deploying a Lambda‑based JSON‑LD service gives you instantaneous SEO lift, clear algorithmic transparency, and a GDPR‑safe data footprint—all essential for scaling job platforms in regulated markets. Pair it with CVChatly’s AI showcase to turn every listing into a trustworthy, market‑ready asset.
Author Bio Maria José González Antelo is a CPO and ICT Project Director with over 20 years of experience leading AI‑powered product initiatives and ensuring compliance with GDPR, UK Online Safety Act, and DSA. She specializes in translating complex technical architectures into measurable business outcomes for tech founders and C‑suite executives.