Build a job board in 10 minutes

Our starter is a complete job board in one file: a search box, a country filter and a list of jobs with apply links. It keeps its own copy of the newest jobs, so searches are instant, and can keep that copy current with the changes feed. It needs only Node.js 18 or newer: no framework, nothing to install.

Download the starter (.zip)server.js, package.json and a README, about 7 KB.

1. Get an API key

Create an account (the free trial works) and copy your key from the API keys page.

2. Unzip and run

bash
unzip job-board-starter.zip
cd job-board-starter
export THEJOBSAPI_KEY="tja_live_..."      # Windows PowerShell: $env:THEJOBSAPI_KEY = "tja_live_..."
node server.js

Open http://localhost:3000. Each start takes a few seconds per country while it loads the newest 500 jobs; refresh the page when they appear.

How it works

  • Loading: each start loads the newest jobs of each country with /v1/jobs and saves them to jobs.json.
  • Staying current (when you turn it on, below): the first start finds where the changes feed ends, then it reads /v1/changes from its saved position: created and updated jobs are added or replaced, expired and excluded jobs are removed.
  • Search: a word match over title, employer and places in the saved copy, newest first. Each job links to the employer's application page (apply_url, or the original posting url).
  • Your key stays on the server, read from the THEJOBSAPI_KEY environment variable. Visitors never see it.

Settings

Environment variables; only the key is required.

VariableDefaultWhat it does
THEJOBSAPI_KEYYour API key.
COUNTRIESUS,CACountries to show, comma-separated: US, CA, GB, AU, DE. Use the ones your plan covers.
START_JOBS500Newest jobs loaded per country on the first start.
MAX_JOBS5000Jobs kept per country; older ones are dropped.
SYNC_MINUTES0Read the changes feed every this many minutes; 0 is off.
PORT3000Web server port.
DATA_FILEjobs.jsonWhere the copy is saved. Delete it to start fresh.

Keep it current with the changes feed

bash
SYNC_MINUTES=5 node server.js

Every 5 minutes the board then applies new, updated, expired and excluded jobs, and a restart continues from its saved position. We recommend it on paid plans, which have no job allowance.

On the free trial

Every job the API returns counts toward the trial's 100,000 jobs, including every event of the changes feed, however often you read it. On December 1, 2026 the US feed had about 100,000 events an hour and Canada's about 10,000, so following the US feed would use the whole trial in about an hour. On the trial, leave it off, or turn it on only briefly to try it, and watch your usage on the dashboard.

Make it yours

  • The page is the page() function: change its HTML and CSS.
  • slim() picks the job fields that are kept. Add pay, employment types or descriptions from the job object (descriptions need description=text on the requests).
  • For more jobs than fit in memory, store them in a database and search there; the sync loop stays the same.

The code

The whole of server.js, as it is in the download:

server.js
// Job board starter for The Jobs API (https://thejobsapi.com/docs/job-board-starter).
//
// A complete job board in one file: a search box, a country filter and a list of jobs with apply links. It keeps its
// own copy of the newest jobs in each country, so searches never wait for the API, and can keep that copy current with
// the changes feed (/v1/changes): set SYNC_MINUTES. Plain Node.js 18 or newer, no dependencies.
//
//   export THEJOBSAPI_KEY="tja_live_..."
//   node server.js            # then open http://localhost:3000
//
// Settings (environment variables, all optional except the key):
//   COUNTRIES      countries to show, comma-separated: US, CA, GB, AU, DE (default US,CA)
//   START_JOBS     newest jobs to load per country on the first start (default 500)
//   MAX_JOBS       jobs to keep per country (default 5000)
//   SYNC_MINUTES   read the changes feed every this many minutes; 0 = off (default 0: the newest jobs are reloaded
//                  at each start). On the free trial every change event counts toward its 100,000 jobs: on December 1,
//                  2026 the US feed had about 100,000 events an hour and Canada about 10,000. Paid plans have no job
//                  allowance; there, SYNC_MINUTES=5 is a good choice.
//   PORT           web server port (default 3000)
//   DATA_FILE      where the copy is saved between restarts (default jobs.json)
import { createServer } from "node:http";
import { readFile, writeFile } from "node:fs/promises";

const API = process.env.THEJOBSAPI_URL ?? "https://api.thejobsapi.com";
const KEY = process.env.THEJOBSAPI_KEY;
const COUNTRIES = (process.env.COUNTRIES ?? "US,CA").split(",").map(c => c.trim().toUpperCase()).filter(Boolean);
const START_JOBS = Number(process.env.START_JOBS ?? 500);
const MAX_JOBS = Number(process.env.MAX_JOBS ?? 5000);
const SYNC_MINUTES = Number(process.env.SYNC_MINUTES ?? 0);
const PORT = Number(process.env.PORT ?? 3000);
const DATA_FILE = process.env.DATA_FILE ?? "jobs.json";
const PAGE_SIZE = 50;
const countryNames = { US: "United States", CA: "Canada", GB: "United Kingdom", AU: "Australia", DE: "Germany" };

