@kaleabdenbel/llmweb
v1.0.6
Published
A compiler for LLM-readable truth from static and dynamic sources.
Maintainers
Readme
llmweb 🛸
The data compiler that transforms messy application state into LLM-readable truth.
The Mental Model
llmweb is not just a metadata library. it's a compiler for your website's soul.
- Static Truth: Your contract with the world. Deterministic. Versioned.
- Dynamic Truth: Live data from APIs, Server Actions, or DB calls.
- The Engine: Compiles these into a single, structured JSON object for LLMs.
- Framework Adapters: Utilities for Next.js, React, Express, and Vanilla JS.
Quick Start
The fastest way to get started is using the CLI:
npx llmweb initFor a deep dive into the Bridge Pattern, Server Actions, and Advanced Mapping, check out our Definitive Guide.
Integration (Next.js)
1. Define your Truth
Create an LLM route to expose your site's data.
// app/llm/route.ts
import { createLLMHandler } from "@kaleabdenbel/llmweb/adapters/next";
import { getStaffList } from "@/actions/getStaffList";
const config = {
static: "./llm.json", // Path to your static contract
dynamic: {
announcements: {
from: { type: "fetch", url: "https://api.site.com/news" },
map: {
title: "headline",
body: "content",
publishedAt: "date",
},
},
staff: {
from: { type: "fn", call: getStaffList },
map: {
name: "full_name",
role: "role_title",
},
},
},
};
export const GET = createLLMHandler(config);2. Use the Component
Render the compiled truth directly in your admin or SEO pages.
import { LLMJson } from "llmweb/adapters/next";
export default function LlmTruthPage() {
return (
<div className="p-8">
<h1>LLM Truth Engine</h1>
<LLMJson
config={config}
className="bg-gray-900 text-green-400 p-4 rounded"
/>
</div>
);
}The Engine Features
- Brutal Mapping: Rename, pick, omit, and compute fields easily.
- Parallel Resolution: All dynamic sources are resolved in parallel.
- Error Boundaries: Configurable
failLoudlymode for strict data integrity. - Timeouts: Prevent slow APIs from hanging your truth route.
- Deterministic Merging: Static structure defines the slots; dynamic data fills them.
- AI-Friendly JSON-LD: Automatically generate Schema.org metadata for LLM context discovery.
Advanced Mapping
map: {
fullName: (s) => `${s.first} ${s.last}`, // Computed field
meta: {
tags: "categories", // Nested renames
}
}License
MIT
