create-stackforge 0.1.1 → 0.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-stackforge",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The universal full-stack boilerplate generator. Scaffold production-ready apps with Next.js/Vite, 8 UI libraries, 6 databases, 4 ORMs, 3 auth providers, REST/tRPC/GraphQL, and AI agent integrations.",
5
5
  "license": "MIT",
6
6
  "author": "Lakshay Kapoor",
@@ -0,0 +1,7 @@
1
+ import { createAuthClient } from 'better-auth/react';
2
+
3
+ export const authClient = createAuthClient({
4
+ baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || 'http://localhost:3000'
5
+ });
6
+
7
+ export const { signIn, signUp, signOut, useSession } = authClient;
@@ -0,0 +1,7 @@
1
+ import { createAuthClient } from 'better-auth/react';
2
+
3
+ export const authClient = createAuthClient({
4
+ baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || 'http://localhost:3000'
5
+ });
6
+
7
+ export const { signIn, signUp, signOut, useSession } = authClient;
@@ -0,0 +1,12 @@
1
+ import { auth } from '../../../auth/auth';
2
+ import { headers } from 'next/headers';
3
+
4
+ export default async function ProtectedPage() {
5
+ const session = await auth.api.getSession({ headers: headers() });
6
+ return (
7
+ <div>
8
+ <h1>Protected</h1>
9
+ <pre>{JSON.stringify(session, null, 2)}</pre>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,12 @@
1
+ import { auth } from '../../../auth/auth';
2
+ import { headers } from 'next/headers';
3
+
4
+ export default async function ProtectedPage() {
5
+ const session = await auth.api.getSession({ headers: headers() });
6
+ return (
7
+ <div>
8
+ <h1>Protected</h1>
9
+ <pre>{JSON.stringify(session, null, 2)}</pre>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,4 @@
1
+ import { auth } from '../../../../auth/auth';
2
+ import { toNextJsHandler } from 'better-auth/next-js';
3
+
4
+ export const { GET, POST } = toNextJsHandler(auth);
@@ -0,0 +1,4 @@
1
+ import { auth } from '../../../../auth/auth';
2
+ import { toNextJsHandler } from 'better-auth/next-js';
3
+
4
+ export const { GET, POST } = toNextJsHandler(auth);
@@ -0,0 +1,9 @@
1
+ import { betterAuth } from 'better-auth';
2
+
3
+ export const auth = betterAuth({
4
+ secret: process.env.BETTER_AUTH_SECRET,
5
+ baseURL: process.env.BETTER_AUTH_URL,
6
+ emailAndPassword: {
7
+ enabled: true
8
+ }
9
+ });
@@ -0,0 +1,9 @@
1
+ import { betterAuth } from 'better-auth';
2
+
3
+ export const auth = betterAuth({
4
+ secret: process.env.BETTER_AUTH_SECRET,
5
+ baseURL: process.env.BETTER_AUTH_URL,
6
+ emailAndPassword: {
7
+ enabled: true
8
+ }
9
+ });
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ import { signIn } from '../../src/lib/auth-client';
4
+ import { useState } from 'react';
5
+
6
+ export default function SignInPage() {
7
+ const [email, setEmail] = useState('');
8
+ const [password, setPassword] = useState('');
9
+
10
+ async function handleSubmit(e) {
11
+ e.preventDefault();
12
+ await signIn.email({ email, password });
13
+ }
14
+
15
+ return (
16
+ <main>
17
+ <h1>Sign In</h1>
18
+ <form onSubmit={handleSubmit}>
19
+ <input type="email" placeholder="Email" value={email} onChange={(e) => setEmail(e.target.value)} />
20
+ <input type="password" placeholder="Password" value={password} onChange={(e) => setPassword(e.target.value)} />
21
+ <button type="submit">Sign In</button>
22
+ </form>
23
+ </main>
24
+ );
25
+ }
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ import { signIn } from '../../src/lib/auth-client';
4
+ import { useState } from 'react';
5
+
6
+ export default function SignInPage() {
7
+ const [email, setEmail] = useState('');
8
+ const [password, setPassword] = useState('');
9
+
10
+ async function handleSubmit(e: React.FormEvent) {
11
+ e.preventDefault();
12
+ await signIn.email({ email, password });
13
+ }
14
+
15
+ return (
16
+ <main>
17
+ <h1>Sign In</h1>
18
+ <form onSubmit={handleSubmit}>
19
+ <input type="email" placeholder="Email" value={email} onChange={(e) => setEmail(e.target.value)} />
20
+ <input type="password" placeholder="Password" value={password} onChange={(e) => setPassword(e.target.value)} />
21
+ <button type="submit">Sign In</button>
22
+ </form>
23
+ </main>
24
+ );
25
+ }
@@ -0,0 +1,10 @@
1
+ # Better Auth
2
+
3
+ Files:
4
+ - `auth/auth.*` Better Auth server configuration
5
+ - `src/lib/auth-client.*` client-side auth helper
6
+
7
+ Next steps:
8
+ - Configure providers in `auth/auth.*`
9
+ - Set `BETTER_AUTH_SECRET` and `BETTER_AUTH_URL` in `.env`
10
+ - See https://www.better-auth.com/docs for full documentation
@@ -0,0 +1,7 @@
1
+ node_modules/
2
+ .next/
3
+ dist/
4
+ .env
5
+ .env.local
6
+ .env.*.local
7
+ .DS_Store