> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runmorph.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Get started with Morph in your React application in minutes.

<Accordion title="Try a live demo ✨">
  <Check>
    **Live Demo** <br />
    Select a connector below to experience our seamless authentication flow and see
    how easy it is to connect third-party services.
  </Check>

  <iframe src="https://atoms-playground.vercel.app?theme=light" width="100%" height="370px" className="block dark:hidden" />

  <iframe src="https://atoms-playground.vercel.app?theme=dark" width="100%" height="370px" className="hidden dark:block" />
</Accordion>

This guide will help you quickly integrate Morph into your React application.

## Installation

```bash theme={null}
yarn add @runmorph/atoms
```

## Basic Setup

<Steps>
  <Step title="Add Morph Provider">
    Wrap your application with the `Morph.Provider` component:

    <CodeGroup>
      ```tsx [Next.js] app/layout.tsx {1,7,9} theme={null}
      import { Morph } from "@runmorph/atoms";

      export default function RootLayout({ children }) {
        return (
          <html>
            <body>
              <Morph.Provider>
                {children}
              </Morph.Provider>
            </body>
          </html>
        );
      }
      ```

      ```tsx [Vite] src/main.tsx theme={null}
      import { Morph } from "@runmorph/atoms";

      ReactDOM.createRoot(document.getElementById('root')!).render(
        <React.StrictMode>
          <Morph.Provider>
            <App />
          </Morph.Provider>
        </React.StrictMode>
      );
      ```

      ```tsx [CRA] src/App.tsx theme={null}
      import { Morph } from "@runmorph/atoms";

      function App() {
        return (
          <Morph.Provider>
            <YourComponents />
          </Morph.Provider>
        );
      }
      ```

      ```tsx [Remix] app/root.tsx theme={null}
      import { Morph } from "@runmorph/atoms";

      export default function App() {
        return (
          <html>
            <body>
              <Morph.Provider>
                <Outlet />
              </Morph.Provider>
            </body>
          </html>
        );
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Configure environment variables">
    Add your Morph public key to your environment variables:

    <CodeGroup>
      ```env [Next.js] .env.local theme={null}
      NEXT_PUBLIC_MORPH_PUBLIC_KEY=pk_...
      ```

      ```env [Vite] .env.local theme={null}
      VITE_MORPH_PUBLIC_KEY=pk_...
      ```

      ```env [CRA] .env.local theme={null}
      REACT_APP_MORPH_PUBLIC_KEY=pk_...
      ```

      ```env [Remix] .env theme={null}
      MORPH_PUBLIC_KEY=pk_...
      ```
    </CodeGroup>

    The provider will automatically detect the key from your environment variables.
  </Step>

  <Step title="Add Connect button">
    Add the `Connect` component to handle authorization:

    <CodeGroup>
      ```tsx [Next.js] app/connections/page.tsx {1,5-10} theme={null}
      import { Connect } from "@runmorph/atoms";

      export default function ConnectionPage({ sessionToken }) {
        return (
          <Connect
            sessionToken={sessionToken}
            connectionCallbacks={{
              onError: (error) => alert(error.message)
            }}
          />
        );
      }
      ```

      ```tsx [Vite] src/components/Connection.tsx theme={null}
      import { Connect } from "@runmorph/atoms";

      export function ConnectionComponent({ sessionToken }) {
        return (
          <Connect
            sessionToken={sessionToken}
            connectionCallbacks={{
              onError: (error) => alert(error.message)
            }}
          />
        );
      }
      ```

      ```tsx [CRA] src/components/Connection.tsx theme={null}
      import { Connect } from "@runmorph/atoms";

      export function ConnectionComponent({ sessionToken }) {
        return (
          <Connect
            sessionToken={sessionToken}
            connectionCallbacks={{
              onError: (error) => alert(error.message)
            }}
          />
        );
      }
      ```

      ```tsx [Remix] app/routes/connections.tsx theme={null}
      import { Connect } from "@runmorph/atoms";

      export default function ConnectionRoute({ sessionToken }) {
        return (
          <Connect
            sessionToken={sessionToken}
            connectionCallbacks={{
              onError: (error) => alert(error.message)
            }}
          />
        );
      }
      ```
    </CodeGroup>
  </Step>
</Steps>

## Next Steps

* Implement [custom authorization flows](./connection-triggers-authorize) using triggers
* Add [connection settings](./connection-settings) for advanced configuration
* Add [internationalization](./connection-provider#internationalization) support
* Explore [security best practices](./security) for production deployments
