createRegistryServer() — ui Function Reference
Architecture documentation for the createRegistryServer() function in registry.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD a0458d14_2934_bf61_05f7_fa8e1ffcf6c9["createRegistryServer()"] 36b31cf1_05ba_97d7_e250_f336253a3080["registry.ts"] a0458d14_2934_bf61_05f7_fa8e1ffcf6c9 -->|defined in| 36b31cf1_05ba_97d7_e250_f336253a3080 style a0458d14_2934_bf61_05f7_fa8e1ffcf6c9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tests/src/utils/registry.ts lines 5–256
export async function createRegistryServer(
items: Array<{ name: string; type: string } & Record<string, unknown>>,
{
port = 4444,
path = "/r",
}: {
port?: number
path?: string
}
) {
const server = createServer((request, response) => {
const urlRaw = request.url?.split("?")[0]
// Handle registries.json endpoint (don't strip .json for this one).
if (urlRaw?.endsWith("/registries.json")) {
response.writeHead(200, { "Content-Type": "application/json" })
// Return empty registry array for tests - we want to test manual configuration.
response.end(JSON.stringify([]))
return
}
// For other endpoints, strip .json extension
const urlWithoutQuery = urlRaw?.replace(/\.json$/, "")
if (urlWithoutQuery?.includes("icons/index")) {
response.writeHead(200, { "Content-Type": "application/json" })
response.end(
JSON.stringify({
AlertCircle: {
lucide: "AlertCircle",
radix: "ExclamationTriangleIcon",
},
ArrowLeft: {
lucide: "ArrowLeft",
radix: "ArrowLeftIcon",
},
})
)
return
}
if (urlWithoutQuery?.includes("colors/neutral")) {
response.writeHead(200, { "Content-Type": "application/json" })
response.end(
JSON.stringify({
inlineColors: {
light: {
background: "white",
foreground: "neutral-950",
},
dark: {
background: "neutral-950",
foreground: "neutral-50",
},
},
cssVars: {
light: {
background: "0 0% 100%",
foreground: "0 0% 3.9%",
},
dark: {
background: "0 0% 3.9%",
foreground: "0 0% 98%",
},
},
cssVarsV4: {
light: {
background: "oklch(1 0 0)",
foreground: "oklch(0.145 0 0)",
},
dark: {
background: "oklch(0.145 0 0)",
foreground: "oklch(0.985 0 0)",
},
},
inlineColorsTemplate:
"@tailwind base;\n@tailwind components;\n@tailwind utilities;\n ",
cssVarsTemplate:
"@tailwind base;\n@tailwind components;\n@tailwind utilities;\n\n@layer ",
})
)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createRegistryServer() do?
createRegistryServer() is a function in the ui codebase, defined in packages/tests/src/utils/registry.ts.
Where is createRegistryServer() defined?
createRegistryServer() is defined in packages/tests/src/utils/registry.ts at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free