@urbackend/react SDK provides everything you need to build secure, scalable React applications on top of urBackend. It handles the heavy lifting of session persistence, social logins, and routing out of the box.
Features
- Pre-built Auth UI: A beautiful, customizable
<UrAuth />component for login/signup (email/password & social). - Session Management: Automatically persists tokens to
localStorageand handles silent background refreshes. - Protected Routing: Simple
<ProtectedRoute>and<GuestRoute>wrappers to secure your pages. - Customizable UI: Includes
<UrUserButton />for a ready-to-use profile dropdown. - Powerful Hooks:
useUser,useAuth,useDb, anduseStorageto interact with your backend data natively.
Installation
Install the React SDK along with the core TypeScript SDK (which it uses under the hood):Setup (Create React App / Vite)
To get started, wrap your root application with the<UrProvider> and pass your project’s Publishable API Key.
src/main.tsx
Setup (Next.js App Router)
If you are using Next.js with the App Router, create a Client Component provider to wrap your application:src/components/Providers.tsx
src/app/layout.tsx
Next Steps
Now that your provider is set up, you can start building your authentication flow and accessing your data.Authentication UI
Add a login screen in one line of code.
Protect Routes
Secure your application pages.