if (!KEY) {
  console.error('Set your API key first: export THEJOBSAPI_KEY="tja_live_..."  (get one at https://thejobsapi.com/dashboard/keys)');
  process.exit(1);
}

// ---------------------------------------------------------------------------------------------------------------
// The API
// ---------------------------------------------------------------------------------------------------------------

/** GET an API path and return its JSON. Waits and retries when the API asks to (429 or 503 with Retry-After). */
async function api(path, params = {}) {
  const url = `${API}${path}?${new URLSearchParams(params)}`;
  for (let attempt = 1; ; attempt++) {
    const response = await fetch(url, { headers: { Authorization: `Bearer ${KEY}` } });
    if ((response.status === 429 || response.status === 503) && attempt < 4) {
      await new Promise(resolve => setTimeout(resolve, Number(response.headers.get("retry-after") ?? 5) * 1000));
      continue;
    }
    if (!response.ok) {
      const problem = await response.json().catch(() => ({}));
      throw new Error(`${path} answered ${response.status}: ${problem.detail ?? response.statusText}`);
    }
    return response.json();
  }
}

// ---------------------------------------------------------------------------------------------------------------
// Our copy of the jobs: { [country]: { since, jobs: { [id]: job }, syncedAt, error } }, saved to DATA_FILE
// ---------------------------------------------------------------------------------------------------------------

let store = {};
try { store = JSON.parse(await readFile(DATA_FILE, "utf8")); } catch { /* first start */ }
const save = () => writeFile(DATA_FILE, JSON.stringify(store));

/** Keep only what the page shows. */
function slim(job) {
  return {
    id: job.id, title: job.title, organization: job.organization, url: job.apply_url ?? job.url,
    places: (job.locations ?? []).map(place => place.label).filter(Boolean),
    remote: job.remote === true, types: job.employment_types ?? [], salary: job.salary ?? null,
    first_seen_at: job.first_seen_at,
  };
}

/** Keep the newest MAX_JOBS jobs. */
function trim(state) {
  const jobs = Object.values(state.jobs).sort((a, b) => b.first_seen_at.localeCompare(a.first_seen_at)).slice(0, MAX_JOBS);
  state.jobs = Object.fromEntries(jobs.map(job => [job.id, job]));
}

/**
 * The changes feed has no "latest position" call, so on the first start we find its end with one-event requests:
 * double the position until no event follows it, then halve the gap. That is about 60 small requests, each returning
 * at most one job. Afterwards we only read new events.
 */
async function findFeedEnd(country) {
  const eventsAfter = async since =>
    (await api("/v1/changes", { country, since, limit: 1, source_fields: false })).changes.length > 0;
  let low = 0, high = 1;
  while (await eventsAfter(high)) { low = high; high *= 2; }
  while (high - low > 1) {
    const middle = Math.floor((low + high) / 2);
    if (await eventsAfter(middle)) low = middle; else high = middle;
  }
  return String(high);
}

/** Load the newest jobs with /v1/jobs; when syncing, first note where the changes feed ends. */
async function start(country) {
  const since = SYNC_MINUTES > 0 ? await findFeedEnd(country) : null;
  const jobs = {};
  let cursor;
  while (Object.keys(jobs).length < START_JOBS) {
    const limit = Math.min(1000, START_JOBS - Object.keys(jobs).length);
    const page = await api("/v1/jobs", { country, limit, ...(cursor ? { cursor } : {}) });
    for (const job of page.jobs) jobs[job.id] = slim(job);
    if (!page.next_cursor) break;
    cursor = page.next_cursor;
  }
  store[country] = { since, jobs, syncedAt: new Date().toISOString() };
  console.log(`${country}: loaded ${Object.keys(jobs).length} jobs${since ? `, changes feed from position ${since}` : ""}`);
}

/** Apply every change since our saved position: add new and updated jobs, remove expired and excluded ones. */
async function sync(country) {
  const state = store[country];
  let applied = 0;
  for (;;) {
    const batch = await api("/v1/changes", { country, since: state.since, limit: 1000, source_fields: false });
    for (const change of batch.changes) {
      if (change.kind === "expired" || change.kind === "excluded") delete state.jobs[change.job.id];
      else state.jobs[change.job.id] = slim(change.job);
    }
    applied += batch.changes.length;
    state.since = batch.next_since;
    if (!batch.more) break;
  }
  trim(state);
  state.syncedAt = new Date().toISOString();
  console.log(`${country}: applied ${applied} changes, ${Object.keys(state.jobs).length} jobs`);
}

let running = false;
async function refresh() {
  if (running) return;
  running = true;
  for (const country of COUNTRIES) {
    try {
      if (!store[country] || SYNC_MINUTES <= 0 || store[country].since == null) await start(country);
      else await sync(country);
      delete store[country].error;
    } catch (error) {
      console.error(`${country}: ${error.message}`);
      if (store[country]) store[country].error = error.message;
    }
    await save();
  }
  running = false;
}

