mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 12:27:44 +00:00
wip
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -21,6 +21,6 @@
|
|||||||
"editor.defaultFormatter": "biomejs.biome"
|
"editor.defaultFormatter": "biomejs.biome"
|
||||||
},
|
},
|
||||||
"[typescriptreact]": {
|
"[typescriptreact]": {
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "biomejs.biome"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const PulicBetaBadge = ({ text }: { text?: string }) => {
|
|||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<div className={badgestyle.beta}>
|
<div className={badgestyle.beta}>
|
||||||
<span className={badgestyle.top_key}></span>
|
<span className={badgestyle.top_key}></span>
|
||||||
<span className={badgestyle.text}>{text || "BETA"}</span>
|
<span className={badgestyle.text}>{text}</span>
|
||||||
<span className={badgestyle.bottom_key_1}></span>
|
<span className={badgestyle.bottom_key_1}></span>
|
||||||
<span className={badgestyle.bottom_key_2}></span>
|
<span className={badgestyle.bottom_key_2}></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -20,7 +20,9 @@ export const PulicBetaBadge = ({ text }: { text?: string }) => {
|
|||||||
d="M13 4V2c4.66.5 8.33 4.19 8.85 8.85c.6 5.49-3.35 10.43-8.85 11.03v-2c3.64-.45 6.5-3.32 6.96-6.96A7.994 7.994 0 0 0 13 4m-7.33.2A9.8 9.8 0 0 1 11 2v2.06c-1.43.2-2.78.78-3.9 1.68zM2.05 11a9.8 9.8 0 0 1 2.21-5.33L5.69 7.1A8 8 0 0 0 4.05 11zm2.22 7.33A10.04 10.04 0 0 1 2.06 13h2c.18 1.42.75 2.77 1.63 3.9zm1.4 1.41l1.39-1.37h.04c1.13.88 2.48 1.45 3.9 1.63v2c-1.96-.21-3.82-1-5.33-2.26M12 17l1.56-3.42L17 12l-3.44-1.56L12 7l-1.57 3.44L7 12l3.43 1.58z"
|
d="M13 4V2c4.66.5 8.33 4.19 8.85 8.85c.6 5.49-3.35 10.43-8.85 11.03v-2c3.64-.45 6.5-3.32 6.96-6.96A7.994 7.994 0 0 0 13 4m-7.33.2A9.8 9.8 0 0 1 11 2v2.06c-1.43.2-2.78.78-3.9 1.68zM2.05 11a9.8 9.8 0 0 1 2.21-5.33L5.69 7.1A8 8 0 0 0 4.05 11zm2.22 7.33A10.04 10.04 0 0 1 2.06 13h2c.18 1.42.75 2.77 1.63 3.9zm1.4 1.41l1.39-1.37h.04c1.13.88 2.48 1.45 3.9 1.63v2c-1.96-.21-3.82-1-5.33-2.26M12 17l1.56-3.42L17 12l-3.44-1.56L12 7l-1.57 3.44L7 12l3.43 1.58z"
|
||||||
></path>
|
></path>
|
||||||
</svg>
|
</svg>
|
||||||
<span className="text-xs text-opacity-75">v1 - nov. 22</span>
|
<span className="text-xs text-opacity-75">
|
||||||
|
Own Your Auth
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
57
docs/components/buidler/index.tsx
Normal file
57
docs/components/buidler/index.tsx
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import { PlusIcon } from "lucide-react";
|
||||||
|
import {
|
||||||
|
Dialog,
|
||||||
|
DialogContent,
|
||||||
|
DialogHeader,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "../ui/dialog";
|
||||||
|
import { Card } from "../ui/card";
|
||||||
|
import { Tabs, TabsList, TabsTrigger } from "../ui/tabs";
|
||||||
|
|
||||||
|
export function Builder() {
|
||||||
|
return (
|
||||||
|
<Dialog>
|
||||||
|
<DialogTrigger asChild>
|
||||||
|
<button className="bg-stone-950 no-underline group cursor-pointer relative shadow-2xl shadow-zinc-900 rounded-sm p-px text-xs font-semibold leading-6 text-white inline-block">
|
||||||
|
<span className="absolute inset-0 overflow-hidden rounded-sm">
|
||||||
|
<span className="absolute inset-0 rounded-sm bg-[image:radial-gradient(75%_100%_at_50%_0%,rgba(56,189,248,0.6)_0%,rgba(56,189,248,0)_75%)] opacity-0 transition-opacity duration-500 group-hover:opacity-100"></span>
|
||||||
|
</span>
|
||||||
|
<div className="relative flex space-x-2 items-center z-10 rounded-none bg-zinc-950 py-2 px-4 ring-1 ring-white/10 ">
|
||||||
|
<PlusIcon size={14} />
|
||||||
|
<span>Create Sign in Box</span>
|
||||||
|
</div>
|
||||||
|
<span className="absolute -bottom-0 left-[1.125rem] h-px w-[calc(100%-2.25rem)] bg-gradient-to-r from-emerald-400/0 via-stone-800/90 to-emerald-400/0 transition-opacity duration-500 group-hover:opacity-40"></span>
|
||||||
|
</button>
|
||||||
|
</DialogTrigger>
|
||||||
|
<DialogContent>
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>Create Sign in Box</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
<Card className="relative h-full w-full bg-transparent max-w-7xl mx-auto rounded-none">
|
||||||
|
<div className="w-full border-b-2 border-gray-200/50 dark:border-gray-900/50">
|
||||||
|
<div className="overflow-hidden md:ml-[-2px] bg-transparent flex gap-10 items-center justify-between md:justify-normal rounded-none">
|
||||||
|
<Tabs defaultValue="preview" className="w-full">
|
||||||
|
<TabsList className=" md:ml-[-5px] data-[state=active]:bg-background items-center justify-between md:justify-normal bg-tranparent gap-3 w-full md:w-fit rounded-none">
|
||||||
|
<TabsTrigger
|
||||||
|
className="rounded-none py-2 pt-4 data-[state=active]:text-white flex items-center gap-2 data-[state=active]:bg-stone-900 "
|
||||||
|
value="preview"
|
||||||
|
onClick={() => {
|
||||||
|
// setIsPrev(true);
|
||||||
|
// setActiveTab("preview");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* <Layout className="w-4 h-4" /> */}
|
||||||
|
<span className="py-1 flex items-center justify-center">
|
||||||
|
Preview
|
||||||
|
</span>
|
||||||
|
</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import clsx from "clsx";
|
|||||||
|
|
||||||
import { GridPattern } from "./grid-pattern";
|
import { GridPattern } from "./grid-pattern";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Check, Copy, Github, Icon } from "lucide-react";
|
import { Check, Copy, Github, Icon, PlusIcon } from "lucide-react";
|
||||||
import { useTheme } from "next-themes";
|
import { useTheme } from "next-themes";
|
||||||
import { Highlight, themes } from "prism-react-renderer";
|
import { Highlight, themes } from "prism-react-renderer";
|
||||||
import {
|
import {
|
||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
import { Icons } from "../icons";
|
import { Icons } from "../icons";
|
||||||
import { Cover } from "../ui/cover";
|
import { Cover } from "../ui/cover";
|
||||||
import { PulicBetaBadge } from "../beta/badge";
|
import { PulicBetaBadge } from "../beta/badge";
|
||||||
|
import { Builder } from "../buidler";
|
||||||
|
|
||||||
const tabs: { name: "auth.ts" | "client.ts"; code: string }[] = [
|
const tabs: { name: "auth.ts" | "client.ts"; code: string }[] = [
|
||||||
{
|
{
|
||||||
@@ -63,7 +64,7 @@ export default function Hero() {
|
|||||||
<div className="relative z-10 md:text-center lg:text-left">
|
<div className="relative z-10 md:text-center lg:text-left">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div className="flex flex-col items-start gap-2">
|
<div className="flex flex-col items-start gap-2">
|
||||||
<PulicBetaBadge text="Beta" />
|
<PulicBetaBadge text="v1 is out now!" />
|
||||||
<div className="relative mt-2 flex items-center gap-2">
|
<div className="relative mt-2 flex items-center gap-2">
|
||||||
<Cover>
|
<Cover>
|
||||||
<p className="2xl relative inline tracking-tight opacity-90 md:text-3xl lg:text-5xl dark:text-white">
|
<p className="2xl relative inline tracking-tight opacity-90 md:text-3xl lg:text-5xl dark:text-white">
|
||||||
@@ -78,7 +79,7 @@ export default function Hero() {
|
|||||||
</p>
|
</p>
|
||||||
{
|
{
|
||||||
<>
|
<>
|
||||||
<div className="mt-8 flex w-fit flex-col gap-4 font-sans md:flex-row md:justify-center lg:justify-start">
|
<div className="mt-8 flex w-fit flex-col gap-4 font-sans md:flex-row md:justify-center lg:justify-start items-center">
|
||||||
<Link
|
<Link
|
||||||
href="/docs"
|
href="/docs"
|
||||||
className="hover:shadow-sm dark:border-stone-100 dark:hover:shadow-sm border-2 border-black bg-white px-4 py-1.5 text-sm uppercase text-black shadow-[1px_1px_rgba(0,0,0),2px_2px_rgba(0,0,0),3px_3px_rgba(0,0,0),4px_4px_rgba(0,0,0),5px_5px_0px_0px_rgba(0,0,0)] transition duration-200 md:px-8 dark:shadow-[1px_1px_rgba(255,255,255),2px_2px_rgba(255,255,255),3px_3px_rgba(255,255,255),4px_4px_rgba(255,255,255),5px_5px_0px_0px_rgba(255,255,255)]"
|
className="hover:shadow-sm dark:border-stone-100 dark:hover:shadow-sm border-2 border-black bg-white px-4 py-1.5 text-sm uppercase text-black shadow-[1px_1px_rgba(0,0,0),2px_2px_rgba(0,0,0),3px_3px_rgba(0,0,0),4px_4px_rgba(0,0,0),5px_5px_0px_0px_rgba(0,0,0)] transition duration-200 md:px-8 dark:shadow-[1px_1px_rgba(255,255,255),2px_2px_rgba(255,255,255),3px_3px_rgba(255,255,255),4px_4px_rgba(255,255,255),5px_5px_0px_0px_rgba(255,255,255)]"
|
||||||
@@ -86,19 +87,7 @@ export default function Hero() {
|
|||||||
Get Started
|
Get Started
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Link
|
<Builder />
|
||||||
href="https://github.com/better-auth/better-auth"
|
|
||||||
target="__blank"
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
size="lg"
|
|
||||||
className="flex items-center gap-2 rounded-none"
|
|
||||||
>
|
|
||||||
<Github size={16} />
|
|
||||||
View on GitHub
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,9 @@ const memoryDB = {};
|
|||||||
|
|
||||||
export async function getAdapter(options: BetterAuthOptions): Promise<Adapter> {
|
export async function getAdapter(options: BetterAuthOptions): Promise<Adapter> {
|
||||||
if (!options.database) {
|
if (!options.database) {
|
||||||
// If no database is provided, use memory adapter in development
|
logger.warn("No database configuration provided. Using memory adapter");
|
||||||
if (isDevelopment) {
|
|
||||||
logger.warn(
|
|
||||||
"No database configuration provided. Using memory adapter in development",
|
|
||||||
);
|
|
||||||
return memoryAdapter(memoryDB)(options);
|
return memoryAdapter(memoryDB)(options);
|
||||||
}
|
}
|
||||||
throw new BetterAuthError("Database configuration is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof options.database === "function") {
|
if (typeof options.database === "function") {
|
||||||
return options.database(options);
|
return options.database(options);
|
||||||
|
|||||||
Reference in New Issue
Block a user