# Add Tambo to an existing app
URL: /getting-started/integrate

import LearnMore from "@/components/learn-more";

Tambo works with Next.js, Vite, Expo, and other React frameworks. The CLI detects your framework automatically.

## 1. Install

```bash
npx tambo full-send
```

This command:

* Sets up Tambo and gets you an API key
* Detects your framework and configures the build toolchain
* Installs pre-built chat components
* Shows how to wrap your app with `TamboProvider`

For manual setup, run `npx tambo init` instead (just the API key). If you don't have an account, <a href="https://console.tambo.co" className="font-medium underline underline-offset-4 decoration-muted-foreground hover:text-foreground hover:decoration-foreground transition-colors">sign up free</a>.

## 2. Add the provider

import { Tab, Tabs } from "fumadocs-ui/components/tabs";

<Tabs items={["Next.js", "Vite", "Expo"]}>
  <Tab value="Next.js">
    ```tsx title="src/app/layout.tsx"
    "use client";

    import { TamboProvider } from "@tambo-ai/react";

    export default function RootLayout({
      children,
    }: {
      children: React.ReactNode;
    }) {
      return (
        <TamboProvider
          apiKey={process.env.NEXT_PUBLIC_TAMBO_API_KEY!}
          userKey="user-1"
        >
          {children}
        </TamboProvider>
      );
    }
    ```

    <Callout type="info" title="API key setup">
      Create a `.env.local` file in your project root:

      ```bash
      NEXT_PUBLIC_TAMBO_API_KEY=your_api_key_here
      ```

      Don't commit this file to version control.
    </Callout>

    The `TamboProvider` only works in the browser. On Next.js, add `"use client"` at the top of the file.

    The `userKey` identifies the current user — threads are scoped per user. Replace `"user-1"` with a real user ID from your auth system. See [User Authentication](/concepts/user-authentication) for details.
  </Tab>

  <Tab value="Vite">
    ```tsx title="src/App.tsx"
    import { TamboProvider } from "@tambo-ai/react";

    export default function App() {
      return (
        <TamboProvider
          apiKey={import.meta.env.VITE_TAMBO_API_KEY!}
          userKey="user-1"
        >
          {/* your app content */}
        </TamboProvider>
      );
    }
    ```

    <Callout type="info" title="API key setup">
      Create a `.env.local` file in your project root:

      ```bash
      VITE_TAMBO_API_KEY=your_api_key_here
      ```

      Don't commit this file to version control.
    </Callout>
  </Tab>

  <Tab value="Expo">
    ```tsx title="App.tsx"
    import { TamboProvider } from "@tambo-ai/react";

    export default function App() {
      return (
        <TamboProvider
          apiKey={process.env.EXPO_PUBLIC_TAMBO_API_KEY!}
          userKey="user-1"
        >
          {/* your app content */}
        </TamboProvider>
      );
    }
    ```

    <Callout type="info" title="API key setup">
      Create a `.env` file in your project root:

      ```bash
      EXPO_PUBLIC_TAMBO_API_KEY=your_api_key_here
      ```

      Don't commit this file to version control.
    </Callout>

    For Expo, the registry components (DOM + Tailwind) won't work in React Native. Use `@tambo-ai/react` hooks directly to build your native UI. See the Expo demos for complete examples: [Activity Logger](https://github.com/tambo-ai/demo-mobile-log), [Music Companion](https://github.com/tambo-ai/music-expo-demo).
  </Tab>
</Tabs>

## 3. Add the chat component

The `full-send` command installed a `MessageThreadCollapsible` component. Add it to your main page:

<Tabs items={["Next.js", "Vite"]}>
  <Tab value="Next.js">
    ```tsx title="src/app/page.tsx"
    "use client";
    import { MessageThreadCollapsible } from "../source/components/message-thread-collapsible";

    export default function Home() {
      return (
        <main>
          <MessageThreadCollapsible />
        </main>
      );
    }
    ```
  </Tab>

  <Tab value="Vite">
    ```tsx title="src/App.tsx"
    import { MessageThreadCollapsible } from "./components/tambo/message-thread-collapsible";

    export default function App() {
      return (
        <main>
          <MessageThreadCollapsible />
        </main>
      );
    }
    ```
  </Tab>
</Tabs>

## 4. Run

```bash
npm run dev
```

<div className="flex justify-center my-6">
  <video controls className="rounded-lg border shadow-sm" width="600" height="400">
    <source src="/assets/docs/quickstart-demo.mp4" type="video/mp4" />

    Your browser does not support the video tag.
  </video>
</div>

## Next steps

<LearnMore title="Register components" description="Give the agent access to your own React components" href="/concepts/generative-interfaces/generative-components" />

<LearnMore title="Add tools" description="Let the agent call functions and fetch data" href="/concepts/tools" />

<LearnMore title="Connect MCP servers" description="Integrate external systems with Model Context Protocol" href="/concepts/model-context-protocol" />
