- Install the Basic React SDK into an existing React project
- Connect to a Basic project and customize the schema
- Add sign in and sign out functionality
This library is for client-side React. For Next.js applications, see the @basictech/nextjs documentation.
Installation
Set up basic.config
Customize the config
Add your project ID to the
basic.config.ts file, and customize the schema in the file. You can copy your schema from the admin console (see Admin & project setup) and paste it into the file.Any changes you make to the schema in basic.config should eventually match the schema published for your project in the admin console. Local edits are for development until you deploy or sync the canonical schema.basic.config.ts
Adding Auth
Add the BasicProvider to main.tsx
Navigate to
src/main.tsx, add the BasicProvider to imports, and wrap your app in it.
Replace
YOUR_PROJECT_ID with your project ID from admin.basic.tech. New to Basic? Follow Admin & project setup.main.tsx
Add a login button to App.tsx
Now navigate to Let’s test it out! Clicking on the button should now redirect you to the Basic.id page where your users can login or create an account.
Once they’re done, they’ll be redirected back to your app and see their email displayed.
src/App.tsx and import signIn, isSignedIn, and user. Vite comes with some template code, but you can replace the contents with the following:App.tsx

