Skip to main content

Picking a client

Privy provides 2 Typescript clients today: privy-node, and privy-browser. You can use one or both packages, depending on your use case. Here's a breakdown to help you choose:

  • privy-node only: This client must be used in your backend, and it's the fastest way to get data off your stack and onto Privy.

    tip

    privy-node uses your API secret to auth, so you would not want to use it client-side. Protect your secrets!

    You'd want to use privy-node if:

    • You're just getting started, and you want the easiest way to get set up with Privy.
    • You want the fastest way (via API secret) to set up reading/writing data as an admin role (see permissions to learn more about roles).
    • You want to programmatically set up fields and roles.
    • You want to send users emails directly (via the sendEmail API). Refer to the quickstart for privy-node and the Reference section for more info.
  • privy-browser only: This client can be used in your frontend, and enables your users (i.e. your dapp) to call Privy directly (no need for your backend)!

    You'd want to use privy-browser if:

    • You want user data to bypass your stack all together.
    • You want users to authenticate with Privy directly (see Privy's SIWE implementation).
    • Your app doesn't have a backend and you want to take on user data.

    Refer to the quickstart for privy-browser and the Reference section for more info.

  • Both privy-node and privy-browser: privy-node is used in the backend and privy-browser in the frontend.

    You'd want to use both if:

    • You want Privy to work off of your existing authentication method. In this case, you'll need your backend to issue access tokens to Privy on the frontend.
    • Both your frontend and backend need to access user data.
    • Your frontend needs access to user data, and you want to use privy-node-only features such as sending emails or programmatic setting of fields or roles
      .

More

  • Refer to the quickstarts for privy-node and privy-browser to understand each client library.
  • Then dive into the authentication guide to learn how to authenticate your users from your backend using privy-node.