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

# Installation

> How to install and set up the Stytch B2B Frontend SDK in your application.

For a full walk-through of how to get up and running with a sign-up and login flow using Stytch, check out our [Quickstart Guide](https://stytch.com/docs/get-started/quickstart.md).

**1. Install Packages**

Install the React package:

```bash theme={null}
npm install @stytch/react
```

**2. Create the Stytch client**

Initialize the Stytch client, passing in your Project's `public_token` from the [Project Overview](https://stytch.com/dashboard) of the Stytch Dashboard.

```jsx theme={null}
import { createStytchB2BClient } from '@stytch/react/b2b';

const stytch = createStytchB2BClient(
  import.meta.env.STYTCH_PUBLIC_TOKEN, // or process.env.STYTCH_PUBLIC_TOKEN for non-Vite based projects
);
```

**3. Wrap your application in \<StytchB2BProvider>**

Next, pass the Stytch client to the `<StytchB2BProvider>` component at the root of your application, making it accessible to all child components.

```jsx theme={null}
import { StrictMode } from 'react';
import { createStytchB2BClient, StytchB2BProvider } from '@stytch/react/b2b';

const stytch = createStytchB2BClient(
  import.meta.env.STYTCH_PUBLIC_TOKEN, // or process.env.STYTCH_PUBLIC_TOKEN for non-Vite based projects
);

const root = ReactDOM.createRoot(document.getElementById("root")!);

root.render(
  <StrictMode>
    <StytchB2BProvider stytch={stytch}>
      <Router>
        <App />
      </Router>
    </StytchB2BProvider>
  </StrictMode>
);
```

**4. Add your login flow**

You have now initialized the Stytch client, and can add the `<StytchB2B>` [pre-built login component](https://stytch.com/docs/api-reference/b2b/frontend-sdks/react/prebuilt-ui/login/configuration.md) to get a robust, end-to-end login flow working with just a simple config.
