Skip to content

The Open Standard for Generative UI

Documentation improvements (#74)

Rabi Shanker Guha2786203aab1c
diff --git a/docs/docs/concepts/002-chat-provider.md b/docs/docs/concepts/002-chat-provider.md
index c66251f1c..50d6fcb4d 100644
--- a/docs/docs/concepts/002-chat-provider.md
+++ b/docs/docs/concepts/002-chat-provider.md
@@ -1,4 +1,4 @@
-# Building Blocks
+# Chat Components
# Message
Message object represent a single message in a thread.
diff --git a/docs/docs/guides/001-generative-ui.mdx b/docs/docs/guides/001-generative-ui.mdx
new file mode 100644
index 000000000..495e979de
--- /dev/null
+++ b/docs/docs/guides/001-generative-ui.mdx
@@ -0,0 +1,325 @@
+# Generative UI
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+This guide demonstrates how to build a generative UI application using structured outputs and streaming. We'll build a simple recipe generator that shows how to:
+1. Define structured templates for LLM responses
+2. Stream responses to the UI
+3. Render dynamic components based on LLM output
+
+## Project Structure
+```
+src/
+├── app/
+│ ├── page.tsx # Main chat interface
+│ ├── api/
+│ │ └── chat/
+│ │ └── route.ts # API endpoint
+│ └── templates/
+│ └── recipe.tsx # Recipe template component
+└── types/
+ └── recipe.ts # Type definitions and schema
+```
+
+## Understanding Structured Outputs
+
+When building generative UI applications, we want the LLM to generate responses that our UI can understand and render consistently. Instead of dealing with raw text or markdown, we can define structured templates that the LLM must follow.
+
+### Example: Recipe Generator
+
+Let's build a recipe generator that produces structured recipe data. First, we'll define our schema:
+
+<Tabs groupId="backend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="types/recipe.ts"
+import { z } from "zod";
+
+export const RecipeTemplateSchema = z.object({
+ title: z.string(),
+ cuisine: z.string(),
+ cookingTime: z.number(),
+ ingredients: z.array(z.string()),
+ instructions: z.array(z.string())
+});
+
+export type RecipeTemplateProps = z.infer<typeof RecipeTemplateSchema>;
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="types/recipe.js"
+import { z } from "zod";
+
+export const RecipeTemplateSchema = z.object({
+ title: z.string(),
+ cuisine: z.string(),
+ cookingTime: z.number(),
+ ingredients: z.array(z.string()),
+ instructions: z.array(z.string())
+});
+```
+ </TabItem>
+</Tabs>
+
+## Building the UI Components
+
+We create React components that can render our structured data. Here's a simplified recipe component:
+
+<Tabs groupId="frontend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="app/templates/recipe.tsx"
+import { Card } from "@crayonai/react-ui";
+import { RecipeTemplateProps } from "@/types/recipe";
+
+export const RecipeTemplate: React.FC<RecipeTemplateProps> = ({
+ title,
+ cuisine,
+ cookingTime,
+ ingredients,
+ instructions,
+}) => {
+ return (
+ <Card>
+ <h2>{title}</h2>
+ <p>{cuisine} • {cookingTime} mins</p>
+
+ <h3>Ingredients</h3>
+ <ul>
+ {ingredients.map((ingredient, i) => (
+ <li key={i}>{ingredient}</li>
+ ))}
+ </ul>
+
+ <h3>Instructions</h3>
+ <ol>
+ {instructions.map((step, i) => (
+ <li key={i}>{step}</li>
+ ))}
+ </ol>
+ </Card>
+ );
+};
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="app/templates/recipe.jsx"
+import { Card } from "@crayonai/react-ui";
+
+export const RecipeTemplate = ({
+ title,
+ cuisine,
+ cookingTime,
+ ingredients,
+ instructions,
+}) => {
+ return (
+ <Card>
+ <h2>{title}</h2>
+ <p>{cuisine} • {cookingTime} mins</p>
+
+ <h3>Ingredients</h3>
+ <ul>
+ {ingredients.map((ingredient, i) => (
+ <li key={i}>{ingredient}</li>
+ ))}
+ </ul>
+
+ <h3>Instructions</h3>
+ <ol>
+ {instructions.map((step, i) => (
+ <li key={i}>{step}</li>
+ ))}
+ </ol>
+ </Card>
+ );
+};
+```
+ </TabItem>
+</Tabs>
+
+## Setting Up the Chat Interface
+
+The main chat interface uses `CrayonChat` which handles the streaming protocol and state management:
+
+<Tabs groupId="frontend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="app/page.tsx"
+"use client";
+
+import type { Message } from "@crayonai/react-core";
+import { CrayonChat } from "@crayonai/react-ui";
+import "@crayonai/react-ui/styles/index.css";
+import { RecipeTemplate } from "./templates/recipe";
+
+const processMessage = async ({
+ threadId,
+ messages,
+ abortController,
+}: {
+ threadId: string;
+ messages: Message[];
+ abortController: AbortController;
+}) => {
+ const response = await fetch("/api/chat", {
+ method: "POST",
+ body: JSON.stringify({ threadId, messages }),
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "text/event-stream",
+ },
+ signal: abortController.signal,
+ });
+ return response;
+};
+
+export default function Home() {
+ return (
+ <CrayonChat
+ processMessage={processMessage}
+ responseTemplates={[
+ {
+ name: "recipe",
+ Component: RecipeTemplate,
+ }
+ ]}
+ />
+ );
+}
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="app/page.jsx"
+"use client";
+
+import { CrayonChat } from "@crayonai/react-ui";
+import "@crayonai/react-ui/styles/index.css";
+import { RecipeTemplate } from "./templates/recipe";
+
+const processMessage = async ({ threadId, messages, abortController }) => {
+ const response = await fetch("/api/chat", {
+ method: "POST",
+ body: JSON.stringify({ threadId, messages }),
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "text/event-stream",
+ },
+ signal: abortController.signal,
+ });
+ return response;
+};
+
+export default function Home() {
+ return (
+ <CrayonChat
+ processMessage={processMessage}
+ responseTemplates={[
+ {
+ name: "recipe",
+ Component: RecipeTemplate,
+ }
+ ]}
+ />
+ );
+}
+```
+ </TabItem>
+</Tabs>
+
+## Handling API Responses
+
+The API route handles communication with the LLM and streams the responses:
+
+<Tabs groupId="backend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="app/api/chat/route.ts"
+import { NextRequest } from "next/server";
+import OpenAI from "openai";
+import {
+ fromOpenAICompletion,
+ toOpenAIMessages,
+ templatesToResponseFormat,
+} from "@crayonai/stream";
+import { RecipeTemplateSchema } from "@/types/recipe";
+
+export async function POST(req: NextRequest) {
+ const { messages } = await req.json();
+ const client = new OpenAI();
+
+ // Convert our template schema into OpenAI's response format
+ const responseFormat = templatesToResponseFormat({
+ schema: RecipeTemplateSchema,
+ name: "recipe",
+ description: "Use this template to generate a recipe"
+ });
+
+ // Stream the LLM response
+ const llmStream = await client.chat.completions.create({
+ model: "gpt-4",
+ messages: toOpenAIMessages(messages),
+ stream: true,
+ response_format: responseFormat,
+ });
+
+ // Convert OpenAI stream to our streaming protocol
+ const responseStream = fromOpenAICompletion(llmStream);
+
+ return new Response(responseStream, {
+ headers: {
+ "Content-Type": "text/event-stream",
+ "Cache-Control": "no-cache, no-transform",
+ Connection: "keep-alive",
+ },
+ });
+}
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="app/api/chat/route.js"
+import OpenAI from "openai";
+import {
+ fromOpenAICompletion,
+ toOpenAIMessages,
+ templatesToResponseFormat,
+} from "@crayonai/stream";
+import { RecipeTemplateSchema } from "@/types/recipe";
+
+export async function POST(req) {
+ const { messages } = await req.json();
+ const client = new OpenAI();
+
+ // Convert our template schema into OpenAI's response format
+ const responseFormat = templatesToResponseFormat({
+ schema: RecipeTemplateSchema,
+ name: "recipe",
+ description: "Use this template to generate a recipe"
+ });
+
+ // Stream the LLM response
+ const llmStream = await client.chat.completions.create({
+ model: "gpt-4",
+ messages: toOpenAIMessages(messages),
+ stream: true,
+ response_format: responseFormat,
+ });
+
+ // Convert OpenAI stream to our streaming protocol
+ const responseStream = fromOpenAICompletion(llmStream);
+
+ return new Response(responseStream, {
+ headers: {
+ "Content-Type": "text/event-stream",
+ "Cache-Control": "no-cache, no-transform",
+ Connection: "keep-alive",
+ },
+ });
+}
+```
+ </TabItem>
+</Tabs>
+
+## Key Benefits
+
+1. **Type Safety**: The schema ensures the LLM generates responses in a predictable format
+2. **Real-time Updates**: Streaming enables immediate feedback to users
+3. **Component-based**: Separate templates for different response types
+4. **Structured Data**: All responses follow a predefined schema for consistency
diff --git a/docs/docs/guides/002-default-text.mdx b/docs/docs/guides/002-default-text.mdx
new file mode 100644
index 000000000..bd40c699a
--- /dev/null
+++ b/docs/docs/guides/002-default-text.mdx
@@ -0,0 +1,109 @@
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
+
+# Default Renderer
+
+The default text renderer is a fundamental component that enables your Crayon Chat application to display formatted text responses from AI models. By implementing this renderer, you can:
+
+- Display AI responses with proper formatting using Markdown
+- Support rich text features like **bold**, *italic*, lists, and code blocks
+- Maintain consistent text styling across your chat interface
+- Handle basic text responses without needing complex custom templates
+
+This guide shows how to add a text renderer template to your Crayon Chat application. This assumes you have already set up your Next.js project following the [NextJS Quickstart Guide](/quickstart/002-nextjs.mdx).
+
+## Install Required Dependencies
+
+First, install the markdown renderer:
+
+<Tabs groupId="js-package-manager">
+ <TabItem value="npm" label="npm">
+```bash
+npm install react-markdown
+```
+ </TabItem>
+ <TabItem value="pnpm" label="pnpm">
+```bash
+pnpm add react-markdown
+```
+ </TabItem>
+ <TabItem value="yarn" label="yarn">
+```bash
+yarn add react-markdown
+```
+ </TabItem>
+</Tabs>
+
+## Create Text Template
+
+Create a new file for your text template:
+
+<Tabs groupId="frontend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="app/templates/text.tsx"
+import React from "react";
+import Markdown from "react-markdown";
+
+export const TextTemplate: React.FC<{ children: React.ReactNode }> = ({
+ children,
+}) => {
+ return <Markdown>{children as string}</Markdown>;
+};
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="app/templates/text.jsx"
+import React from "react";
+import Markdown from "react-markdown";
+
+export const TextTemplate = ({ children }) => {
+ return <Markdown>{children}</Markdown>;
+};
+```
+ </TabItem>
+</Tabs>
+
+## Update Your Page Component
+
+If you've followed the Quick Start guide, just add the text template to your existing templates array:
+
+<Tabs groupId="frontend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="app/page.tsx"
+import { TextTemplate } from "@/app/templates/text";
+
+const templates = [
+ {
+ name: "text",
+ Component: TextTemplate
+ }
+];
+
+// Use in your CrayonChat component
+<CrayonChat
+ processMessage={processMessage} // Required for NextJS setup
+ responseTemplates={templates}
+/>
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="app/page.jsx"
+import { TextTemplate } from "@/app/templates/text";
+
+const templates = [
+ {
+ name: "text",
+ Component: TextTemplate
+ }
+];
+
+// Use in your CrayonChat component
+<CrayonChat
+ processMessage={processMessage} // Required for NextJS setup
+ responseTemplates={templates}
+/>
+```
+ </TabItem>
+</Tabs>
+
+That's it! Your Crayon Chat will now use the text template for rendering text responses with Markdown support. The template will be automatically selected when the AI response specifies the "text" template type.
diff --git a/docs/docs/guides/004-connecting-thread-backend.md b/docs/docs/guides/004-connecting-thread-backend.md
index 28ea8c6d0..e476d629b 100644
--- a/docs/docs/guides/004-connecting-thread-backend.md
+++ b/docs/docs/guides/004-connecting-thread-backend.md
@@ -1,36 +1,153 @@
-# Connecting to the thread backend
+# Connecting to a Simple Thread Backend
-To use the thread runtime in production, you'll need to connect your
-thread backend to Crayon using the `ThreadListManager` and `ThreadManager` interfaces.
+This guide demonstrates how to implement a simple in-memory thread backend for Crayon Chat.
-## ThreadListManager
+## Backend Implementation
-Thread List Manager is used to handle the CRUDL operations on the thread list.
-```ts
-const threadListManager = useThreadListManager({...});
+First, create a simple in-memory store for your threads and messages:
+
+```typescript title="api/store.ts"
+interface Message {
+ id: string;
+ role: 'user' | 'assistant';
+ message: string;
+ createdAt: Date;
+}
+
+interface Thread {
+ threadId: number;
+ title: string;
+ createdAt: Date;
+ status: 'active' | 'deleted';
+}
+
+// In-memory storage
+const threads = new Map<number, Thread>();
+const messages = new Map<number, Message[]>();
+let nextThreadId = 1;
```
-## ThreadManager
+Create simple API routes for handling threads and messages:
-```ts
-const threadManager = useThreadManager({...});
+```typescript title="api/threads/route.ts"
+export async function GET() {
+ return Response.json({
+ threads: Array.from(threads.values())
+ .filter(t => t.status === 'active')
+ .sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime())
+ });
+}
+
+export async function POST(request: Request) {
+ const body = await request.json();
+ const thread: Thread = {
+ threadId: nextThreadId++,
+ title: body.title || 'New Chat',
+ createdAt: new Date(),
+ status: 'active'
+ };
+ threads.set(thread.threadId, thread);
+ messages.set(thread.threadId, []);
+ return Response.json(thread);
+}
```
-## Integration
+```typescript title="api/messages/route.ts"
+export async function GET(request: Request) {
+ const { searchParams } = new URL(request.url);
+ const threadId = parseInt(searchParams.get('threadId') || '');
+ return Response.json({
+ messages: messages.get(threadId) || []
+ });
+}
-```tsx
+export async function POST(request: Request) {
+ const { threadId, message } = await request.json();
+ const threadMessages = messages.get(threadId) || [];
+ const newMessage = {
+ id: crypto.randomUUID(),
+ role: 'user',
+ message,
+ createdAt: new Date()
+ };
+ threadMessages.push(newMessage);
+ messages.set(threadId, threadMessages);
+ return Response.json(newMessage);
+}
+```
+
+## Frontend Integration
+
+Connect your frontend using the `CrayonChat` component with custom thread managers:
+
+```tsx title="app/page.tsx"
import { CrayonChat } from "@crayonai/react-ui";
+import { useThreadListManager, useThreadManager } from "@crayonai/react-core";
+
+export default function Chat() {
+ const threadListManager = useThreadListManager({
+ fetchThreadList: async () => {
+ const response = await fetch('/api/threads');
+ const data = await response.json();
+ return data.threads;
+ },
+ createThread: async (firstMessage) => {
+ const response = await fetch('/api/threads', {
+ method: 'POST',
+ body: JSON.stringify({ title: firstMessage.message })
+ });
+ return response.json();
+ },
+ // Exercise for the reader
+ deleteThread: async () => {},
+ updateThread: async (t) => t,
+ onSwitchToNew: () => {},
+ onSelectThread: () => {}
+ });
+
+ const threadManager = useThreadManager({
+ threadId: threadListManager.selectedThreadId,
+ shouldResetThreadState: threadListManager.shouldResetThreadState,
+ loadThread: async () => {
+ const response = await fetch(`/api/messages?threadId=${threadListManager.selectedThreadId}`);
+ const data = await response.json();
+ return data.messages;
+ },
+ onProcessMessage: async ({ message, threadManager }) => {
+ // Send message to your backend
+ const response = await fetch('/api/messages', {
+ method: 'POST',
+ body: JSON.stringify({
+ threadId: threadListManager.selectedThreadId,
+ message: message.message
+ })
+ });
+ const newMessage = await response.json();
+ threadManager.appendMessages(newMessage);
+ return [];
+ }
+ });
-export default function App() {
return (
- <CrayonChat {...crayonChatProps}
+ <CrayonChat
threadListManager={threadListManager}
- threadManager={threadManager} />
+ threadManager={threadManager}
+ />
);
}
```
-:::note
-See the [ThreadManager](/docs/reference/js/react-core/type-aliases/ThreadManager) and [ThreadListManager](/docs/reference/js/react-core/type-aliases/ThreadListManager)
-for more information.
-:::
+The `CrayonChat` component with custom thread managers gives you:
+
+1. Full control over thread and message management
+2. Custom thread listing and creation logic
+3. Custom message processing and storage
+4. Built-in UI components and state synchronization
+
+This implementation provides a basic in-memory thread backend that supports:
+- Creating new threads
+- Listing existing threads
+- Sending and receiving messages
+- Persisting messages within a thread
+
+Note that this in-memory implementation is suitable for development and testing. For production use, you should implement proper database storage and error handling.
diff --git a/docs/docs/guides/006-generative-ui.md b/docs/docs/guides/006-generative-ui.md
deleted file mode 100644
index cc5b97681..000000000
--- a/docs/docs/guides/006-generative-ui.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# Generative UI
-
-# Using OpenAI Structured Outputs
-Lets say we want to create a Conversational agent for a personal finance that reads your bank statements and assists you in figuring out your spending trends.
-
-### Defining the user stories
-Defining all possible templates for responses isn't possible with a Generative application since
-the responses are generated by the LLM.
-
-A good way to start is by defining the user stories that you expect most of your users to go through
-and then define the response templates for each of the user stories. Over time, as more users use the application,
-you can collect more data and improve the response templates.
-
-For this example, we can define the following user stories:
-1. User wants to know how much they have spent in the last month.
-2. User wants to see how much they have spent on groceries in the current year.
-3. User wants to set a budget limit for their expenses.
-
-For fallback i.e. when the user asks a question that doesn't fit any of the user stories, we can use a generic markdown renderer.
-
-### Building templates for the user stories
-Now that we have defined the user stories, we can start building the templates for each of the user stories.
-1. `breakdown_expenses`: Breaks down the expenses for the user for a time period.
-2. `trends_expenses`: Shows the trends in the user's expenses for a time period.
-
-### Using Structured Outputs to let the LLM select the appropriate template
-Now that we have defined the templates, we can use Structured Outputs to let the LLM select the appropriate template.
-In the json_schema, we ask LLM to select the appropriate template based on the user's query and fallback
-to a generic text response if the user's query doesn't fit any of the user stories.
-
-```ts
-export const OutputJsonSchema = {
- type: "object",
- properties: {
- response: {
- type: "array",
- items: {
- oneOf: [
- {
- type: "object",
- description: "fallback when none of the templates are relevant",
- properties: {
- name: { const: "text" },
- text: {
- type: "string",
- description: "text message to be displayed to the user",
- },
- },
- required: ["text"],
- additionalProperties: false,
- },
- ...templates.map((template) => ({
- type: "object",
- description: template.description,
- properties: {
- name: { const: template.name },
- templateProps: template.parameters,
- },
- required: ["name", "parameters"],
- additionalProperties: false,
- })),
- ],
- },
- },
- },
-} as const;
-```
-
-### Building the UI
-By passing this `OutputJsonSchema` to the LLM and converting the LLM response to the [Streaming Protocol](/docs/concepts/data-format),
-we can build stream the response back to the UI.
-
-`<CrayonChat />` component handles the streaming protocol and state management rendering the response to the UI.
diff --git a/docs/docs/quickstart/002-nextjs.mdx b/docs/docs/quickstart/002-nextjs.mdx
index ad608b0af..f23c106cd 100644
--- a/docs/docs/quickstart/002-nextjs.mdx
+++ b/docs/docs/quickstart/002-nextjs.mdx
@@ -47,7 +47,9 @@ yarn add @crayonai/crayon-ui @crayonai/react-core @crayonai/stream
## Add the CrayonChat component to your app
-```tsx title="page.tsx"
+<Tabs groupId="frontend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="page.tsx"
"use client";
import type { Message } from "@crayonai/react-core";
@@ -79,45 +81,91 @@ export default function Home() {
return <CrayonChat processMessage={processMessage} />;
}
```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="page.jsx"
+"use client";
+
+import { CrayonChat } from "@crayonai/react-ui";
+import "@crayonai/react-ui/styles/index.css";
+
+const processMessage = async ({ threadId, messages, abortController }) => {
+ const response = await fetch("/api/chat", {
+ method: "POST",
+ body: JSON.stringify({ threadId, messages }),
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "text/event-stream",
+ },
+ signal: abortController.signal,
+ });
+ return response;
+};
+
+export default function Home() {
+ return <CrayonChat processMessage={processMessage} />;
+}
+```
+ </TabItem>
+</Tabs>
## Integrate LLM with your backend route
-```tsx title="api/chat/route.ts"
+<Tabs groupId="backend-lang">
+ <TabItem value="ts" label="TypeScript">
+```typescript title="api/chat/route.ts"
import { NextRequest, NextResponse } from "next/server";
import OpenAI from "openai";
import {
fromOpenAICompletion,
- TextResponseSchema,
+ templatesToResponseFormat,
toOpenAIMessages,
} from "@crayonai/stream";
import { Message } from "@crayonai/react-core";
-const TemplatesJsonSchema = {
- type: "object",
- properties: {
- response: {
- type: "array",
- items: {
- oneOf: [TextResponseSchema],
- },
- },
- },
-} as const;
-
export async function POST(req: NextRequest) {
const { messages } = (await req.json()) as { messages: Message[] };
const client = new OpenAI();
const llmStream = await client.chat.completions.create({
model: "gpt-4o",
- messages: toOpenAIMessages(messages),
+ messages: toOpenAIMessages(
+ messages
+ ) as OpenAI.Chat.ChatCompletionMessageParam[],
stream: true,
- response_format: {
- type: "json_schema",
- json_schema: {
- name: "json_schema",
- schema: TemplatesJsonSchema,
+ response_format: templatesToResponseFormat(),
+ });
+ const responseStream = fromOpenAICompletion(llmStream);
+ return new NextResponse(
+ responseStream as unknown as ReadableStream<Uint8Array>,
+ {
+ headers: {
+ "Content-Type": "text/event-stream",
+ "Cache-Control": "no-cache, no-transform",
+ Connection: "keep-alive",
},
- },
+ }
+ );
+}
+```
+ </TabItem>
+ <TabItem value="js" label="JavaScript">
+```javascript title="api/chat/route.js"
+import { NextResponse } from "next/server";
+import OpenAI from "openai";
+import {
+ fromOpenAICompletion,
+ templatesToResponseFormat,
+ toOpenAIMessages,
+} from "@crayonai/stream";
+
+export async function POST(req) {
+ const { messages } = await req.json();
+ const client = new OpenAI();
+ const llmStream = await client.chat.completions.create({
+ model: "gpt-4o",
+ messages: toOpenAIMessages(messages),
+ stream: true,
+ response_format: templatesToResponseFormat(),
});
const responseStream = fromOpenAICompletion(llmStream);
return new NextResponse(responseStream, {
@@ -129,6 +177,8 @@ export async function POST(req: NextRequest) {
});
}
```
+ </TabItem>
+</Tabs>
### Serve the NextJS app
diff --git a/js/packages/react-ui/package.json b/js/packages/react-ui/package.json
index 4f21f0e08..76475922c 100644
--- a/js/packages/react-ui/package.json
+++ b/js/packages/react-ui/package.json
@@ -38,7 +38,7 @@
"build:plugin": "tsc src/lib/tailwind/tailwind --outDir dist/lib/tailwind --module esnext --allowSyntheticDefaultImports --moduleResolution bundler --declaration",
"storybook": "storybook dev -p 6006",
"build:storybook": "storybook build -o ../../../docs/static/ui",
- "watch": "concurrently \"pnpm run build:ts -- --watch\" \"pnpm run build:scss -- --watch\"",
+ "watch": "concurrently \"pnpm run build:tsc --watch\" \"pnpm run build:scss --watch\"",
"lint:check": "eslint ./src",
"lint:fix": "eslint ./src --fix",
"format:fix": "prettier --write ./src",