# Architecture URL: /docs/architecture How components, runtimes, and cloud services fit together. import { Sparkles, PanelsTopLeft, Database, Terminal } from "lucide-react"; assistant-ui is built on these main pillars: \[#assistant-ui-is-built-on-these-main-pillars]
Shadcn UI chat components with built-in state management State management layer connecting UI to LLMs and backend services Hosted service for thread persistence, history, and user management
1. Frontend components \[#1-frontend-components] Stylized and functional chat components built on top of Shadcn components that have context state management provided by the assistantUI runtime provider. These pre-built React components come with intelligent state management. [View our components](/docs/ui/thread) 2. Runtime \[#2-runtime] A React state management context for assistant chat. The runtime handles data conversions between the local state and calls to backends and LLMs. We offer different runtime solutions that work with various frameworks like Vercel AI SDK, LangGraph, LangChain, Helicone, local runtime, and an ExternalStore when you need full control of the frontend message state. [You can view the runtimes we support](/docs/runtimes/pick-a-runtime) 3. Assistant Cloud \[#3-assistant-cloud] A hosted service that enhances your assistant experience with comprehensive thread management and message history. Assistant Cloud stores complete message history, automatically persists threads, supports human-in-the-loop workflows, and integrates with common auth providers to seamlessly allow users to resume conversations at any point. [Cloud Docs](/docs/cloud/overview) There are three common ways to architect your assistant-ui application: \[#there-are-three-common-ways-to-architect-your-assistant-ui-application] 1. Direct Integration with External Providers \[#1-direct-integration-with-external-providers] 2. Using your own API endpoint \[#2-using-your-own-api-endpoint] 3. With Assistant Cloud \[#3-with-assistant-cloud] # CLI URL: /docs/cli Scaffold projects, add components, and manage updates from the command line. Use the `assistant-ui` CLI to quickly set up new projects and add components to existing ones. init \[#init] Use the `init` command to initialize configuration and dependencies for a new project. The `init` command installs dependencies, adds components, and configures your project for assistant-ui. ```bash npx assistant-ui@latest init ``` This will: * Detect if you have an existing project with a `package.json` * Use `shadcn add` to install the assistant-ui quick-start component * Add the default assistant-ui components (thread, composer, etc.) to your project * Configure TypeScript paths and imports **When to use:** * Adding assistant-ui to an **existing** Next.js project * First-time setup in a project with `package.json` **Options** ```bash Usage: assistant-ui init [options] initialize assistant-ui in a new or existing project Options: -c, --cwd the working directory. defaults to the current directory. -h, --help display help for command ``` create \[#create] Use the `create` command to scaffold a new Next.js project with assistant-ui pre-configured. ```bash npx assistant-ui@latest create [project-directory] ``` This command scaffolds a project from assistant-ui starter templates or examples. **Available Templates** | Template | Description | Command | | ------------- | ------------------------------------ | ---------------------------------------- | | `default` | Default template with Vercel AI SDK | `npx assistant-ui create` | | `minimal` | Bare-bones starting point | `npx assistant-ui create -t minimal` | | `cloud` | Cloud-backed persistence starter | `npx assistant-ui create -t cloud` | | `cloud-clerk` | Cloud-backed starter with Clerk auth | `npx assistant-ui create -t cloud-clerk` | | `langgraph` | LangGraph starter template | `npx assistant-ui create -t langgraph` | | `mcp` | MCP starter template | `npx assistant-ui create -t mcp` | **Available Examples** Use `--example` to create a project from one of the monorepo examples with full feature demonstrations: | Example | Description | Command | | -------------------------- | ----------------------------------------- | ------------------------------------------------------------ | | `with-ai-sdk-v6` | Vercel AI SDK v6 integration | `npx assistant-ui create my-app -e with-ai-sdk-v6` | | `with-artifacts` | HTML artifact rendering with live preview | `npx assistant-ui create my-app -e with-artifacts` | | `with-langgraph` | LangGraph agent with custom tools | `npx assistant-ui create my-app -e with-langgraph` | | `with-cloud` | Assistant Cloud persistence | `npx assistant-ui create my-app -e with-cloud` | | `with-ag-ui` | AG-UI protocol integration | `npx assistant-ui create my-app -e with-ag-ui` | | `with-assistant-transport` | Custom backend via Assistant Transport | `npx assistant-ui create my-app -e with-assistant-transport` | | `with-chain-of-thought` | Chain-of-thought with JS execution | `npx assistant-ui create my-app -e with-chain-of-thought` | | `with-external-store` | External message store | `npx assistant-ui create my-app -e with-external-store` | | `with-custom-thread-list` | Custom thread list UI | `npx assistant-ui create my-app -e with-custom-thread-list` | | `with-react-hook-form` | React Hook Form integration | `npx assistant-ui create my-app -e with-react-hook-form` | | `with-ffmpeg` | FFmpeg video processing tool | `npx assistant-ui create my-app -e with-ffmpeg` | | `with-elevenlabs-scribe` | ElevenLabs voice transcription | `npx assistant-ui create my-app -e with-elevenlabs-scribe` | | `with-parent-id-grouping` | Message part grouping | `npx assistant-ui create my-app -e with-parent-id-grouping` | | `with-react-router` | React Router v7 integration | `npx assistant-ui create my-app -e with-react-router` | | `with-tanstack` | TanStack Start integration | `npx assistant-ui create my-app -e with-tanstack` | **Examples** ```bash # Create with default template npx assistant-ui@latest create my-app # Create with cloud template npx assistant-ui@latest create my-app -t cloud # Create with cloud + clerk template npx assistant-ui@latest create my-app -t cloud-clerk # Create from an example npx assistant-ui@latest create my-app --example with-langgraph # Create with specific package manager npx assistant-ui@latest create my-app --use-pnpm # Skip package installation npx assistant-ui@latest create my-app --skip-install ``` **Options** ```bash Usage: assistant-ui create [project-directory] [options] create a new project Arguments: project-directory name of the project directory Options: -t, --template