diff --git a/docs/app/changelogs/_components/changelog-layout.tsx b/docs/app/changelogs/_components/changelog-layout.tsx index ea06a8ba26..568b645336 100644 --- a/docs/app/changelogs/_components/changelog-layout.tsx +++ b/docs/app/changelogs/_components/changelog-layout.tsx @@ -1,9 +1,9 @@ import Link from "next/link"; - -import { Button } from "@/components/ui/button"; import { useId } from "react"; import clsx from "clsx"; +import { Logo } from "@/components/logo"; +import { DiscordLogoIcon } from "@radix-ui/react-icons"; function BookIcon(props: React.ComponentPropsWithoutRef<"svg">) { return ( @@ -44,18 +44,14 @@ function XIcon(props: React.ComponentPropsWithoutRef<"svg">) { export function Intro() { return ( <> -
- - {/* */} - -

All of the changes made will be{" "} available here.

- Better Auth is advanced authentication library for typescript packed by - customizable and extendible plugin ecosystem + Better Auth is comprehensive authentication library for TypeScript that + provides a wide range of features to make authentication easier and more + secure.


@@ -74,11 +70,11 @@ export function Intro() { GitHub - RSS + Community
diff --git a/docs/app/changelogs/_logs/2024-09-28.tsx b/docs/app/changelogs/_logs/2024-09-28.tsx index 167906d0e9..ab485d111d 100644 --- a/docs/app/changelogs/_logs/2024-09-28.tsx +++ b/docs/app/changelogs/_logs/2024-09-28.tsx @@ -1,8 +1,16 @@ import { AnimatePresence } from "@/components/ui/fade-in"; -const listOfFeatures = ["The first better-auth public beta release"]; - -const bugFixes = [""]; +const listOfFeatures = [ + "Multiple framework support", + "Email & Password Authentication", + "OAuth Authentication", + "Account & Session Management", + "Rate Limiting", + "Multiple Plugins", + "Migration CLI", + "Multiple Plugins", + "And more...", +]; const ChangelogOne = () => { return ( @@ -12,10 +20,7 @@ const ChangelogOne = () => {

Public Beta Release

-

- The first public beta release of better-auth is now available. This - release includes a lot of new features and improvements. -

+

The first public beta release of better-auth is now available!

diff --git a/docs/app/changelogs/layout.tsx b/docs/app/changelogs/layout.tsx index 0b29de1acc..3a2b05dd4f 100644 --- a/docs/app/changelogs/layout.tsx +++ b/docs/app/changelogs/layout.tsx @@ -32,7 +32,7 @@ function Glow() { let id = useId(); return ( -
+
-
+
); } diff --git a/docs/app/changelogs/page.tsx b/docs/app/changelogs/page.tsx index 8dca64cfc1..4baa67f7d9 100644 --- a/docs/app/changelogs/page.tsx +++ b/docs/app/changelogs/page.tsx @@ -10,7 +10,7 @@ const ChangelogPage = () => {
diff --git a/docs/app/docs/[[...slug]]/page.tsx b/docs/app/docs/[[...slug]]/page.tsx index 1a3c40ff18..4e452a7321 100644 --- a/docs/app/docs/[[...slug]]/page.tsx +++ b/docs/app/docs/[[...slug]]/page.tsx @@ -50,7 +50,7 @@ export async function generateStaticParams() { export function generateMetadata({ params }: { params: { slug?: string[] } }) { const page = getPage(params.slug); if (page == null) notFound(); - const baseUrl = process.env.NEXT_APP_PUBLIC_URL || process.env.VERCEL_URL; + const baseUrl = process.env.NEXT_PUBLIC_URL || process.env.VERCEL_URL; const url = new URL(`${baseUrl}/api/og`); const { title, description } = page.data; const pageSlug = page.file.path; diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx index d9b9fdf68e..6f2e9f6adf 100644 --- a/docs/app/layout.tsx +++ b/docs/app/layout.tsx @@ -8,12 +8,14 @@ import { GeistSans } from "geist/font/sans"; import { baseUrl, createMetadata } from "@/lib/metadata"; import { Banner } from "fumadocs-ui/components/banner"; import Link from "next/link"; +import Loglib from "@loglib/tracker/react"; + export const metadata = createMetadata({ title: { template: "%s | Better Auth", default: "Better Auth", }, - description: "The authentication library for typescript", + description: "The most comprehensive authentication library for TypeScript.", metadataBase: baseUrl, }); @@ -47,6 +49,12 @@ export default function Layout({ children }: { children: ReactNode }) { {children} + ); diff --git a/docs/components/fork-button.tsx b/docs/components/fork-button.tsx new file mode 100644 index 0000000000..248508773e --- /dev/null +++ b/docs/components/fork-button.tsx @@ -0,0 +1,23 @@ +import Link from "next/link"; +import { Button } from "./ui/button"; +import { GitHubLogoIcon } from "@radix-ui/react-icons"; +import { ExternalLink } from "lucide-react"; + +export function ForkButton({ url }: { url: string }) { + return ( +
+ + + + + + +
+ ); +} diff --git a/docs/components/landing/hero.tsx b/docs/components/landing/hero.tsx index 76729d8886..7db70fd911 100644 --- a/docs/components/landing/hero.tsx +++ b/docs/components/landing/hero.tsx @@ -109,7 +109,7 @@ export default function Hero() {

- The most comprehensive authentication library for typescript. + The most comprehensive authentication library for TypeScript.

{ <> diff --git a/docs/components/nav-bar.tsx b/docs/components/nav-bar.tsx index c048e3adec..4a53b32ec9 100644 --- a/docs/components/nav-bar.tsx +++ b/docs/components/nav-bar.tsx @@ -20,7 +20,6 @@ export const Navbar = () => {

BETTER-AUTH.

- {/* */}
diff --git a/docs/components/side-bar.tsx b/docs/components/side-bar.tsx index 158d6b6e22..568ec8297e 100644 --- a/docs/components/side-bar.tsx +++ b/docs/components/side-bar.tsx @@ -19,6 +19,7 @@ import { SelectTrigger, SelectValue, } from "./ui/select"; +import { loglib } from "@loglib/tracker"; export default function ArticleLayout() { const { setOpenSearch } = useSearchContext(); @@ -47,6 +48,7 @@ export default function ArticleLayout() { defaultValue="docs" value={group} onValueChange={(val) => { + loglib.track("sidebar-group-change", { group: val }); setGroup(val); if (val === "docs") { router.push("/docs"); @@ -80,7 +82,7 @@ export default function ArticleLayout() { Docs

- getting started, concepts, and plugins + get started, concepts, and plugins

@@ -112,7 +114,7 @@ export default function ArticleLayout() { Examples
-

examples and use cases

+

examples and guides

@@ -120,6 +122,7 @@ export default function ArticleLayout() { className="flex items-center gap-2 p-2 px-4 border-b bg-gradient-to-br dark:from-stone-900 dark:to-stone-950/80" onClick={() => { setOpenSearch(true); + loglib.track("sidebar-search-open"); }} > @@ -144,7 +147,15 @@ export default function ArticleLayout() { {item.list.map((listItem, j) => ( - + { + loglib.track("sidebar-link-click", { + title: listItem.title, + href: listItem.href, + }); + }} + > Loading...}> {listItem.group ? (
diff --git a/docs/components/sidebar-content.tsx b/docs/components/sidebar-content.tsx index 419143855e..07f4c3fd3d 100644 --- a/docs/components/sidebar-content.tsx +++ b/docs/components/sidebar-content.tsx @@ -628,62 +628,52 @@ export const contents: Content[] = [ export const examples: Content[] = [ { - title: "Next JS", + title: "Examples", href: "/docs/examples/next", - Icon: Icons.nextJS, - list: [ - { - title: "Full Demo", - href: "/docs/examples/next-js", - icon: Icons.book, - }, - ], - }, - { - title: "Astro", - href: "/docs/examples/astro", - Icon: Icons.astro, + Icon: () => ( + + + + + + ), list: [ { title: "Astro + SolidJs", href: "/docs/examples/astro", - icon: Icons.book, + icon: Icons.astro, }, - ], - }, - { - title: "Nuxt", - href: "/docs/examples/nuxt", - Icon: Icons.nuxt, - list: [ { - title: "Basic Auth", - href: "/docs/examples/nuxt-basic-auth", - icon: Icons.book, + title: "Next JS", + href: "/docs/examples/next-js", + icon: Icons.nextJS, }, - ], - }, - { - title: "Svelte Kit", - href: "/docs/examples/svelte-kit", - Icon: Icons.svelteKit, - list: [ { - title: "Basic Auth", - href: "/docs/examples/svelte-kit-basic-auth", - icon: Icons.book, + title: "Nuxt", + href: "/docs/examples/nuxt", + icon: Icons.nuxt, }, - ], - }, - { - title: "Solid Start", - href: "/docs/examples/solid-start", - Icon: Icons.solidStart, - list: [ { - title: "Github OAuth", - icon: Icons.book, - href: "/docs/examples/solid-start/github-oauth", + title: "Svelte Kit", + href: "/docs/examples/svelte-kit", + icon: Icons.svelteKit, }, ], }, diff --git a/docs/content/docs/examples/astro.mdx b/docs/content/docs/examples/astro.mdx index bd652dbe05..1e18c5839e 100644 --- a/docs/content/docs/examples/astro.mdx +++ b/docs/content/docs/examples/astro.mdx @@ -3,14 +3,44 @@ title: Astro example descirption: Better auth astro example --- - \ No newline at end of file +This is an example of how to use Better Auth with Astro. It uses Solid for buildng the components. + + +**Implements the following features:** +Email & Password . Social Sign-in with Google . Passkeys . Email Verification . Password Reset . Two Factor Authentication . Profile Update . Session Management + + + + + + + +## How to run + +1. Clone the code sandbox (or the repo) and open it in your code editor +2. Provide .env file with the following variables + ```txt + GOOGLE_CLIENT_ID= + GOOGLE_CLIENT_SECRET= + BETTER_AUTH_SECRET= + ``` + //if you don't have these, you can get them from the google developer console. If you don't want to use google sign-in, you can remove the google config from the `auth.ts` file. + +3. Run the following commands + ```bash + pnpm install + pnpm run dev + ``` +4. Open the browser and navigate to `http://localhost:3000` diff --git a/docs/content/docs/examples/next-js.mdx b/docs/content/docs/examples/next-js.mdx index 1fed284115..f4f17ceca2 100644 --- a/docs/content/docs/examples/next-js.mdx +++ b/docs/content/docs/examples/next-js.mdx @@ -3,14 +3,37 @@ title: Next js example descirption: Better auth next js example --- - \ No newline at end of file +This is an example of how to use Better Auth with Next. + +**Implements the following features:** +Email & Password . Social Sign-in . Passkeys . Email Verification . Password Reset . Two Factor Authentication . Profile Update . Session Management . Oragnization, Members and Roles + +See [Demo](https://demo.better-auth.com) + + + + + + +## How to run + +1. Clone the code sandbox (or the repo) and open it in your code editor +2. Move .env.example to .env and provide necessary variables +3. Run the following commands + ```bash + pnpm install + pnpm dev + ``` +4. Open the browser and navigate to `http://localhost:3000` diff --git a/docs/content/docs/examples/nuxt.mdx b/docs/content/docs/examples/nuxt.mdx new file mode 100644 index 0000000000..1c14bbebbd --- /dev/null +++ b/docs/content/docs/examples/nuxt.mdx @@ -0,0 +1,38 @@ +--- +title: Nuxt js example +descirption: better auth nuxt js example +--- + +This is an example of how to use Better Auth with Nuxt + +**Implements the following features:** +Email & Password . Social Sign-in with Google + + + + + + + +## How to run + +1. Clone the code sandbox (or the repo) and open it in your code editor +2. Move .env.example to .env and provide necessary variables +3. Run the following commands + ```bash + pnpm install + pnpm dev + ``` +4. Open the browser and navigate to `http://localhost:3000` diff --git a/docs/content/docs/examples/svelte-kit.mdx b/docs/content/docs/examples/svelte-kit.mdx new file mode 100644 index 0000000000..a014e79099 --- /dev/null +++ b/docs/content/docs/examples/svelte-kit.mdx @@ -0,0 +1,38 @@ +--- +title: Svelte Kit +descirption: Better auth Svelte Kit example +--- + +This is an example of how to use Better Auth with Svelte Kit. + +**Implements the following features:** + +Email & Password . Social Sign-in with Google . Passkeys . Email Verification . Password Reset . Two Factor Authentication . Profile Update . Session Management + + + + + +## How to run + +1. Clone the code sandbox (or the repo) and open it in your code editor +2. Move .env.example to .env and provide necessary variables +3. Run the following commands + ```bash + pnpm install + pnpm dev + ``` +4. Open the browser and navigate to `http://localhost:3000` + diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsx index a18aabe20d..488a7c7a53 100644 --- a/docs/mdx-components.tsx +++ b/docs/mdx-components.tsx @@ -9,6 +9,7 @@ import { AnimatePresence } from "./components/ui/fade-in"; import { Popup, PopupContent, PopupTrigger } from "fumadocs-ui/twoslash/popup"; import { TypeTable } from "fumadocs-ui/components/type-table"; import { Features } from "./components/blocks/features"; +import { ForkButton } from "./components/fork-button"; export function useMDXComponents(components: MDXComponents): MDXComponents { return { @@ -31,6 +32,7 @@ export function useMDXComponents(components: MDXComponents): MDXComponents { AnimatePresence, TypeTable, Features, + ForkButton, iframe: (props) =>