Available Packages
@insforge/react
For React + Vite single-page applications
@insforge/nextjs
For Next.js with SSR support
React + Vite
Pre-built authentication components for React + Vite applications using hosted auth pages.Installation
Setup
1. Environment Variables
.env
2. Create Client
src/lib/insforge.ts
3. Wrap App with Provider
src/main.tsx
Components
SignInButton
Button that redirects to hosted sign-in page.mode-"redirect"(default) or"modal"redirectUrl- Custom redirect URL after sign-inchildren- Custom button content
SignUpButton
Button that redirects to hosted sign-up page.mode-"redirect"(default) or"modal"redirectUrl- Custom redirect URL after sign-upchildren- Custom button content
UserButton
Dropdown button displaying user avatar and account options.- Shows user avatar or initials
- Dropdown with profile link and sign-out option
- Fully styled and accessible
SignedIn / SignedOut
Conditionally render content based on authentication state.Hooks
useAuth()
Access authentication state.isSignedIn(boolean) - Whether user is authenticatedisLoaded(boolean) - Whether auth state has been loaded
useUser()
Access current user data.user(object | null) - User object withid,email,profileisLoaded(boolean) - Whether user data has been loaded
Complete Example
src/App.tsx
Next.js
Pre-built authentication components for Next.js with SSR support.Installation
Setup
1. Environment Variables
.env.local
2. Create Client
lib/insforge.ts
3. Wrap App with Provider
app/layout.tsx
Components
The Next.js package provides the same components as the React package:SignInButtonSignUpButtonUserButtonSignedIn/SignedOut
app/page.tsx
Server Components
Access user data in Server Components:app/dashboard/page.tsx
Middleware
Protect routes with authentication middleware:middleware.ts
Customization
While the components use hosted auth pages by default, you can customize the authentication experience:Custom Redirect URLs
Custom Button Styles
Build Custom Auth Pages
For full control, use the SDK’s auth methods directly:CustomSignIn.tsx
Resources
TypeScript SDK
Full SDK documentation
Authentication Guide
Auth SDK methods reference
Database Operations
Work with user data
Example Apps
Browse example projects