Skip to content

feat: use fumadocs for website #1654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
32 changes: 27 additions & 5 deletions docs/.env.local.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
AUTH_SECRET= # Linux: `openssl rand -hex 32` or go to https://generate-secret.vercel.app/32

AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
# Better Auth Deployed URL
BETTER_AUTH_URL=http://localhost:3000

# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.
# It's used for authentication when uploading source maps.
SENTRY_AUTH_TOKEN=
# ======= OPTIONAL =======

# # Polar Sandbox is used in dev mode: https://sandbox.polar.sh/
# # You may need to delete your user in their dashboard if you get a "cannot attach new external ID error"
# POLAR_ACCESS_TOKEN=
# POLAR_WEBHOOK_SECRET=

# # In production, we use postgres
# POSTGRES_URL=

# # Email
# SMTP_HOST=
# SMTP_USER=
# SMTP_PASS=
# SMTP_PORT=
# # Insecure if false, secure if any other value
# SMTP_SECURE=false

# # For GitHub Signin method
# AUTH_GITHUB_ID=
# AUTH_GITHUB_SECRET=

# # The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.
# # It's used for authentication when uploading source maps.
# SENTRY_AUTH_TOKEN=
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ next-env.d.ts

# Sentry Config File
.env.sentry-build-plugin
*.db
4 changes: 4 additions & 0 deletions docs/app/api/auth/[...all]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { auth } from "../../../../auth";
import { toNextJsHandler } from "better-auth/next-js";

export const { POST, GET } = toNextJsHandler(auth);
2 changes: 0 additions & 2 deletions docs/app/api/auth/[...nextauth]/route.ts

This file was deleted.

10 changes: 10 additions & 0 deletions docs/app/confirmation/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

export default function Page({
searchParams: { checkoutId },
}: {
searchParams: {
checkoutId: string
}
}) {
return <div>Thank you! Your checkout is now being processed.</div>
}
19 changes: 19 additions & 0 deletions docs/app/portal/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use client";

import { useSession } from "@/util/auth-client";

// Just shows session info
export default function Me() {
const { data: session } = useSession();

if (!session) {
return <div>Not authenticated</div>;
}

return (
<div>
<h1>Welcome {session.user.name}</h1>
<pre>{JSON.stringify(session, null, 2)}</pre>
</div>
);
};
81 changes: 81 additions & 0 deletions docs/app/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"use client";

import { signIn, signUp } from "@/util/auth-client";
import { useState } from "react";

// TODO Do we want email & password signin? or just social?
export default function Register() {
const [name, setName] = useState("");
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");

const handleRegister = async () => {
await signUp.email({
email,
password,
name,
});
};

const handleSignIn = async () => {
await signIn.email({
email,
password,
});
};

return (
<div className="flex flex-col gap-4 bg-slate-700">
<input
type="text"
id="name"
name="name"
className="mt-1 block w-full rounded-md border-gray-300 text-slate-950 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
placeholder="Enter your name"
aria-label="Name"
tabIndex={0}
onChange={(e) => setName(e.target.value)}
/>
<input
type="email"
id="email"
name="email"
className="mt-1 block w-full rounded-md border-gray-300 text-slate-950 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
placeholder="Enter your email"
aria-label="Email address"
tabIndex={0}
onChange={(e) => setEmail(e.target.value)}
/>
<input
type="password"
id="password"
name="password"
className="mt-1 block w-full rounded-md border-gray-300 text-slate-950 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"
placeholder="Enter your password"
aria-label="Password"
tabIndex={0}
onChange={(e) => setPassword(e.target.value)}
/>
<button type="button" onClick={handleRegister}>
Register
</button>
<button type="button" onClick={handleSignIn}>
Sign in
</button>
<button
type="button"
onClick={async () => {
const data = await signIn.magicLink({
// If an error occurs, it will redirect to this /thanks?error=EXPIRED_TOKEN
// If it succeeds, it will redirect to this /thanks
callbackURL: "/",
email,
name,
});
console.log(data);
}}>
With magic link
</button>
</div>
);
}
Loading