// ---------------------------------------------------------------------------------------------------------------
// The web page
// ---------------------------------------------------------------------------------------------------------------

const escape = text => String(text ?? "").replace(/[&<>"']/g, c => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
const fold = text => String(text ?? "").normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
const periods = { HOUR: "hour", DAY: "day", WEEK: "week", MONTH: "month", YEAR: "year" };

function salary(pay) {
  if (!pay || (pay.min == null && pay.max == null)) return "";
  const money = value => value == null ? null : `${Number(value).toLocaleString("en")}`;
  const range = [money(pay.min), money(pay.max)].filter(Boolean).join("–");
  return `${pay.currency ?? ""} ${range}${periods[pay.period] ? ` a ${periods[pay.period]}` : ""}`.trim();
}

function search(country, q) {
  const words = fold(q).split(/\s+/).filter(Boolean);
  return Object.values(store[country]?.jobs ?? {})
    .filter(job => {
      const text = fold(`${job.title} ${job.organization} ${job.places.join(" ")} ${job.remote ? "remote" : ""}`);
      return words.every(word => text.includes(word));
    })
    .sort((a, b) => b.first_seen_at.localeCompare(a.first_seen_at));
}

function page({ q, country, from }) {
  const state = store[country];
  const results = search(country, q);
  const shown = results.slice(from, from + PAGE_SIZE);
  const more = from + PAGE_SIZE < results.length
    ? `<a class="more" href="/?${new URLSearchParams({ q, country, from: from + PAGE_SIZE })}">More jobs</a>` : "";
  const items = shown.map(job => `
    <li>
      <a class="title" href="${escape(job.url)}" target="_blank" rel="noopener">${escape(job.title)}</a>
      <div class="org">${escape(job.organization)}</div>
      <div class="meta">${escape([job.places.join(" · "), job.remote ? "Remote" : "", salary(job.salary)].filter(Boolean).join(" — "))}</div>
      <a class="apply" href="${escape(job.url)}" target="_blank" rel="noopener">Apply</a>
    </li>`).join("");
  const status = !state ? "Loading jobs… refresh in a minute."
    : `${results.length.toLocaleString("en")} of ${Object.keys(state.jobs).length.toLocaleString("en")} jobs · updated ${new Date(state.syncedAt).toLocaleString("en")}${state.error ? ` · last update failed: ${escape(state.error)}` : ""}`;
  return `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${q ? `${escape(q)} jobs` : "Jobs"} · ${escape(countryNames[country] ?? country)}</title>
<style>
  body { font: 16px/1.5 system-ui, sans-serif; margin: 0; color: #111; background: #f6f6f4; }
  main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
  h1 { font-size: 28px; margin: 0 0 16px; }
  form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
  input, select, button { font: inherit; padding: 10px 12px; border: 1px solid #bbb; border-radius: 10px; background: #fff; }
  input { flex: 1 1 240px; }
  button { background: #111; color: #fff; border-color: #111; cursor: pointer; }
  .status { color: #666; font-size: 14px; margin: 0 0 16px; }
  ul { list-style: none; padding: 0; margin: 0; }
  li { background: #fff; border: 1px solid #e3e3e0; border-radius: 14px; padding: 16px; margin-bottom: 10px; position: relative; }
  .title { font-weight: 600; color: #111; text-decoration: none; font-size: 17px; padding-right: 72px; display: block; }
  .title:hover { text-decoration: underline; }
  .org { color: #333; }
  .meta { color: #666; font-size: 14px; }
  .apply { position: absolute; top: 16px; right: 16px; font-size: 14px; color: #fff; background: #e0245e; padding: 4px 12px; border-radius: 8px; text-decoration: none; }
  .more { display: inline-block; margin-top: 8px; }
</style>
</head>
<body>
<main>
  <h1>Find a job</h1>
  <form action="/">
    <input name="q" value="${escape(q)}" placeholder="Job title, employer or place" aria-label="Search">
    <select name="country" aria-label="Country">
      ${COUNTRIES.map(c => `<option value="${c}"${c === country ? " selected" : ""}>${escape(countryNames[c] ?? c)}</option>`).join("")}
    </select>
    <button>Search</button>
  </form>
  <p class="status">${status}</p>
  <ul>${items}</ul>
  ${more}
</main>
</body>
</html>`;
}

createServer((request, response) => {
  const url = new URL(request.url, "http://localhost");
  if (url.pathname !== "/") { response.writeHead(404).end("Not found"); return; }
  const country = COUNTRIES.includes(url.searchParams.get("country")) ? url.searchParams.get("country") : COUNTRIES[0];
  const from = Math.max(0, Number.parseInt(url.searchParams.get("from") ?? "0", 10) || 0);
  response.writeHead(200, { "content-type": "text/html; charset=utf-8" });
  response.end(page({ q: url.searchParams.get("q") ?? "", country, from }));
}).listen(PORT, () => console.log(`Job board: http://localhost:${PORT}`));

await refresh();
if (SYNC_MINUTES > 0) setInterval(refresh, SYNC_MINUTES * 60_000);