@insforge/react 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,439 +1,426 @@
1
- # @insforge/react
2
-
3
- **Complete authentication solution for React applications.** Production-ready components with full business logic included.
4
-
5
- ## Why @insforge/react?
6
-
7
- ✅ **5-Minute Setup** - One provider + one line of router config = done
8
- ✅ **Built-in Auth UI** - Use deployed auth pages (like Next.js middleware)
9
- ✅ **Framework Agnostic** - Works with any React framework
10
- ✅ **Full TypeScript** - Complete type safety out of the box
11
-
12
- ---
13
-
14
- ## Quick Start
15
-
16
- Get authentication working in your React app in 5 minutes.
17
-
18
- ### 1. Install
19
-
20
- ```bash
21
- npm install @insforge/react
22
- # or
23
- yarn add @insforge/react
24
- # or
25
- pnpm add @insforge/react
26
- ```
27
-
28
- **Required Dependencies:** `bash npm install react@^19.0.0 react-dom@^19.0.0
29
- react-router-dom@^7.9.0 `
30
-
31
- #### Environment Variables
32
-
33
- ```bash .env
34
- VITE_INSFORGE_BASE_URL=https://your-project.insforge.app/
35
- ```
36
-
37
- ### 2. Setup Provider
38
-
39
- Wrap your app with `InsforgeProvider`:
40
-
41
- ```tsx
42
- // src/main.tsx (Vite) or src/index.tsx (CRA)
43
- import { StrictMode } from 'react';
44
- import { createRoot } from 'react-dom/client';
45
- import { InsforgeProvider } from '@insforge/react';
46
- import App from './App';
47
-
48
- createRoot(document.getElementById('root')!).render(
49
- <StrictMode>
50
- <InsforgeProvider baseUrl={import.meta.env.VITE_INSFORGE_BASE_URL} afterSignInUrl="/dashboard">
51
- <App />
52
- </InsforgeProvider>
53
- </StrictMode>
54
- );
55
- ```
56
-
57
- ### Step 3: Configure Router (Built-in Auth)
58
-
59
- **The fastest way** - Use deployed auth pages with Layout pattern:
60
-
61
- ```tsx src/App.tsx
62
- import { createBrowserRouter, RouterProvider } from 'react-router-dom';
63
- import { getInsforgeRoutes } from '@insforge/react/router';
64
- import Layout from './components/Layout';
65
- import Home from './pages/Home';
66
- import Dashboard from './pages/Dashboard';
67
-
68
- const router = createBrowserRouter([
69
- {
70
- path: '/',
71
- element: <Layout />,
72
- children: [
73
- { index: true, element: <Home /> },
74
-
75
- { path: 'dashboard', element: <Dashboard /> }
76
- ]
77
- },
78
-
79
- // Add built-in auth redirect routes (sign-in, sign-up, forgot-password, etc.)
80
- ...getInsforgeRoutes({
81
- baseUrl: import.meta.env.VITE_INSFORGE_BASE_URL,
82
- afterSignInUrl="/dashboard"
83
- builtInAuth: true // Redirects to deployed auth pages
84
- })
85
- ]);
86
-
87
- export default function App() {
88
- return <RouterProvider router={router} />;
89
- }
90
- ```
91
-
92
- **What this does:**
93
-
94
- - Visiting `/sign-in` → Redirects to `your-project.insforge.app/auth/sign-in`
95
- - Visiting `/sign-up` → Redirects to `your-project.insforge.app/auth/sign-up`
96
- - Visiting `/forgot-password` → Redirects to `your-project.insforge.app/auth/forgot-password`
97
- - After auth → Backend redirects with token in URL → SDK auto-detects and stores token
98
-
99
- ### 4. Use Hooks & Components
100
-
101
- ```tsx
102
- // src/pages/Home.tsx
103
- import { SignedIn, SignedOut, UserButton, useAuth, useUser } from '@insforge/react';
104
-
105
- export default function Home() {
106
- const { isSignedIn } = useAuth();
107
- const { user } = useUser();
108
-
109
- return (
110
- <div>
111
- <nav>
112
- <SignedOut>
113
- <a href="/sign-in">Sign In</a>
114
- </SignedOut>
115
-
116
- <SignedIn>
117
- <UserButton afterSignOutUrl="/" />
118
- <h1>Welcome, {user?.email}!</h1>
119
- </SignedIn>
120
- </nav>
121
-
122
- <h1>Welcome to My App!</h1>
123
- </div>
124
- );
125
- }
126
- ```
127
-
128
- **That's it!** 🎉 You now have production-ready authentication.
129
-
130
- ---
131
-
132
- ## Router Configuration Options
133
-
134
- ### Built-in Auth (Recommended)
135
-
136
- Uses your deployed Insforge auth pages (includes all flows):
137
-
138
- ```tsx
139
- ...getInsforgeRoutes({
140
- baseUrl: 'https://your-project.insforge.app',
141
- builtInAuth: true, // Default
142
- paths: {
143
- signIn: '/sign-in', // Sign in page
144
- signUp: '/sign-up', // Sign up page
145
- forgotPassword: '/forgot-password', // Request password reset
146
- }
147
- })
148
- ```
149
-
150
- ### Custom UI Components
151
-
152
- Use package components with your own styling:
153
-
154
- ```tsx
155
- import { SignIn, SignUp, ForgotPassword, ResetPassword, VerifyEmail } from '@insforge/react';
156
-
157
- const router = createBrowserRouter([
158
- { path: '/', element: <Home /> },
159
-
160
- // Use package components for complete auth flows
161
- { path: '/sign-in', element: <SignIn afterSignInUrl="/dashboard" /> },
162
- { path: '/sign-up', element: <SignUp afterSignUpUrl="/dashboard" /> },
163
- { path: '/forgot-password', element: <ForgotPassword /> },
164
- ]);
165
- ```
166
-
167
- ### Fully Custom UI
168
-
169
- Build your own auth pages from scratch:
170
-
171
- ```tsx
172
- import { useAuth } from '@insforge/react';
173
-
174
- function CustomSignIn() {
175
- const { signIn } = useAuth();
176
-
177
- const handleSubmit = async (e) => {
178
- e.preventDefault();
179
- await signIn(email, password);
180
- navigate('/dashboard');
181
- };
182
-
183
- return <form onSubmit={handleSubmit}>...</form>;
184
- }
185
- ```
186
-
187
- ---
188
-
189
- ## Core Features
190
-
191
- ### Components
192
-
193
- **Pre-built with Business Logic:**
194
-
195
- - `<SignIn />` - Complete sign-in with email/password & OAuth
196
- - `<SignUp />` - Registration with password validation & email verification
197
- - `<ForgotPassword />` - Request password reset with email validation
198
- - `<ResetPassword />` - Reset password with token validation
199
- - `<VerifyEmail />` - Verify email with automatic token handling
200
- - `<UserButton />` - User dropdown with sign-out
201
- - `<Protect />` - Route protection wrapper
202
- - `<SignedIn>` / `<SignedOut>` - Conditional rendering
203
-
204
- **Form Components (Pure UI):**
205
-
206
- - `<SignInForm />` - Sign-in UI without logic
207
- - `<SignUpForm />` - Sign-up UI without logic
208
- - `<ForgotPasswordForm />` - Password reset request UI
209
- - `<ResetPasswordForm />` - Password reset with token UI
210
- - `<VerifyEmailStatus />` - Email verification status UI
211
-
212
- **Atomic Components (14 total):**
213
-
214
- - `<AuthContainer />`, `<AuthHeader />`, `<AuthFormField />`, `<AuthPasswordField />`, `<AuthEmailVerificationStep />`, etc.
215
-
216
- ### Hooks
217
-
218
- ```tsx
219
- const { signIn, signUp, signOut, isSignedIn, isLoaded } = useAuth();
220
- const { user, updateUser, isLoaded } = useUser();
221
- const { oauthProviders, authConfig, isLoaded } = usePublicAuthConfig();
222
- ```
223
-
224
- ---
225
-
226
- ## Customization
227
-
228
- ### Text Customization
229
-
230
- All components support full text customization:
231
-
232
- ```tsx
233
- <SignIn
234
- title="Welcome Back!"
235
- subtitle="We're happy to see you again"
236
- emailLabel="Your Email Address"
237
- emailPlaceholder="you@company.com"
238
- passwordLabel="Your Password"
239
- submitButtonText="Login Now"
240
- loadingButtonText="Signing you in..."
241
- signUpText="New to our platform?"
242
- signUpLinkText="Create an account"
243
- dividerText="or continue with"
244
- />
245
-
246
- <ForgotPassword
247
- title="Reset Your Password"
248
- subtitle="Enter your email to receive a reset code"
249
- emailLabel="Email Address"
250
- submitButtonText="Send Reset Code"
251
- backToSignInText="Remember your password?"
252
- successTitle="Check Your Email"
253
- successMessage="We've sent a reset code to your inbox"
254
- />
255
- ```
256
-
257
- ---
258
-
259
- ## Advanced Usage
260
-
261
- ### Complete Component with Custom Logic
262
-
263
- ```tsx
264
- import { SignInForm, useAuth } from '@insforge/react';
265
- import { useState } from 'react';
266
-
267
- function CustomSignIn() {
268
- const { signIn } = useAuth();
269
- const [email, setEmail] = useState('');
270
- const [password, setPassword] = useState('');
271
- const [error, setError] = useState('');
272
- const [loading, setLoading] = useState(false);
273
-
274
- const handleSubmit = async (e: React.FormEvent) => {
275
- e.preventDefault();
276
- setLoading(true);
277
- setError('');
278
-
279
- try {
280
- await signIn(email, password);
281
- // Custom success logic
282
- } catch (err) {
283
- setError(err.message);
284
- } finally {
285
- setLoading(false);
286
- }
287
- };
288
-
289
- return (
290
- <SignInForm
291
- email={email}
292
- password={password}
293
- onEmailChange={setEmail}
294
- onPasswordChange={setPassword}
295
- onSubmit={handleSubmit}
296
- error={error}
297
- loading={loading}
298
- availableProviders={['google', 'github']}
299
- onOAuthClick={(provider) => {
300
- console.log(provider);
301
- }}
302
- />
303
- );
304
- }
305
- ```
306
-
307
- ### Build from Atomic Components
308
-
309
- ```tsx
310
- import {
311
- AuthContainer,
312
- AuthHeader,
313
- AuthFormField,
314
- AuthPasswordField,
315
- AuthSubmitButton,
316
- AuthErrorBanner,
317
- AuthDivider,
318
- AuthOAuthProviders,
319
- AuthLink,
320
- } from '@insforge/react';
321
-
322
- function CompletelyCustomAuth() {
323
- return (
324
- <AuthContainer>
325
- <AuthHeader title="Welcome to MyApp" subtitle="Sign in to continue" />
326
-
327
- <AuthErrorBanner error={error} />
328
-
329
- <form onSubmit={handleSubmit}>
330
- <AuthFormField
331
- id="email"
332
- type="email"
333
- label="Email"
334
- value={email}
335
- onChange={(e) => setEmail(e.target.value)}
336
- />
337
-
338
- <AuthPasswordField
339
- id="password"
340
- label="Password"
341
- value={password}
342
- onChange={(e) => setPassword(e.target.value)}
343
- authConfig={config}
344
- showStrengthIndicator
345
- />
346
-
347
- <AuthSubmitButton isLoading={loading}>Sign In</AuthSubmitButton>
348
- </form>
349
-
350
- <AuthDivider text="or" />
351
-
352
- <AuthOAuthProviders
353
- providers={['google', 'github', 'discord']}
354
- onClick={handleOAuth}
355
- loading={oauthLoading}
356
- />
357
-
358
- <AuthLink text="Don't have an account?" linkText="Sign up" href="/sign-up" />
359
- </AuthContainer>
360
- );
361
- }
362
- ```
363
-
364
- ### Route Protection
365
-
366
- ```tsx
367
- import { Protect } from '@insforge/react';
368
-
369
- function Dashboard() {
370
- return (
371
- <div>
372
- <h1>Dashboard</h1>
373
-
374
- {/* Simple protection */}
375
- <Protect redirectTo="/sign-in">
376
- <UserContent />
377
- </Protect>
378
-
379
- {/* Role-based protection */}
380
- <Protect redirectTo="/unauthorized" condition={(user) => user.role === 'admin'}>
381
- <AdminPanel />
382
- </Protect>
383
- </div>
384
- );
385
- }
386
- ```
387
-
388
- ---
389
-
390
- ## OAuth Providers
391
-
392
- Built-in support for 10+ OAuth providers:
393
-
394
- - Google
395
- - GitHub
396
- - Discord
397
- - Apple
398
- - Microsoft
399
- - Facebook
400
- - LinkedIn
401
- - Instagram
402
- - TikTok
403
- - Spotify
404
- - X (Twitter)
405
-
406
- Providers are auto-detected from your backend configuration.
407
-
408
- ---
409
-
410
- ## Available Atomic Components
411
-
412
- Low-level building blocks for complete customization:
413
-
414
- - `<AuthBranding />` - Insforge branding footer
415
- - `<AuthContainer />` - Main container wrapper
416
- - `<AuthHeader />` - Title and subtitle display
417
- - `<AuthErrorBanner />` - Error message display
418
- - `<AuthFormField />` - Standard input field
419
- - `<AuthPasswordField />` - Password input with features
420
- - `<AuthPasswordStrengthIndicator />` - Password checklist
421
- - `<AuthSubmitButton />` - Submit button with states
422
- - `<AuthLink />` - Call-to-action link
423
- - `<AuthDivider />` - Visual separator
424
- - `<AuthOAuthButton />` - Single OAuth provider button
425
- - `<AuthOAuthProviders />` - Smart OAuth grid
426
- - `<AuthVerificationCodeInput />` - 6-digit OTP input
427
- - `<AuthEmailVerificationStep />` - Email verification step with countdown and resend
428
-
429
- ---
430
-
431
- ## Support
432
-
433
- - **Documentation**: https://docs.insforge.dev
434
- - **GitHub Issues**: https://github.com/InsForge/InsForge/issues
435
- - **Discord Community**: https://discord.com/invite/DvBtaEc9Jz
436
-
437
- ## License
438
-
439
- MIT © Insforge
1
+ # @insforge/react
2
+
3
+ **Framework-agnostic authentication solution for React applications.** Production-ready components with full business logic included.
4
+
5
+ ## Why @insforge/react?
6
+
7
+ ✅ **Framework Agnostic** - Works with any React setup (Vite, CRA, or no bundler)
8
+ ✅ **Zero Router Dependencies** - Use with any routing solution or none at all
9
+ ✅ **Production Ready** - Complete auth flows with business logic included
10
+ ✅ **Full TypeScript** - Complete type safety out of the box
11
+
12
+ ---
13
+
14
+ ## Quick Start
15
+
16
+ Get authentication working in your React app in 5 minutes.
17
+
18
+ ### 1. Install
19
+
20
+ ```bash
21
+ npm install @insforge/react
22
+ # or
23
+ yarn add @insforge/react
24
+ # or
25
+ pnpm add @insforge/react
26
+ ```
27
+
28
+ **Required Peer Dependencies:**
29
+ ```bash
30
+ npm install react@^19.0.0 react-dom@^19.0.0
31
+ ```
32
+
33
+
34
+ #### Environment Variables
35
+
36
+ ```bash
37
+ # .env
38
+ VITE_INSFORGE_BASE_URL=https://your-project.insforge.app/
39
+ ```
40
+
41
+ ### 2. Setup Provider
42
+
43
+ Wrap your app with `InsforgeProvider`:
44
+
45
+ ```tsx
46
+ // src/main.tsx (Vite) or src/index.tsx (CRA)
47
+ import { StrictMode } from 'react';
48
+ import { createRoot } from 'react-dom/client';
49
+ import { InsforgeProvider } from '@insforge/react';
50
+ import App from './App';
51
+
52
+ createRoot(document.getElementById('root')!).render(
53
+ <StrictMode>
54
+ <InsforgeProvider baseUrl={import.meta.env.VITE_INSFORGE_BASE_URL} afterSignInUrl="/dashboard">
55
+ <App />
56
+ </InsforgeProvider>
57
+ </StrictMode>
58
+ );
59
+ ```
60
+
61
+ ### 3. Use Components & Hooks
62
+
63
+ Now you can use authentication components and hooks anywhere in your app:
64
+
65
+ ```tsx
66
+ // src/App.tsx
67
+ import { SignIn, SignedIn, SignedOut, UserButton, useAuth } from '@insforge/react';
68
+
69
+ export default function App() {
70
+ const { isSignedIn, isLoaded } = useAuth();
71
+
72
+ if (!isLoaded) {
73
+ return <div>Loading...</div>;
74
+ }
75
+
76
+ return (
77
+ <div>
78
+ <SignedOut>
79
+ <SignIn />
80
+ </SignedOut>
81
+
82
+ <SignedIn>
83
+ <nav>
84
+ <UserButton afterSignOutUrl="/" />
85
+ </nav>
86
+ <h1>Welcome to your dashboard!</h1>
87
+ </SignedIn>
88
+ </div>
89
+ );
90
+ }
91
+ ```
92
+
93
+ **That's it!** 🎉 You now have production-ready authentication.
94
+
95
+ ---
96
+
97
+ ## Usage Patterns
98
+
99
+ ### Option 1: Pre-built Components (Fastest)
100
+
101
+ Use complete auth flows with built-in UI and logic:
102
+
103
+ ```tsx
104
+ import { SignIn, SignUp, ForgotPassword, ResetPassword } from '@insforge/react';
105
+
106
+ // In your app
107
+ <SignIn /> // Complete sign-in flow
108
+ <SignUp /> // Complete sign-up flow with email verification
109
+ <ForgotPassword /> // Password reset request + verification
110
+ <ResetPassword /> // Reset password with token (from URL params)
111
+ ```
112
+
113
+ ### Option 2: Form Components (UI Only)
114
+
115
+ Use UI components and add your own logic:
116
+
117
+ ```tsx
118
+ import { SignInForm, useAuth } from '@insforge/react';
119
+ import { useState } from 'react';
120
+
121
+ function CustomSignIn() {
122
+ const { signIn } = useAuth();
123
+ const [email, setEmail] = useState('');
124
+ const [password, setPassword] = useState('');
125
+ const [error, setError] = useState('');
126
+ const [loading, setLoading] = useState(false);
127
+
128
+ const handleSubmit = async (e) => {
129
+ e.preventDefault();
130
+ setLoading(true);
131
+ const result = await signIn(email, password);
132
+ if ('error' in result) {
133
+ setError(result.error);
134
+ }
135
+ setLoading(false);
136
+ };
137
+
138
+ return (
139
+ <SignInForm
140
+ email={email}
141
+ password={password}
142
+ onEmailChange={setEmail}
143
+ onPasswordChange={setPassword}
144
+ onSubmit={handleSubmit}
145
+ error={error}
146
+ loading={loading}
147
+ />
148
+ );
149
+ }
150
+ ```
151
+
152
+ ### Option 3: Hooks Only (Headless)
153
+
154
+ Build completely custom UI using authentication hooks:
155
+
156
+ ```tsx
157
+ import { useAuth } from '@insforge/react';
158
+
159
+ function CustomAuthForm() {
160
+ const { signIn, signUp, isLoaded } = useAuth();
161
+
162
+ const handleLogin = async (email: string, password: string) => {
163
+ const result = await signIn(email, password);
164
+ if ('error' in result) {
165
+ console.error(result.error);
166
+ } else {
167
+ console.log('Signed in!');
168
+ }
169
+ };
170
+
171
+ return <form>...your custom UI...</form>;
172
+ }
173
+ ```
174
+
175
+ ---
176
+
177
+ ## Core Features
178
+
179
+ ### Components
180
+
181
+ **Pre-built with Business Logic:**
182
+
183
+ - `<SignIn />` - Complete sign-in with email/password & OAuth
184
+ - `<SignUp />` - Registration with password validation & email verification
185
+ - `<ForgotPassword />` - Request password reset with email validation
186
+ - `<ResetPassword />` - Reset password with token validation
187
+ - `<VerifyEmail />` - Verify email with automatic token handling
188
+ - `<UserButton />` - User dropdown with sign-out
189
+ - `<Protect />` - Route protection wrapper
190
+ - `<SignedIn>` / `<SignedOut>` - Conditional rendering
191
+
192
+ **Form Components (Pure UI):**
193
+
194
+ - `<SignInForm />` - Sign-in UI without logic
195
+ - `<SignUpForm />` - Sign-up UI without logic
196
+ - `<ForgotPasswordForm />` - Password reset request UI
197
+ - `<ResetPasswordForm />` - Password reset with token UI
198
+ - `<VerifyEmailStatus />` - Email verification status UI
199
+
200
+ **Atomic Components (14 total):**
201
+
202
+ - `<AuthContainer />`, `<AuthHeader />`, `<AuthFormField />`, `<AuthPasswordField />`, `<AuthEmailVerificationStep />`, etc.
203
+
204
+ ### Hooks
205
+
206
+ ```tsx
207
+ const { signIn, signUp, signOut, isSignedIn, isLoaded } = useAuth();
208
+ const { user, updateUser, isLoaded } = useUser();
209
+ const { oauthProviders, authConfig, isLoaded } = usePublicAuthConfig();
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Customization
215
+
216
+ ### Text Customization
217
+
218
+ All components support full text customization:
219
+
220
+ ```tsx
221
+ <SignIn
222
+ title="Welcome Back!"
223
+ subtitle="We're happy to see you again"
224
+ emailLabel="Your Email Address"
225
+ emailPlaceholder="you@company.com"
226
+ passwordLabel="Your Password"
227
+ submitButtonText="Login Now"
228
+ loadingButtonText="Signing you in..."
229
+ signUpText="New to our platform?"
230
+ signUpLinkText="Create an account"
231
+ dividerText="or continue with"
232
+ />
233
+
234
+ <ForgotPassword
235
+ title="Reset Your Password"
236
+ subtitle="Enter your email to receive a reset code"
237
+ emailLabel="Email Address"
238
+ submitButtonText="Send Reset Code"
239
+ backToSignInText="Remember your password?"
240
+ successTitle="Check Your Email"
241
+ successMessage="We've sent a reset code to your inbox"
242
+ />
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Advanced Usage
248
+
249
+ ### Conditional Rendering
250
+
251
+ Control what users see based on auth state:
252
+
253
+ ```tsx
254
+ import { SignedIn, SignedOut, Protect } from '@insforge/react';
255
+
256
+ function App() {
257
+ return (
258
+ <>
259
+ <SignedOut>
260
+ <SignIn />
261
+ </SignedOut>
262
+
263
+ <SignedIn>
264
+ <Dashboard />
265
+ </SignedIn>
266
+
267
+ {/* Or use Protect for specific sections */}
268
+ <Protect redirectTo="/sign-in">
269
+ <ProtectedContent />
270
+ </Protect>
271
+ </>
272
+ );
273
+ }
274
+ ```
275
+
276
+ ### Build from Atomic Components
277
+
278
+ ```tsx
279
+ import {
280
+ AuthContainer,
281
+ AuthHeader,
282
+ AuthFormField,
283
+ AuthPasswordField,
284
+ AuthSubmitButton,
285
+ AuthErrorBanner,
286
+ AuthDivider,
287
+ AuthOAuthProviders,
288
+ AuthLink,
289
+ } from '@insforge/react';
290
+
291
+ function CompletelyCustomAuth() {
292
+ return (
293
+ <AuthContainer>
294
+ <AuthHeader title="Welcome to MyApp" subtitle="Sign in to continue" />
295
+
296
+ <AuthErrorBanner error={error} />
297
+
298
+ <form onSubmit={handleSubmit}>
299
+ <AuthFormField
300
+ id="email"
301
+ type="email"
302
+ label="Email"
303
+ value={email}
304
+ onChange={(e) => setEmail(e.target.value)}
305
+ />
306
+
307
+ <AuthPasswordField
308
+ id="password"
309
+ label="Password"
310
+ value={password}
311
+ onChange={(e) => setPassword(e.target.value)}
312
+ authConfig={config}
313
+ showStrengthIndicator
314
+ />
315
+
316
+ <AuthSubmitButton isLoading={loading}>Sign In</AuthSubmitButton>
317
+ </form>
318
+
319
+ <AuthDivider text="or" />
320
+
321
+ <AuthOAuthProviders
322
+ providers={['google', 'github', 'discord']}
323
+ onClick={handleOAuth}
324
+ loading={oauthLoading}
325
+ />
326
+
327
+ <AuthLink text="Don't have an account?" linkText="Sign up" href="/sign-up" />
328
+ </AuthContainer>
329
+ );
330
+ }
331
+ ```
332
+
333
+ ### Content Protection
334
+
335
+ Protect specific content or sections:
336
+
337
+ ```tsx
338
+ import { Protect } from '@insforge/react';
339
+
340
+ function Dashboard() {
341
+ return (
342
+ <div>
343
+ <h1>Dashboard</h1>
344
+
345
+ {/* Simple protection - shows nothing if not signed in */}
346
+ <Protect>
347
+ <UserContent />
348
+ </Protect>
349
+
350
+ {/* Custom condition - e.g., role-based */}
351
+ <Protect condition={(user) => user.email.endsWith('@admin.com')}>
352
+ <AdminPanel />
353
+ </Protect>
354
+ </div>
355
+ );
356
+ }
357
+ ```
358
+
359
+ > **Note:** `<Protect>` is for conditional rendering only. For route-level protection, use your router's authentication guards with `useAuth()` hook.
360
+
361
+ ---
362
+
363
+ ## OAuth Providers
364
+
365
+ Built-in support for 10+ OAuth providers:
366
+
367
+ - Google
368
+ - GitHub
369
+ - Discord
370
+ - Apple
371
+ - Microsoft
372
+ - Facebook
373
+ - LinkedIn
374
+ - Instagram
375
+ - TikTok
376
+ - Spotify
377
+ - X (Twitter)
378
+
379
+ Providers are auto-detected from your backend configuration.
380
+
381
+ ---
382
+
383
+ ## Available Atomic Components
384
+
385
+ Low-level building blocks for complete customization:
386
+
387
+ - `<AuthBranding />` - Insforge branding footer
388
+ - `<AuthContainer />` - Main container wrapper
389
+ - `<AuthHeader />` - Title and subtitle display
390
+ - `<AuthErrorBanner />` - Error message display
391
+ - `<AuthFormField />` - Standard input field
392
+ - `<AuthPasswordField />` - Password input with features
393
+ - `<AuthPasswordStrengthIndicator />` - Password checklist
394
+ - `<AuthSubmitButton />` - Submit button with states
395
+ - `<AuthLink />` - Call-to-action link
396
+ - `<AuthDivider />` - Visual separator
397
+ - `<AuthOAuthButton />` - Single OAuth provider button
398
+ - `<AuthOAuthProviders />` - Smart OAuth grid
399
+ - `<AuthVerificationCodeInput />` - 6-digit OTP input
400
+ - `<AuthEmailVerificationStep />` - Email verification step with countdown and resend
401
+
402
+ ---
403
+
404
+ ## Framework Integration
405
+
406
+ ### Next.js
407
+
408
+ For Next.js App Router with full SSR support:
409
+
410
+ ```bash
411
+ npm install @insforge/nextjs
412
+ ```
413
+
414
+ See [@insforge/nextjs documentation](https://github.com/InsForge/InsForge/tree/main/packages/nextjs)
415
+
416
+ ---
417
+
418
+ ## Support
419
+
420
+ - **Documentation**: https://docs.insforge.dev
421
+ - **GitHub Issues**: https://github.com/InsForge/InsForge/issues
422
+ - **Discord Community**: https://discord.com/invite/DvBtaEc9Jz
423
+
424
+ ## License
425
+
426
+ MIT © Insforge