Skip to content

privy-io/create-react-app

Repository files navigation

Privy Auth create-react-app Starter

This is a minimal template for integrating Privy Auth into a new create-react-app project. Check out the deployed app here!

Setup:

  1. Clone this repository and open it in your terminal.
git clone https://github.com/privy-io/create-react-app.git
  1. Install the necessary dependencies (including Privy Auth) with npm.
npm i 
  1. Initialize your environment variables by copying the .env.example file to an .env file. Then, paste your Privy App ID from the console in .env.
# In your terminal, create .env from .env.example
cp .env.example .env

# Add your Privy App ID to .env
VITE_PRIVY_APP_ID=<your-privy-app-id>

Building locally:

In your project directory, run npm run dev. You can now visit http://localhost:5173 (or the port Vite chooses if 5173 is busy) to see your app and login with Privy!

Check out:

  • src/index.jsx for how to use the PrivyProvider and initialize it with your Privy App ID
  • src/App.jsx for how to use the usePrivy() hook, fields like authenticated and user, and methods like login and logout

Check out our docs for more guidance around using Privy in your app!

Releases

No releases published

Packages

No packages published

Contributors 8