All files / src/app/llms.txt route.ts

93.75% Statements 15/16
75% Branches 3/4
100% Functions 3/3
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78      1x               1x               1x                                           1x                   6x       1x 130x 5x 5x 5x 26x       5x   1x             1x        
import { STATIC_SITE_URL } from "@/lib/offline-mode";
import { publishedDocs, REPO_URL } from "@/lib/docs/published-docs";
 
export const dynamic = "force-static";
 
/**
 * /llms.txt (llmstxt.org): what the site is and where its documentation is,
 * for AI assistants that read a site before they answer about it. The list of
 * documents comes from the same index the /docs pages render, so it cannot
 * drift from them. Links go to the static site, the indexed copy.
 */
const SECTIONS: Record<string, string> = {
  ehds: "The EHDS Regulation",
  developer: "Developer documentation",
  operations: "Operations",
  security: "Security and data protection",
  klarbefund: "Klarbefund, the iPhone app",
};
 
const PAGES: [string, string, string][] = [
  ["Interactive demo", "/", "seven roles, 127 synthetic patients, no sign-in"],
  ["User guide", "/docs/user-guide", "every page of the demo, role by role"],
  [
    "Architecture",
    "/docs/architecture",
    "the five-layer knowledge graph and the services",
  ],
  [
    "EHDS glossary",
    "/docs/ehds/glossary",
    "the Regulation's terms as the code uses them",
  ],
  ["Roadmap", "/docs/roadmap", "what is built and what comes next, to 2031"],
  [
    "API reference",
    "/docs/developer/api",
    "the OpenAPI description of the hub",
  ],
];
 
export function GET() {
  const lines = [
    "# European Health Data Space: interactive demo and reference implementation",
    "",
    "> An open-source reference implementation of the European Health Data Space (Regulation (EU) 2025/327). It joins the Dataspace Protocol (Eclipse EDC), FHIR R4, OMOP CDM, HealthDCAT-AP and biomedical ontologies in one Neo4j knowledge graph, with 127 synthetic patients and fictional organisations only. No real health data is processed.",
    "",
    `Source code: ${REPO_URL} (Apache 2.0). The demo runs without sign-in at ${STATIC_SITE_URL}/; a live stack with sign-in runs in office hours at https://ehds.mabu.red.`,
    "",
    "## Start here",
    "",
    ...PAGES.map(
      ([t, p, d]) => `- [${t}](${STATIC_SITE_URL}${p === "/" ? "/" : p}): ${d}`,
    ),
    "",
  ];
  for (const [section, heading] of Object.entries(SECTIONS)) {
    const docs = publishedDocs.filter((d) => d.section === section);
    Iif (docs.length === 0) continue;
    lines.push(`## ${heading}`, "");
    for (const d of docs) {
      lines.push(
        `- [${d.title}](${STATIC_SITE_URL}/docs/${d.section}/${d.slug}): ${d.summary}`,
      );
    }
    lines.push("");
  }
  lines.push(
    "## Optional",
    "",
    `- [Legal notice](${STATIC_SITE_URL}/impressum)`,
    `- [Privacy policy](${STATIC_SITE_URL}/datenschutz)`,
    "",
  );
  return new Response(lines.join("\n"), {
    headers: { "Content-Type": "text/plain; charset=utf-8" },
  });
}