Who it is forA backend or platform engineer whose model calls run on a server or Edge runtime and who needs prompts that match an allowed component set.
The problemThe model can generate any UI unless the prompt limits it to a defined set of components, and that prompt must be kept in sync with the code that renders it.
The outcomeA server-side step that produces a system prompt from your component library, so model output stays within the components you register.
What you need first
- Node.js with npm and npx, since the README install and scaffold commands use them
- An LLM provider you can call from your backend, because OpenUI sends a generated system prompt to your model
- A component library to use or define; the README provides built-in libraries in @openuidev/react-ui
Steps
- In your backend project, run
npm install @openuidev/lang-core - Define the component library you want the model to use, with Zod schemas for props.
- Call the lang-core prompt-generation function with that library in your server route and check the returned text. (inferred, check the README)
- Pass the generated prompt to your model request and stream the response back to the client.
- Confirm that a model reply uses only components from your library.
Prompt for your agent
Using the thesysdev/openui repo, add @openuidev/lang-core to the backend at <target backend path> and generate a system prompt from a component library that has at least two components. Expected output is the prompt text; verify that it lists only the components you defined.
Caveat. The README says lang-core provides prompt generation but does not give the exact function names, so the call step must be confirmed in the package docs.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page