diff --git a/.content-collections/cache/content-collection-config.mjs b/.content-collections/cache/content-collection-config.mjs
deleted file mode 100644
index b929b80..0000000
--- a/.content-collections/cache/content-collection-config.mjs
+++ /dev/null
@@ -1,394 +0,0 @@
-// content-collections.ts
-import { defineCollection, defineConfig } from "@content-collections/core";
-import { compileMDX } from "@content-collections/mdx";
-import rehypeAutolinkHeadings from "rehype-autolink-headings";
-import rehypePrettyCode from "rehype-pretty-code";
-import rehypeSlug from "rehype-slug";
-import { codeImport } from "remark-code-import";
-import remarkGfm from "remark-gfm";
-import { createHighlighter } from "shiki";
-import { visit as visit3 } from "unist-util-visit";
-
-// lib/rehype-component.ts
-import fs from "fs";
-import path from "path";
-import { u } from "unist-builder";
-import { visit } from "unist-util-visit";
-
-// __registry__/index.tsx
-var Index = {};
-
-// components/ui/registry/registry-styles.ts
-var styles = [
- {
- name: "default",
- label: "Default"
- }
-];
-
-// lib/rehype-component.ts
-function rehypeComponent() {
- return async (tree) => {
- visit(tree, (node) => {
- const { value: srcPath } = getNodeAttributeByName(node, "src") || {};
- if (node.name === "ComponentSource") {
- const name = getNodeAttributeByName(node, "name")?.value;
- const fileName = getNodeAttributeByName(node, "fileName")?.value;
- if (!name && !srcPath) {
- return null;
- }
- try {
- for (const style of styles) {
- let src;
- if (srcPath) {
- src = srcPath;
- } else {
- const component = Index[style.name][name];
- src = fileName ? component.files.find((file) => {
- return file.endsWith(`${fileName}.tsx`) || file.endsWith(`${fileName}.ts`);
- }) || component.files[0] : component.files[0];
- }
- const filePath = path.join(process.cwd(), src);
- let source = fs.readFileSync(filePath, "utf8");
- source = source.replaceAll(
- `@/registry/${style.name}/`,
- "@/components/"
- );
- source = source.replaceAll("export default", "export");
- node.children?.push(
- u("element", {
- tagName: "pre",
- properties: {
- __src__: src
- },
- attributes: [
- {
- name: "styleName",
- type: "mdxJsxAttribute",
- value: style.name
- }
- ],
- children: [
- u("element", {
- tagName: "code",
- properties: {
- className: ["language-tsx"]
- },
- data: {
- meta: `event="copy_source_code"`
- },
- children: [
- {
- type: "text",
- value: source
- }
- ]
- })
- ]
- })
- );
- }
- } catch (error) {
- console.error(error);
- }
- }
- if (node.name === "ComponentPreview" || node.name === "BlockPreview") {
- const name = getNodeAttributeByName(node, "name")?.value;
- if (!name) {
- return null;
- }
- try {
- for (const style of styles) {
- const component = Index[style.name][name];
- const src = component.files[0];
- const filePath = path.join(process.cwd(), src);
- let source = fs.readFileSync(filePath, "utf8");
- source = source.replaceAll(
- `@/registry/${style.name}/`,
- "@/components/"
- );
- source = source.replaceAll("export default", "export");
- node.children?.push(
- u("element", {
- tagName: "pre",
- properties: {
- __src__: src
- },
- children: [
- u("element", {
- tagName: "code",
- properties: {
- className: ["language-tsx"]
- },
- data: {
- meta: `event="copy_usage_code"`
- },
- children: [
- {
- type: "text",
- value: source
- }
- ]
- })
- ]
- })
- );
- }
- } catch (error) {
- console.error(error);
- }
- }
- });
- };
-}
-function getNodeAttributeByName(node, name) {
- return node.attributes?.find((attribute) => attribute.name === name);
-}
-
-// lib/rehype-npm-command.ts
-import { visit as visit2 } from "unist-util-visit";
-function rehypeNpmCommand() {
- return (tree) => {
- visit2(tree, (node) => {
- if (node.type !== "element" || node?.tagName !== "pre") {
- return;
- }
- if (node.properties?.["__rawString__"]?.startsWith("npm install")) {
- const npmCommand = node.properties?.["__rawString__"];
- node.properties["__npmCommand__"] = npmCommand;
- node.properties["__yarnCommand__"] = npmCommand.replace(
- "npm install",
- "yarn add"
- );
- node.properties["__pnpmCommand__"] = npmCommand.replace(
- "npm install",
- "pnpm add"
- );
- node.properties["__bunCommand__"] = npmCommand.replace(
- "npm install",
- "bun add"
- );
- }
- if (node.properties?.["__rawString__"]?.startsWith("npx create-")) {
- const npmCommand = node.properties?.["__rawString__"];
- node.properties["__npmCommand__"] = npmCommand;
- node.properties["__yarnCommand__"] = npmCommand.replace(
- "npx create-",
- "yarn create "
- );
- node.properties["__pnpmCommand__"] = npmCommand.replace(
- "npx create-",
- "pnpm create "
- );
- node.properties["__bunCommand__"] = npmCommand.replace(
- "npx",
- "bunx --bun"
- );
- }
- if (node.properties?.["__rawString__"]?.startsWith("npx") && !node.properties?.["__rawString__"]?.startsWith("npx create-")) {
- const npmCommand = node.properties?.["__rawString__"];
- node.properties["__npmCommand__"] = npmCommand;
- node.properties["__yarnCommand__"] = npmCommand;
- node.properties["__pnpmCommand__"] = npmCommand.replace(
- "npx",
- "pnpm dlx"
- );
- node.properties["__bunCommand__"] = npmCommand.replace(
- "npx",
- "bunx --bun"
- );
- }
- if (node.properties?.["__rawString__"]?.startsWith("npm create")) {
- const npmCommand = node.properties?.["__rawString__"];
- node.properties["__npmCommand__"] = npmCommand;
- node.properties["__yarnCommand__"] = npmCommand.replace(
- "npm create",
- "yarn create"
- );
- node.properties["__pnpmCommand__"] = npmCommand.replace(
- "npm create",
- "pnpm create"
- );
- node.properties["__bunCommand__"] = npmCommand.replace(
- "npm create",
- "bun create"
- );
- }
- });
- };
-}
-
-// content-collections.ts
-var prettyCodeOptions = {
- theme: "github-dark",
- getHighlighter: (options) => createHighlighter({
- ...options
- }),
- onVisitLine(node) {
- if (node.children.length === 0) {
- node.children = [{ type: "text", value: " " }];
- }
- },
- onVisitHighlightedLine(node) {
- if (!node.properties.className) {
- node.properties.className = [];
- }
- node.properties.className.push("line--highlighted");
- },
- onVisitHighlightedChars(node) {
- if (!node.properties.className) {
- node.properties.className = [];
- }
- node.properties.className = ["word--highlighted"];
- }
-};
-var showcase = defineCollection({
- name: "Showcase",
- directory: "content/showcase",
- include: "**/*.mdx",
- schema: (z) => ({
- title: z.string(),
- description: z.string(),
- image: z.string(),
- href: z.string(),
- affiliation: z.string(),
- featured: z.boolean().optional().default(false)
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm]
- });
- return {
- ...document,
- slug: `/showcase/${document._meta.path}`,
- slugAsParams: document._meta.path,
- body: {
- raw: document.content,
- code: body
- }
- };
- }
-});
-var pages = defineCollection({
- name: "Page",
- directory: "content/pages",
- include: "**/*.mdx",
- schema: (z) => ({
- title: z.string(),
- description: z.string()
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm]
- });
- return {
- ...document,
- slug: `/${document._meta.path}`,
- slugAsParams: document._meta.path,
- body: {
- raw: document.content,
- code: body
- }
- };
- }
-});
-var documents = defineCollection({
- name: "Doc",
- directory: "content",
- include: "**/*.mdx",
- schema: (z) => ({
- title: z.string(),
- description: z.string(),
- published: z.boolean().default(true),
- date: z.string().optional(),
- links: z.object({
- doc: z.string().optional(),
- api: z.string().optional()
- }).optional(),
- featured: z.boolean().optional().default(false),
- component: z.boolean().optional().default(false),
- toc: z.boolean().optional().default(true),
- image: z.string().optional()
- }),
- transform: async (document, context) => {
- const body = await compileMDX(context, document, {
- remarkPlugins: [codeImport, remarkGfm],
- rehypePlugins: [
- rehypeSlug,
- rehypeComponent,
- () => (tree) => {
- visit3(tree, (node) => {
- if (node?.type === "element" && node?.tagName === "pre") {
- const [codeEl] = node.children;
- if (codeEl.tagName !== "code") {
- return;
- }
- if (codeEl.data?.meta) {
- const regex = /event="([^"]*)"/;
- const match = codeEl.data?.meta.match(regex);
- if (match) {
- node.__event__ = match ? match[1] : null;
- codeEl.data.meta = codeEl.data.meta.replace(regex, "");
- }
- }
- node.__rawString__ = codeEl.children?.[0].value;
- node.__src__ = node.properties?.__src__;
- node.__style__ = node.properties?.__style__;
- }
- });
- },
- [rehypePrettyCode, prettyCodeOptions],
- () => (tree) => {
- visit3(tree, (node) => {
- if (node?.type === "element" && node?.tagName === "figure") {
- if (!("data-rehype-pretty-code-figure" in node.properties)) {
- return;
- }
- const preElement = node.children.at(-1);
- if (preElement.tagName !== "pre") {
- return;
- }
- preElement.properties["__withMeta__"] = node.children.at(0).tagName === "div";
- preElement.properties["__rawString__"] = node.__rawString__;
- if (node.__src__) {
- preElement.properties["__src__"] = node.__src__;
- }
- if (node.__event__) {
- preElement.properties["__event__"] = node.__event__;
- }
- if (node.__style__) {
- preElement.properties["__style__"] = node.__style__;
- }
- }
- });
- },
- rehypeNpmCommand,
- [
- rehypeAutolinkHeadings,
- {
- properties: {
- className: ["subheading-anchor"],
- ariaLabel: "Link to section"
- }
- }
- ]
- ]
- });
- return {
- ...document,
- image: `${process.env.NEXT_PUBLIC_APP_URL}/og?title=${encodeURI(document.title)}`,
- slug: `/${document._meta.path}`,
- slugAsParams: document._meta.path.split("/").slice(1).join("/"),
- body: {
- raw: document.content,
- code: body
- }
- };
- }
-});
-var content_collections_default = defineConfig({
- collections: [documents, pages, showcase]
-});
-export {
- content_collections_default as default
-};
diff --git a/.content-collections/cache/doc/docs/36c920da13347438bad62a209abb00dc33ec1ab4a63f4d06cff0d778ce08cd63.cache b/.content-collections/cache/doc/docs/36c920da13347438bad62a209abb00dc33ec1ab4a63f4d06cff0d778ce08cd63.cache
deleted file mode 100644
index e9cee9e..0000000
--- a/.content-collections/cache/doc/docs/36c920da13347438bad62a209abb00dc33ec1ab4a63f4d06cff0d778ce08cd63.cache
+++ /dev/null
@@ -1 +0,0 @@
-"var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var f=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),y=(i,n)=>{for(var o in n)l(i,o,{get:n[o],enumerable:!0})},r=(i,n,o,a)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let t of m(n))!b.call(i,t)&&t!==o&&l(i,t,{get:()=>n[t],enumerable:!(a=p(n,t))||a.enumerable});return i};var k=(i,n,o)=>(o=i!=null?u(g(i)):{},r(n||!i||!i.__esModule?l(o,\"default\",{value:i,enumerable:!0}):o,i)),w=i=>r(l({},\"__esModule\",{value:!0}),i);var s=f((I,c)=>{c.exports=_jsx_runtime});var x={};y(x,{default:()=>h});var e=k(s());function d(i){let n={a:\"a\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",span:\"span\",strong:\"strong\",ul:\"ul\",...i.components};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.p,{children:\"Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\"}),`\n`,(0,e.jsxs)(n.h2,{id:\"why-lib-ui\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#why-lib-ui\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Why Lib UI?\"]}),`\n`,(0,e.jsx)(n.p,{children:\"In today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\"}),`\n`,(0,e.jsx)(n.p,{children:\"Lib UI bridges this gap by offering:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Full-stack Components\"}),\": Get both UI and logic in a single package\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Ready-to-use Solutions\"}),\": Implement complex features like authentication and payments with one command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Customizable Building Blocks\"}),\": Maintain full control while leveraging pre-built functionality\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Developer Experience\"}),\": Focus on building your product, not wrestling with documentation\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h3,{id:\"real-world-examples\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#real-world-examples\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Real-world Examples\"]}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Authentication\"}),\": Implement secure user authentication with both UI components and backend logic using a single command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Payment Integration\"}),\": Add Stripe payments to your app without spending hours reading documentation\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Admin Dashboards\"}),\": Deploy fully functional admin interfaces that connect directly to your data\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"our-mission\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#our-mission\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Our Mission\"]}),`\n`,(0,e.jsx)(n.p,{children:\"We believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F680} Ship products faster\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F6E0}\\uFE0F Reduce boilerplate code\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u26A1 Focus on core business logic\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F3A8} Maintain design flexibility\"}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"inspiration\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#inspiration\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Inspiration\"]}),`\n`,(0,e.jsx)(n.p,{children:\"This project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://ui.shadcn.com/\",children:\"shadcn/ui\"}),\" - For pioneering component architecture\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://magicui.design/\",children:\"MagicUI\"}),\" - For innovative design patterns\"]}),`\n`]})]})}function h(i={}){let{wrapper:n}=i.components||{};return n?(0,e.jsx)(n,{...i,children:(0,e.jsx)(d,{...i})}):d(i)}return w(x);})();\n;return Component;"
\ No newline at end of file
diff --git a/.content-collections/cache/doc/docs_cli/06eb5a14822b1ac9891f9460e471a550903d80e0f006a6896cebb95a748dc444.cache b/.content-collections/cache/doc/docs_cli/06eb5a14822b1ac9891f9460e471a550903d80e0f006a6896cebb95a748dc444.cache
deleted file mode 100644
index e9cee9e..0000000
--- a/.content-collections/cache/doc/docs_cli/06eb5a14822b1ac9891f9460e471a550903d80e0f006a6896cebb95a748dc444.cache
+++ /dev/null
@@ -1 +0,0 @@
-"var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var f=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),y=(i,n)=>{for(var o in n)l(i,o,{get:n[o],enumerable:!0})},r=(i,n,o,a)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let t of m(n))!b.call(i,t)&&t!==o&&l(i,t,{get:()=>n[t],enumerable:!(a=p(n,t))||a.enumerable});return i};var k=(i,n,o)=>(o=i!=null?u(g(i)):{},r(n||!i||!i.__esModule?l(o,\"default\",{value:i,enumerable:!0}):o,i)),w=i=>r(l({},\"__esModule\",{value:!0}),i);var s=f((I,c)=>{c.exports=_jsx_runtime});var x={};y(x,{default:()=>h});var e=k(s());function d(i){let n={a:\"a\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",span:\"span\",strong:\"strong\",ul:\"ul\",...i.components};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.p,{children:\"Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\"}),`\n`,(0,e.jsxs)(n.h2,{id:\"why-lib-ui\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#why-lib-ui\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Why Lib UI?\"]}),`\n`,(0,e.jsx)(n.p,{children:\"In today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\"}),`\n`,(0,e.jsx)(n.p,{children:\"Lib UI bridges this gap by offering:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Full-stack Components\"}),\": Get both UI and logic in a single package\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Ready-to-use Solutions\"}),\": Implement complex features like authentication and payments with one command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Customizable Building Blocks\"}),\": Maintain full control while leveraging pre-built functionality\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Developer Experience\"}),\": Focus on building your product, not wrestling with documentation\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h3,{id:\"real-world-examples\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#real-world-examples\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Real-world Examples\"]}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Authentication\"}),\": Implement secure user authentication with both UI components and backend logic using a single command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Payment Integration\"}),\": Add Stripe payments to your app without spending hours reading documentation\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Admin Dashboards\"}),\": Deploy fully functional admin interfaces that connect directly to your data\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"our-mission\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#our-mission\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Our Mission\"]}),`\n`,(0,e.jsx)(n.p,{children:\"We believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F680} Ship products faster\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F6E0}\\uFE0F Reduce boilerplate code\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u26A1 Focus on core business logic\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F3A8} Maintain design flexibility\"}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"inspiration\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#inspiration\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Inspiration\"]}),`\n`,(0,e.jsx)(n.p,{children:\"This project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://ui.shadcn.com/\",children:\"shadcn/ui\"}),\" - For pioneering component architecture\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://magicui.design/\",children:\"MagicUI\"}),\" - For innovative design patterns\"]}),`\n`]})]})}function h(i={}){let{wrapper:n}=i.components||{};return n?(0,e.jsx)(n,{...i,children:(0,e.jsx)(d,{...i})}):d(i)}return w(x);})();\n;return Component;"
\ No newline at end of file
diff --git a/.content-collections/cache/doc/docs_installation/afdc9fa72addad13f3d0cec80a80146922446204bfda4c3dd05301e0dd25220c.cache b/.content-collections/cache/doc/docs_installation/afdc9fa72addad13f3d0cec80a80146922446204bfda4c3dd05301e0dd25220c.cache
deleted file mode 100644
index 091782b..0000000
--- a/.content-collections/cache/doc/docs_installation/afdc9fa72addad13f3d0cec80a80146922446204bfda4c3dd05301e0dd25220c.cache
+++ /dev/null
@@ -1 +0,0 @@
-"var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var x=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports),b=(a,n)=>{for(var t in n)l(a,t,{get:n[t],enumerable:!0})},o=(a,n,t,r)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let i of m(n))!_.call(a,i)&&i!==t&&l(a,i,{get:()=>n[i],enumerable:!(r=g(n,i))||r.enumerable});return a};var E=(a,n,t)=>(t=a!=null?u(y(a)):{},o(n||!a||!a.__esModule?l(t,\"default\",{value:a,enumerable:!0}):t,a)),f=a=>o(l({},\"__esModule\",{value:!0}),a);var c=x((j,d)=>{d.exports=_jsx_runtime});var F={};b(F,{default:()=>p});var e=E(c());function s(a){let n={a:\"a\",code:\"code\",figure:\"figure\",h3:\"h3\",p:\"p\",pre:\"pre\",span:\"span\",strong:\"strong\",...a.components},{Callout:t,Steps:r}=n;return t||h(\"Callout\",!0),r||h(\"Steps\",!0),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t,{children:(0,e.jsx)(n.p,{children:(0,e.jsx)(n.strong,{children:\"We are currently only available on nextjs, stay tuned for further updates.\"})})}),`\n`,(0,e.jsxs)(r,{children:[(0,e.jsxs)(n.h3,{id:\"create-project\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#create-project\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Create project\"]}),(0,e.jsxs)(n.p,{children:[\"Run the \",(0,e.jsx)(n.code,{children:\"init\"}),\" command to create a new Next.js project or to setup an existing one:\"]}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"bash\",\"data-theme\":\"github-dark\",__rawString__:`npx libui-next init\n`,__npmCommand__:`npx libui-next init\n`,__yarnCommand__:`npx libui-next init\n`,__pnpmCommand__:`pnpm dlx libui-next init\n`,__bunCommand__:`bunx --bun libui-next init\n`,children:(0,e.jsx)(n.code,{\"data-language\":\"bash\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},children:(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\"npx\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" libui-next\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" init\"})]})})})}),(0,e.jsxs)(n.h3,{id:\"start-coding\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#start-coding\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Start coding\"]}),(0,e.jsx)(n.p,{children:\"You can now start adding full stack components to your project!\"}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"bash\",\"data-theme\":\"github-dark\",__rawString__:`npx libui-next add authjs\n`,__npmCommand__:`npx libui-next add authjs\n`,__yarnCommand__:`npx libui-next add authjs\n`,__pnpmCommand__:`pnpm dlx libui-next add authjs\n`,__bunCommand__:`bunx --bun libui-next add authjs\n`,children:(0,e.jsx)(n.code,{\"data-language\":\"bash\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},children:(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\"npx\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" libui-next\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" add\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" authjs\"})]})})})}),(0,e.jsxs)(n.p,{children:[\"This will add all the configuration of \",(0,e.jsx)(n.code,{children:\"Auth.js\"}),\" to your project.\"]}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"tsx\",\"data-theme\":\"github-dark\",__rawString__:`import { SignUpForm } from '@/components/auth/sign-up-form'\n\nexport default function SignUp() {\n return (\n
\n \n
\n )\n}\n`,children:(0,e.jsxs)(n.code,{\"data-line-numbers\":\"\",\"data-language\":\"tsx\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},\"data-line-numbers-max-digits\":\"1\",children:[(0,e.jsxs)(n.span,{className:\"line--highlighted\",\"data-line\":\"\",\"data-highlighted-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"import\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" { SignUpForm } \"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"from\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" '@/components/auth/sign-up-form'\"})]}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:\" \"}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"export\"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" default\"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" function\"}),(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\" SignUp\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\"() {\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" return\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" (\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" <\"}),(0,e.jsx)(n.span,{style:{color:\"#85E89D\"},children:\"div\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\">\"})]}),`\n`,(0,e.jsxs)(n.span,{className:\"line--highlighted\",\"data-line\":\"\",\"data-highlighted-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" <\"}),(0,e.jsx)(n.span,{style:{color:\"#79B8FF\"},children:\"SignUpForm\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" />\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" \"}),(0,e.jsx)(n.span,{style:{color:\"#85E89D\"},children:\"div\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\">\"})]}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" )\"})}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\"}\"})})]})})})]})]})}function p(a={}){let{wrapper:n}=a.components||{};return n?(0,e.jsx)(n,{...a,children:(0,e.jsx)(s,{...a})}):s(a)}function h(a,n){throw new Error(\"Expected \"+(n?\"component\":\"object\")+\" `\"+a+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return f(F);})();\n;return Component;"
\ No newline at end of file
diff --git a/.content-collections/cache/mapping.json b/.content-collections/cache/mapping.json
deleted file mode 100644
index c7612ab..0000000
--- a/.content-collections/cache/mapping.json
+++ /dev/null
@@ -1 +0,0 @@
-{"Doc":{"docs":["36c920da13347438bad62a209abb00dc33ec1ab4a63f4d06cff0d778ce08cd63"],"docs/cli":["06eb5a14822b1ac9891f9460e471a550903d80e0f006a6896cebb95a748dc444"],"docs/installation":["afdc9fa72addad13f3d0cec80a80146922446204bfda4c3dd05301e0dd25220c"]}}
\ No newline at end of file
diff --git a/.content-collections/generated/allDocs.js b/.content-collections/generated/allDocs.js
deleted file mode 100644
index 3d818fc..0000000
--- a/.content-collections/generated/allDocs.js
+++ /dev/null
@@ -1,72 +0,0 @@
-
-export default [
- {
- "content": "Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\n\n## Why Lib UI?\n\nIn today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\n\nLib UI bridges this gap by offering:\n\n- **Full-stack Components**: Get both UI and logic in a single package\n- **Ready-to-use Solutions**: Implement complex features like authentication and payments with one command\n- **Customizable Building Blocks**: Maintain full control while leveraging pre-built functionality\n- **Developer Experience**: Focus on building your product, not wrestling with documentation\n\n### Real-world Examples\n\n- **Authentication**: Implement secure user authentication with both UI components and backend logic using a single command\n- **Payment Integration**: Add Stripe payments to your app without spending hours reading documentation\n- **Admin Dashboards**: Deploy fully functional admin interfaces that connect directly to your data\n\n## Our Mission\n\nWe believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\n\n- 🚀 Ship products faster\n- 🛠️ Reduce boilerplate code\n- ⚡ Focus on core business logic\n- 🎨 Maintain design flexibility\n\n## Inspiration\n\nThis project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\n\n- [shadcn/ui](https://ui.shadcn.com/) - For pioneering component architecture\n- [MagicUI](https://magicui.design/) - For innovative design patterns",
- "title": "CLI",
- "description": "Build full-stack applications faster with pre-built, customizable components",
- "published": true,
- "featured": false,
- "component": false,
- "toc": true,
- "_meta": {
- "filePath": "docs/cli.mdx",
- "fileName": "cli.mdx",
- "directory": "docs",
- "extension": "mdx",
- "path": "docs/cli"
- },
- "image": "http://localhost:3000/og?title=CLI",
- "slug": "/docs/cli",
- "slugAsParams": "cli",
- "body": {
- "raw": "Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\n\n## Why Lib UI?\n\nIn today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\n\nLib UI bridges this gap by offering:\n\n- **Full-stack Components**: Get both UI and logic in a single package\n- **Ready-to-use Solutions**: Implement complex features like authentication and payments with one command\n- **Customizable Building Blocks**: Maintain full control while leveraging pre-built functionality\n- **Developer Experience**: Focus on building your product, not wrestling with documentation\n\n### Real-world Examples\n\n- **Authentication**: Implement secure user authentication with both UI components and backend logic using a single command\n- **Payment Integration**: Add Stripe payments to your app without spending hours reading documentation\n- **Admin Dashboards**: Deploy fully functional admin interfaces that connect directly to your data\n\n## Our Mission\n\nWe believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\n\n- 🚀 Ship products faster\n- 🛠️ Reduce boilerplate code\n- ⚡ Focus on core business logic\n- 🎨 Maintain design flexibility\n\n## Inspiration\n\nThis project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\n\n- [shadcn/ui](https://ui.shadcn.com/) - For pioneering component architecture\n- [MagicUI](https://magicui.design/) - For innovative design patterns",
- "code": "var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var f=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),y=(i,n)=>{for(var o in n)l(i,o,{get:n[o],enumerable:!0})},r=(i,n,o,a)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let t of m(n))!b.call(i,t)&&t!==o&&l(i,t,{get:()=>n[t],enumerable:!(a=p(n,t))||a.enumerable});return i};var k=(i,n,o)=>(o=i!=null?u(g(i)):{},r(n||!i||!i.__esModule?l(o,\"default\",{value:i,enumerable:!0}):o,i)),w=i=>r(l({},\"__esModule\",{value:!0}),i);var s=f((I,c)=>{c.exports=_jsx_runtime});var x={};y(x,{default:()=>h});var e=k(s());function d(i){let n={a:\"a\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",span:\"span\",strong:\"strong\",ul:\"ul\",...i.components};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.p,{children:\"Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\"}),`\n`,(0,e.jsxs)(n.h2,{id:\"why-lib-ui\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#why-lib-ui\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Why Lib UI?\"]}),`\n`,(0,e.jsx)(n.p,{children:\"In today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\"}),`\n`,(0,e.jsx)(n.p,{children:\"Lib UI bridges this gap by offering:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Full-stack Components\"}),\": Get both UI and logic in a single package\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Ready-to-use Solutions\"}),\": Implement complex features like authentication and payments with one command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Customizable Building Blocks\"}),\": Maintain full control while leveraging pre-built functionality\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Developer Experience\"}),\": Focus on building your product, not wrestling with documentation\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h3,{id:\"real-world-examples\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#real-world-examples\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Real-world Examples\"]}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Authentication\"}),\": Implement secure user authentication with both UI components and backend logic using a single command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Payment Integration\"}),\": Add Stripe payments to your app without spending hours reading documentation\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Admin Dashboards\"}),\": Deploy fully functional admin interfaces that connect directly to your data\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"our-mission\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#our-mission\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Our Mission\"]}),`\n`,(0,e.jsx)(n.p,{children:\"We believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F680} Ship products faster\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F6E0}\\uFE0F Reduce boilerplate code\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u26A1 Focus on core business logic\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F3A8} Maintain design flexibility\"}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"inspiration\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#inspiration\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Inspiration\"]}),`\n`,(0,e.jsx)(n.p,{children:\"This project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://ui.shadcn.com/\",children:\"shadcn/ui\"}),\" - For pioneering component architecture\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://magicui.design/\",children:\"MagicUI\"}),\" - For innovative design patterns\"]}),`\n`]})]})}function h(i={}){let{wrapper:n}=i.components||{};return n?(0,e.jsx)(n,{...i,children:(0,e.jsx)(d,{...i})}):d(i)}return w(x);})();\n;return Component;"
- }
- },
- {
- "content": "Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\n\n## Why Lib UI?\n\nIn today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\n\nLib UI bridges this gap by offering:\n\n- **Full-stack Components**: Get both UI and logic in a single package\n- **Ready-to-use Solutions**: Implement complex features like authentication and payments with one command\n- **Customizable Building Blocks**: Maintain full control while leveraging pre-built functionality\n- **Developer Experience**: Focus on building your product, not wrestling with documentation\n\n### Real-world Examples\n\n- **Authentication**: Implement secure user authentication with both UI components and backend logic using a single command\n- **Payment Integration**: Add Stripe payments to your app without spending hours reading documentation\n- **Admin Dashboards**: Deploy fully functional admin interfaces that connect directly to your data\n\n## Our Mission\n\nWe believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\n\n- 🚀 Ship products faster\n- 🛠️ Reduce boilerplate code\n- ⚡ Focus on core business logic\n- 🎨 Maintain design flexibility\n\n## Inspiration\n\nThis project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\n\n- [shadcn/ui](https://ui.shadcn.com/) - For pioneering component architecture\n- [MagicUI](https://magicui.design/) - For innovative design patterns",
- "title": "Introduction",
- "description": "Build full-stack applications faster with pre-built, customizable components",
- "published": true,
- "featured": false,
- "component": false,
- "toc": true,
- "_meta": {
- "filePath": "docs/index.mdx",
- "fileName": "index.mdx",
- "directory": "docs",
- "extension": "mdx",
- "path": "docs"
- },
- "image": "http://localhost:3000/og?title=Introduction",
- "slug": "/docs",
- "slugAsParams": "",
- "body": {
- "raw": "Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\n\n## Why Lib UI?\n\nIn today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\n\nLib UI bridges this gap by offering:\n\n- **Full-stack Components**: Get both UI and logic in a single package\n- **Ready-to-use Solutions**: Implement complex features like authentication and payments with one command\n- **Customizable Building Blocks**: Maintain full control while leveraging pre-built functionality\n- **Developer Experience**: Focus on building your product, not wrestling with documentation\n\n### Real-world Examples\n\n- **Authentication**: Implement secure user authentication with both UI components and backend logic using a single command\n- **Payment Integration**: Add Stripe payments to your app without spending hours reading documentation\n- **Admin Dashboards**: Deploy fully functional admin interfaces that connect directly to your data\n\n## Our Mission\n\nWe believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\n\n- 🚀 Ship products faster\n- 🛠️ Reduce boilerplate code\n- ⚡ Focus on core business logic\n- 🎨 Maintain design flexibility\n\n## Inspiration\n\nThis project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\n\n- [shadcn/ui](https://ui.shadcn.com/) - For pioneering component architecture\n- [MagicUI](https://magicui.design/) - For innovative design patterns",
- "code": "var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var f=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports),y=(i,n)=>{for(var o in n)l(i,o,{get:n[o],enumerable:!0})},r=(i,n,o,a)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let t of m(n))!b.call(i,t)&&t!==o&&l(i,t,{get:()=>n[t],enumerable:!(a=p(n,t))||a.enumerable});return i};var k=(i,n,o)=>(o=i!=null?u(g(i)):{},r(n||!i||!i.__esModule?l(o,\"default\",{value:i,enumerable:!0}):o,i)),w=i=>r(l({},\"__esModule\",{value:!0}),i);var s=f((I,c)=>{c.exports=_jsx_runtime});var x={};y(x,{default:()=>h});var e=k(s());function d(i){let n={a:\"a\",h2:\"h2\",h3:\"h3\",li:\"li\",p:\"p\",span:\"span\",strong:\"strong\",ul:\"ul\",...i.components};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.p,{children:\"Lib UI is a revolutionary full-stack component library that combines the power of frontend components with backend functionality. Build production-ready applications faster than ever before.\"}),`\n`,(0,e.jsxs)(n.h2,{id:\"why-lib-ui\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#why-lib-ui\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Why Lib UI?\"]}),`\n`,(0,e.jsx)(n.p,{children:\"In today's JavaScript ecosystem, we have countless libraries for frontend components and backend tools. But what if you could have both in one unified solution?\"}),`\n`,(0,e.jsx)(n.p,{children:\"Lib UI bridges this gap by offering:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Full-stack Components\"}),\": Get both UI and logic in a single package\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Ready-to-use Solutions\"}),\": Implement complex features like authentication and payments with one command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Customizable Building Blocks\"}),\": Maintain full control while leveraging pre-built functionality\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Developer Experience\"}),\": Focus on building your product, not wrestling with documentation\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h3,{id:\"real-world-examples\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#real-world-examples\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Real-world Examples\"]}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Authentication\"}),\": Implement secure user authentication with both UI components and backend logic using a single command\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Payment Integration\"}),\": Add Stripe payments to your app without spending hours reading documentation\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.strong,{children:\"Admin Dashboards\"}),\": Deploy fully functional admin interfaces that connect directly to your data\"]}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"our-mission\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#our-mission\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Our Mission\"]}),`\n`,(0,e.jsx)(n.p,{children:\"We believe developers should spend more time building unique features for their applications and less time implementing common functionality. Lib UI provides pre-built, customizable full-stack components that handle both frontend and backend concerns, allowing you to:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F680} Ship products faster\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F6E0}\\uFE0F Reduce boilerplate code\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u26A1 Focus on core business logic\"}),`\n`,(0,e.jsx)(n.li,{children:\"\\u{1F3A8} Maintain design flexibility\"}),`\n`]}),`\n`,(0,e.jsxs)(n.h2,{id:\"inspiration\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#inspiration\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Inspiration\"]}),`\n`,(0,e.jsx)(n.p,{children:\"This project stands on the shoulders of those before us. We're grateful for the incredible open-source work of:\"}),`\n`,(0,e.jsxs)(n.ul,{children:[`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://ui.shadcn.com/\",children:\"shadcn/ui\"}),\" - For pioneering component architecture\"]}),`\n`,(0,e.jsxs)(n.li,{children:[(0,e.jsx)(n.a,{href:\"https://magicui.design/\",children:\"MagicUI\"}),\" - For innovative design patterns\"]}),`\n`]})]})}function h(i={}){let{wrapper:n}=i.components||{};return n?(0,e.jsx)(n,{...i,children:(0,e.jsx)(d,{...i})}):d(i)}return w(x);})();\n;return Component;"
- }
- },
- {
- "content": "\n\n**We are currently only available on nextjs, stay tuned for further updates.**\n\n\n\n\n\n### Create project\n\nRun the `init` command to create a new Next.js project or to setup an existing one:\n\n```bash\nnpx libui-next init\n```\n\n### Start coding\n\nYou can now start adding full stack components to your project!\n\n```bash\nnpx libui-next add authjs\n```\n\nThis will add all the configuration of `Auth.js` to your project.\n\n```tsx {1,6} showLineNumbers\nimport { SignUpForm } from '@/components/auth/sign-up-form'\n\nexport default function SignUp() {\n return (\n
\n \n
\n )\n}\n```\n\n",
- "title": "Installation (example)",
- "description": "Install and configure Next.js.",
- "published": true,
- "featured": false,
- "component": false,
- "toc": true,
- "_meta": {
- "filePath": "docs/installation.mdx",
- "fileName": "installation.mdx",
- "directory": "docs",
- "extension": "mdx",
- "path": "docs/installation"
- },
- "image": "http://localhost:3000/og?title=Installation%20(example)",
- "slug": "/docs/installation",
- "slugAsParams": "installation",
- "body": {
- "raw": "\n\n**We are currently only available on nextjs, stay tuned for further updates.**\n\n\n\n\n\n### Create project\n\nRun the `init` command to create a new Next.js project or to setup an existing one:\n\n```bash\nnpx libui-next init\n```\n\n### Start coding\n\nYou can now start adding full stack components to your project!\n\n```bash\nnpx libui-next add authjs\n```\n\nThis will add all the configuration of `Auth.js` to your project.\n\n```tsx {1,6} showLineNumbers\nimport { SignUpForm } from '@/components/auth/sign-up-form'\n\nexport default function SignUp() {\n return (\n
\n \n
\n )\n}\n```\n\n",
- "code": "var Component=(()=>{var u=Object.create;var l=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var x=(a,n)=>()=>(n||a((n={exports:{}}).exports,n),n.exports),b=(a,n)=>{for(var t in n)l(a,t,{get:n[t],enumerable:!0})},o=(a,n,t,r)=>{if(n&&typeof n==\"object\"||typeof n==\"function\")for(let i of m(n))!_.call(a,i)&&i!==t&&l(a,i,{get:()=>n[i],enumerable:!(r=g(n,i))||r.enumerable});return a};var E=(a,n,t)=>(t=a!=null?u(y(a)):{},o(n||!a||!a.__esModule?l(t,\"default\",{value:a,enumerable:!0}):t,a)),f=a=>o(l({},\"__esModule\",{value:!0}),a);var c=x((j,d)=>{d.exports=_jsx_runtime});var F={};b(F,{default:()=>p});var e=E(c());function s(a){let n={a:\"a\",code:\"code\",figure:\"figure\",h3:\"h3\",p:\"p\",pre:\"pre\",span:\"span\",strong:\"strong\",...a.components},{Callout:t,Steps:r}=n;return t||h(\"Callout\",!0),r||h(\"Steps\",!0),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t,{children:(0,e.jsx)(n.p,{children:(0,e.jsx)(n.strong,{children:\"We are currently only available on nextjs, stay tuned for further updates.\"})})}),`\n`,(0,e.jsxs)(r,{children:[(0,e.jsxs)(n.h3,{id:\"create-project\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#create-project\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Create project\"]}),(0,e.jsxs)(n.p,{children:[\"Run the \",(0,e.jsx)(n.code,{children:\"init\"}),\" command to create a new Next.js project or to setup an existing one:\"]}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"bash\",\"data-theme\":\"github-dark\",__rawString__:`npx libui-next init\n`,__npmCommand__:`npx libui-next init\n`,__yarnCommand__:`npx libui-next init\n`,__pnpmCommand__:`pnpm dlx libui-next init\n`,__bunCommand__:`bunx --bun libui-next init\n`,children:(0,e.jsx)(n.code,{\"data-language\":\"bash\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},children:(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\"npx\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" libui-next\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" init\"})]})})})}),(0,e.jsxs)(n.h3,{id:\"start-coding\",children:[(0,e.jsx)(n.a,{className:\"subheading-anchor\",\"aria-label\":\"Link to section\",href:\"#start-coding\",children:(0,e.jsx)(n.span,{className:\"icon icon-link\"})}),\"Start coding\"]}),(0,e.jsx)(n.p,{children:\"You can now start adding full stack components to your project!\"}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"bash\",\"data-theme\":\"github-dark\",__rawString__:`npx libui-next add authjs\n`,__npmCommand__:`npx libui-next add authjs\n`,__yarnCommand__:`npx libui-next add authjs\n`,__pnpmCommand__:`pnpm dlx libui-next add authjs\n`,__bunCommand__:`bunx --bun libui-next add authjs\n`,children:(0,e.jsx)(n.code,{\"data-language\":\"bash\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},children:(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\"npx\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" libui-next\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" add\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" authjs\"})]})})})}),(0,e.jsxs)(n.p,{children:[\"This will add all the configuration of \",(0,e.jsx)(n.code,{children:\"Auth.js\"}),\" to your project.\"]}),(0,e.jsx)(n.figure,{\"data-rehype-pretty-code-figure\":\"\",children:(0,e.jsx)(n.pre,{style:{backgroundColor:\"#24292e\",color:\"#e1e4e8\"},tabIndex:\"0\",\"data-language\":\"tsx\",\"data-theme\":\"github-dark\",__rawString__:`import { SignUpForm } from '@/components/auth/sign-up-form'\n\nexport default function SignUp() {\n return (\n
\n \n
\n )\n}\n`,children:(0,e.jsxs)(n.code,{\"data-line-numbers\":\"\",\"data-language\":\"tsx\",\"data-theme\":\"github-dark\",style:{display:\"grid\"},\"data-line-numbers-max-digits\":\"1\",children:[(0,e.jsxs)(n.span,{className:\"line--highlighted\",\"data-line\":\"\",\"data-highlighted-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"import\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" { SignUpForm } \"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"from\"}),(0,e.jsx)(n.span,{style:{color:\"#9ECBFF\"},children:\" '@/components/auth/sign-up-form'\"})]}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:\" \"}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\"export\"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" default\"}),(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" function\"}),(0,e.jsx)(n.span,{style:{color:\"#B392F0\"},children:\" SignUp\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\"() {\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#F97583\"},children:\" return\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" (\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" <\"}),(0,e.jsx)(n.span,{style:{color:\"#85E89D\"},children:\"div\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\">\"})]}),`\n`,(0,e.jsxs)(n.span,{className:\"line--highlighted\",\"data-line\":\"\",\"data-highlighted-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" <\"}),(0,e.jsx)(n.span,{style:{color:\"#79B8FF\"},children:\"SignUpForm\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" />\"})]}),`\n`,(0,e.jsxs)(n.span,{\"data-line\":\"\",children:[(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" \"}),(0,e.jsx)(n.span,{style:{color:\"#85E89D\"},children:\"div\"}),(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\">\"})]}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\" )\"})}),`\n`,(0,e.jsx)(n.span,{\"data-line\":\"\",children:(0,e.jsx)(n.span,{style:{color:\"#E1E4E8\"},children:\"}\"})})]})})})]})]})}function p(a={}){let{wrapper:n}=a.components||{};return n?(0,e.jsx)(n,{...a,children:(0,e.jsx)(s,{...a})}):s(a)}function h(a,n){throw new Error(\"Expected \"+(n?\"component\":\"object\")+\" `\"+a+\"` to be defined: you likely forgot to import, pass, or provide it.\")}return f(F);})();\n;return Component;"
- }
- }
-]
\ No newline at end of file
diff --git a/.content-collections/generated/allPages.js b/.content-collections/generated/allPages.js
deleted file mode 100644
index 4b90925..0000000
--- a/.content-collections/generated/allPages.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-export default []
\ No newline at end of file
diff --git a/.content-collections/generated/allShowcases.js b/.content-collections/generated/allShowcases.js
deleted file mode 100644
index 4b90925..0000000
--- a/.content-collections/generated/allShowcases.js
+++ /dev/null
@@ -1,2 +0,0 @@
-
-export default []
\ No newline at end of file
diff --git a/.content-collections/generated/index.d.ts b/.content-collections/generated/index.d.ts
deleted file mode 100644
index 9c6e024..0000000
--- a/.content-collections/generated/index.d.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import configuration from "../../content-collections.ts";
-import { GetTypeByName } from "@content-collections/core";
-
-export type Doc = GetTypeByName;
-export declare const allDocs: Array;
-
-export type Page = GetTypeByName;
-export declare const allPages: Array;
-
-export type Showcase = GetTypeByName;
-export declare const allShowcases: Array;
-
-export {};
diff --git a/.content-collections/generated/index.js b/.content-collections/generated/index.js
deleted file mode 100644
index bdae159..0000000
--- a/.content-collections/generated/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// generated by content-collections at Wed Jan 08 2025 13:32:25 GMT-0500 (Eastern Standard Time)
-
-import allDocs from "./allDocs.js";
-import allPages from "./allPages.js";
-import allShowcases from "./allShowcases.js";
-
-export { allDocs, allPages, allShowcases };
diff --git a/.gitignore b/.gitignore
index 674c0aa..94de876 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,7 @@
!.env.example
# dependencies
-/node_modules
+**/node_modules
/.pnp
.pnp.*
.yarn/*
@@ -21,10 +21,12 @@
# production
/build
+**/dist/
# misc
.DS_Store
*.pem
+.content-collections/
# debug
npm-debug.log*
diff --git a/core/auth/actions/admin.ts b/core/auth/actions/admin.ts
new file mode 100644
index 0000000..7c2011d
--- /dev/null
+++ b/core/auth/actions/admin.ts
@@ -0,0 +1,14 @@
+"use server";
+
+import { currentRole } from "@/lib/auth";
+import { UserRole } from "@prisma/client";
+
+export const admin = async () => {
+ const role = await currentRole();
+
+ if (role === UserRole.ADMIN) {
+ return { success: "Allowed Server Action!" };
+ }
+
+ return { error: "Forbidden Server Action!" }
+};
\ No newline at end of file
diff --git a/core/auth/actions/login.ts b/core/auth/actions/login.ts
new file mode 100644
index 0000000..919438b
--- /dev/null
+++ b/core/auth/actions/login.ts
@@ -0,0 +1,102 @@
+"use server";
+
+import * as z from "zod";
+import * as bcrypt from "bcrypt";
+
+import { db } from "@/lib/db";
+import { signIn } from "@/auth";
+import { LoginSchema } from "@/schemas";
+import { getUserByEmail } from "@/data/user";
+import { getTwoFactorTokenByEmail } from "@/data/two-factor-token";
+import { sendVerificationEmail, sendTwoFactorTokenEmail } from "@/lib/mail";
+import { DEFAULT_LOGIN_REDIRECT } from "../routes";
+import {
+ generateVerificationToken,
+ generateTwoFactorToken,
+} from "../lib/token";
+import { getTwoFactorConfirmationByUserId } from "@/data/two-factor-confirmation";
+
+export const login = async (
+ values: z.infer,
+ callbackUrl?: string | null,
+ twoFactorEnabled?: boolean
+) => {
+ const validatedFields = LoginSchema.safeParse(values);
+
+ if (!validatedFields.success) {
+ return { error: "Invalid fields!" };
+ }
+
+ const { email, password, code } = validatedFields.data;
+
+ const existingUser = await getUserByEmail(email);
+
+ if (!existingUser || !existingUser.email || !existingUser.password) {
+ return { error: "Email does not exist!" };
+ }
+
+ const passwordsMatch = await bcrypt.compare(password, existingUser.password);
+
+ if (!passwordsMatch) {
+ return { error: "Invalid credentials!" };
+ }
+
+ if (!existingUser.emailVerified) {
+ const verificationToken = await generateVerificationToken(
+ existingUser.email
+ );
+ await sendVerificationEmail(
+ verificationToken.email,
+ verificationToken.token
+ );
+ return { success: "Confirmation email sent!" };
+ }
+
+ // Only proceed with 2FA if enabled via prop
+ if (twoFactorEnabled) {
+ if (code) {
+ const twoFactorToken = await getTwoFactorTokenByEmail(existingUser.email);
+
+ if (!twoFactorToken || twoFactorToken.token !== code) {
+ return { error: "Invalid 2FA code!" };
+ }
+
+ const hasExpired = new Date(twoFactorToken.expires) < new Date();
+
+ if (hasExpired) {
+ return { error: "2FA code has expired!" };
+ }
+
+ await db.twoFactorToken.delete({
+ where: { id: twoFactorToken.id },
+ });
+
+ await db.twoFactorConfirmation.upsert({
+ where: {
+ userId: existingUser.id,
+ },
+ update: {},
+ create: {
+ userId: existingUser.id,
+ },
+ });
+ } else {
+ const twoFactorToken = await generateTwoFactorToken(existingUser.email);
+ await sendTwoFactorTokenEmail(twoFactorToken.email, twoFactorToken.token);
+ return { twoFactor: true };
+ }
+ }
+
+ try {
+ await signIn("credentials", {
+ email,
+ password,
+ redirect: false,
+ });
+
+ return { success: "Logged in successfully!" };
+ } catch (error) {
+ console.error("Login error:", error);
+ return { error: "Something went wrong!" };
+ }
+};
diff --git a/core/auth/actions/logout.ts b/core/auth/actions/logout.ts
new file mode 100644
index 0000000..252bc7f
--- /dev/null
+++ b/core/auth/actions/logout.ts
@@ -0,0 +1,7 @@
+"use server";
+
+import { signOut } from "@/auth";
+
+export const logout = async () => {
+ await signOut();
+};
\ No newline at end of file
diff --git a/core/auth/actions/new-password.ts b/core/auth/actions/new-password.ts
new file mode 100644
index 0000000..5509b60
--- /dev/null
+++ b/core/auth/actions/new-password.ts
@@ -0,0 +1,57 @@
+"use server";
+
+import * as z from "zod";
+import bcrypt from "bcryptjs";
+
+import { NewPasswordSchema } from "@/schemas";
+import { getPasswordResetTokenByToken } from "@/data/password-reset-token";
+import { getUserByEmail } from "@/data/user";
+import { db } from "@/lib/db";
+
+export const newPassword = async (
+ values: z.infer ,
+ token?: string | null,
+) => {
+ if (!token) {
+ return { error: "Missing token!" };
+ }
+
+ const validatedFields = NewPasswordSchema.safeParse(values);
+
+ if (!validatedFields.success) {
+ return { error: "Invalid fields!" };
+ }
+
+ const { password } = validatedFields.data;
+
+ const existingToken = await getPasswordResetTokenByToken(token);
+
+ if (!existingToken) {
+ return { error: "Invalid token!" };
+ }
+
+ const hasExpired = new Date(existingToken.expires) < new Date();
+
+ if (hasExpired) {
+ return { error: "Token has expired!" };
+ }
+
+ const existingUser = await getUserByEmail(existingToken.email);
+
+ if (!existingUser) {
+ return { error: "Email does not exist!" }
+ }
+
+ const hashedPassword = await bcrypt.hash(password, 10);
+
+ await db.user.update({
+ where: { id: existingUser.id },
+ data: { password: hashedPassword },
+ });
+
+ await db.passwordResetToken.delete({
+ where: { id: existingToken.id }
+ });
+
+ return { success: "Password updated!" };
+};
\ No newline at end of file
diff --git a/core/auth/actions/new-verification.ts b/core/auth/actions/new-verification.ts
new file mode 100644
index 0000000..2b6b21e
--- /dev/null
+++ b/core/auth/actions/new-verification.ts
@@ -0,0 +1,38 @@
+"use server";
+
+import { db } from "@/lib/db";
+import { getUserByEmail } from "@/data/user";
+import { getVerificationTokenByToken } from "../data/verification-token";
+
+export const newVerification = async (token: string) => {
+ const existingToken = await getVerificationTokenByToken(token);
+
+ if (!existingToken) {
+ return { error: "Token does not exist!" };
+ }
+
+ const hasExpired = new Date(existingToken.expires) < new Date();
+
+ if (hasExpired) {
+ return { error: "Token has expired!" };
+ }
+
+ const existingUser = await getUserByEmail(existingToken.email);
+
+ if (!existingUser) {
+ return { error: "Email does not exist!" };
+ }
+
+ await db.user.update({
+ where: { id: existingUser.id },
+ data: {
+ emailVerified: new Date(),
+ email: existingToken.email,
+ }
+ });
+ await db.verificationToken.delete({
+ where: { id: existingToken.id }
+ });
+
+ return { success: "Email verified!" };
+};
\ No newline at end of file
diff --git a/core/auth/actions/register.ts b/core/auth/actions/register.ts
new file mode 100644
index 0000000..3c55c76
--- /dev/null
+++ b/core/auth/actions/register.ts
@@ -0,0 +1,60 @@
+"use server";
+
+import * as z from "zod";
+import bcrypt from "bcryptjs";
+
+import { db } from "@/lib/db";
+import { RegisterSchema } from "@/schemas";
+import { getUserByEmail } from "@/data/user";
+import { sendVerificationEmail } from "@/lib/mail";
+import { generateVerificationToken } from "../lib/token";
+import { signIn } from "@/auth";
+
+export const register = async (values: z.infer) => {
+ const validatedFields = RegisterSchema.safeParse(values);
+
+ if (!validatedFields.success) {
+ return { error: "Invalid fields!" };
+ }
+
+ const { email, password, name } = validatedFields.data;
+ const hashedPassword = await bcrypt.hash(password, 10);
+
+ const existingUser = await getUserByEmail(email);
+
+ if (existingUser) {
+ return { error: "Email already in use!" };
+ }
+
+ await db.user.create({
+ data: {
+ name,
+ email,
+ password: hashedPassword,
+ },
+ });
+
+ const verificationToken = await generateVerificationToken(email);
+ await sendVerificationEmail(
+ verificationToken.email,
+ verificationToken.token,
+ );
+
+ try {
+ const signInResult = await signIn("credentials", {
+ email,
+ password,
+ redirect: false,
+ });
+
+ console.log(password)
+
+ if (signInResult?.error) {
+ return { error: "Something went wrong!" };
+ }
+ } catch (error) {
+ return { error: "Something went wrong!" };
+ }
+
+ return { success: "Confirmation email sent!" };
+};
\ No newline at end of file
diff --git a/core/auth/actions/reset.ts b/core/auth/actions/reset.ts
new file mode 100644
index 0000000..c84fd66
--- /dev/null
+++ b/core/auth/actions/reset.ts
@@ -0,0 +1,32 @@
+"use server";
+
+import * as z from "zod";
+
+import { ResetSchema } from "@/schemas";
+import { getUserByEmail } from "@/data/user";
+import { sendPasswordResetEmail } from "@/lib/mail";
+import { generatePasswordResetToken } from "../lib/token";
+
+export const reset = async (values: z.infer) => {
+ const validatedFields = ResetSchema.safeParse(values);
+
+ if (!validatedFields.success) {
+ return { error: "Invalid emaiL!" };
+ }
+
+ const { email } = validatedFields.data;
+
+ const existingUser = await getUserByEmail(email);
+
+ if (!existingUser) {
+ return { error: "Email not found!" };
+ }
+
+ const passwordResetToken = await generatePasswordResetToken(email);
+ await sendPasswordResetEmail(
+ passwordResetToken.email,
+ passwordResetToken.token,
+ );
+
+ return { success: "Reset email sent!" };
+}
\ No newline at end of file
diff --git a/core/auth/actions/settings.ts b/core/auth/actions/settings.ts
new file mode 100644
index 0000000..f7373e0
--- /dev/null
+++ b/core/auth/actions/settings.ts
@@ -0,0 +1,89 @@
+"use server";
+
+import * as z from "zod";
+import bcrypt from "bcryptjs";
+
+import { update } from "@/auth";
+import { db } from "@/lib/db";
+import { SettingsSchema } from "@/schemas";
+import { getUserByEmail, getUserById } from "@/data/user";
+import { currentUser } from "@/lib/auth";
+import { generateVerificationToken } from "@/lib/token";
+import { sendVerificationEmail } from "@/lib/mail";
+
+export const settings = async (
+ values: z.infer
+ ) => {
+ const user = await currentUser();
+
+ if (!user) {
+ return { error: "Unauthorized" }
+ }
+
+ const dbUser = await getUserById(user.id);
+
+ if (!dbUser) {
+ return { error: "Unauthorized" }
+ }
+
+ if (user.isOAuth) {
+ values.email = undefined;
+ values.password = undefined;
+ values.newPassword = undefined;
+ values.isTwoFactorEnabled = undefined;
+ }
+
+ if (values.email && values.email !== user.email) {
+ const existingUser = await getUserByEmail(values.email);
+
+ if (existingUser && existingUser.id !== user.id) {
+ return { error: "Email already in use!" }
+ }
+
+ const verificationToken = await generateVerificationToken(
+ values.email
+ );
+ await sendVerificationEmail(
+ verificationToken.email,
+ verificationToken.token,
+ );
+
+ return { success: "Verification email sent!" };
+ }
+
+ if (values.password && values.newPassword && dbUser.password) {
+ const passwordsMatch = await bcrypt.compare(
+ values.password,
+ dbUser.password,
+ );
+
+ if (!passwordsMatch) {
+ return { error: "Incorrect password!" };
+ }
+
+ const hashedPassword = await bcrypt.hash(
+ values.newPassword,
+ 10,
+ );
+ values.password = hashedPassword;
+ values.newPassword = undefined;
+ }
+
+ const updatedUser = await db.user.update({
+ where: { id: dbUser.id },
+ data: {
+ ...values,
+ }
+ });
+
+ update({
+ user: {
+ name: updatedUser.name,
+ email: updatedUser.email,
+ isTwoFactorEnabled: updatedUser.isTwoFactorEnabled,
+ role: updatedUser.role,
+ }
+ });
+
+ return { success: "Settings Updated!" }
+ }
\ No newline at end of file
diff --git a/core/auth/app/api/admin/route.ts b/core/auth/app/api/admin/route.ts
new file mode 100644
index 0000000..7a460e9
--- /dev/null
+++ b/core/auth/app/api/admin/route.ts
@@ -0,0 +1,13 @@
+import { currentRole } from "@/lib/auth";
+import { UserRole } from "@prisma/client";
+import { NextResponse } from "next/server";
+
+export async function GET() {
+ const role = await currentRole();
+
+ if (role === UserRole.ADMIN) {
+ return new NextResponse(null, { status: 200 });
+ }
+
+ return new NextResponse(null, { status: 403 });
+}
diff --git a/core/auth/app/api/auth/[...nextauth]/route.ts b/core/auth/app/api/auth/[...nextauth]/route.ts
new file mode 100644
index 0000000..5acc419
--- /dev/null
+++ b/core/auth/app/api/auth/[...nextauth]/route.ts
@@ -0,0 +1 @@
+export { GET, POST } from "@/auth";
\ No newline at end of file
diff --git a/core/auth/auth.config.ts b/core/auth/auth.config.ts
new file mode 100644
index 0000000..dc443a4
--- /dev/null
+++ b/core/auth/auth.config.ts
@@ -0,0 +1,39 @@
+import bcrypt from 'bcryptjs';
+import type { NextAuthConfig } from 'next-auth';
+import Credentials from 'next-auth/providers/credentials';
+import Github from 'next-auth/providers/github';
+import Google from 'next-auth/providers/google';
+
+import { LoginSchema } from '@/schemas';
+import { getUserByEmail } from '@/data/user';
+
+export default {
+ providers: [
+ Google({
+ clientId: process.env.GOOGLE_CLIENT_ID,
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET,
+ }),
+ Github({
+ clientId: process.env.GITHUB_CLIENT_ID,
+ clientSecret: process.env.GITHUB_CLIENT_SECRET,
+ }),
+ Credentials({
+ async authorize(credentials) {
+ const validatedFields = LoginSchema.safeParse(credentials);
+
+ if (validatedFields.success) {
+ const { email, password } = validatedFields.data;
+
+ const user = await getUserByEmail(email);
+ if (!user || !user.password) return null;
+
+ const passwordsMatch = await bcrypt.compare(password, user.password);
+
+ if (passwordsMatch) return user;
+ }
+
+ return null;
+ },
+ }),
+ ],
+} satisfies NextAuthConfig;
diff --git a/core/auth/auth.ts b/core/auth/auth.ts
new file mode 100644
index 0000000..b3a11bc
--- /dev/null
+++ b/core/auth/auth.ts
@@ -0,0 +1,80 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import NextAuth from "next-auth";
+import { UserRole } from "@prisma/client";
+import { PrismaAdapter } from "@auth/prisma-adapter";
+
+import { db } from "@/lib/db";
+import authConfig from "@/auth.config";
+import { getUserById } from "@/data/user";
+import { getTwoFactorConfirmationByUserId } from "@/data/two-factor-confirmation";
+import { getAccountByUserId } from "./data/account";
+
+export const {
+ handlers: { GET, POST },
+ auth,
+ signIn,
+ signOut,
+ update,
+} = NextAuth({
+ pages: {
+ signIn: "/auth/login",
+ error: "/auth/error",
+ },
+ events: {
+ async linkAccount({ user }: any) {
+ await db.user.update({
+ where: { id: user.id },
+ data: { emailVerified: new Date() },
+ });
+ },
+ },
+ callbacks: {
+ async signIn({ account }: any) {
+
+ if (account?.provider !== "credentials") return true;
+
+ return true;
+ },
+ async session({ token, session }: any) {
+ if (token.sub && session.user) {
+ session.user.id = token.sub;
+ }
+
+ if (token.role && session.user) {
+ session.user.role = token.role as UserRole;
+ }
+
+ if (session.user) {
+ session.user.isTwoFactorEnabled = token.isTwoFactorEnabled as boolean;
+ }
+
+ if (session.user) {
+ session.user.name = token.name;
+ session.user.email = token.email;
+ session.user.isOAuth = token.isOAuth as boolean;
+ }
+
+ return session;
+ },
+ async jwt({ token }: any) {
+ if (!token.sub) return token;
+
+ const existingUser = await getUserById(token.sub);
+
+ if (!existingUser) return token;
+
+ const existingAccount = await getAccountByUserId(existingUser.id);
+
+ token.isOAuth = !!existingAccount;
+ token.name = existingUser.name;
+ token.email = existingUser.email;
+ token.role = existingUser.role;
+ token.isTwoFactorEnabled = existingUser.isTwoFactorEnabled;
+
+ return token;
+ },
+ },
+ adapter: PrismaAdapter(db),
+ session: { strategy: "jwt" },
+ ...authConfig,
+});
diff --git a/core/auth/components/auth/auth.tsx b/core/auth/components/auth/auth.tsx
new file mode 100644
index 0000000..4eb0969
--- /dev/null
+++ b/core/auth/components/auth/auth.tsx
@@ -0,0 +1,601 @@
+/* eslint-disable @typescript-eslint/no-unused-vars */
+"use client";
+
+import * as z from "zod";
+import { useCallback, useEffect, useState, useTransition } from "react";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+
+import {
+ LoginSchema,
+ NewPasswordSchema,
+ RegisterSchema,
+ ResetSchema,
+} from "@/schemas";
+import { Input } from "@/components/ui/input";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Button } from "@/components/ui/button";
+import { register } from "@/actions/register";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
+import { useSearchParams } from "next/navigation";
+import { DEFAULT_LOGIN_REDIRECT } from "@/routes";
+import { signIn } from "@/auth";
+import { FaGithub, FaGoogle, FaUser } from "react-icons/fa";
+import { login } from "@/actions/login";
+import Link from "next/link";
+import { reset } from "@/actions/reset";
+import { newVerification } from "@/actions/new-verification";
+import { BeatLoader } from "react-spinners";
+import { newPassword } from "@/actions/new-password";
+import { useCurrentUser } from "@/hooks/use-current-user";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
+import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
+import { logout } from "@/actions/logout";
+import { toast } from "sonner";
+import { useSession } from "next-auth/react";
+
+export const SignUp = ({
+ google,
+ github,
+}: {
+ google?: boolean;
+ github?: boolean;
+}) => {
+ const [error, setError] = useState("");
+ const [success, setSuccess] = useState("");
+ const [isPending, startTransition] = useTransition();
+
+ const form = useForm>({
+ resolver: zodResolver(RegisterSchema),
+ defaultValues: {
+ email: "",
+ password: "",
+ name: "",
+ },
+ });
+
+ const onSubmit = (values: z.infer) => {
+ setError("");
+ setSuccess("");
+
+ startTransition(() => {
+ register(values).then((data) => {
+ if (data.error) {
+ setError(data.error);
+ toast.error(data.error);
+ }
+ if (data.success) {
+ form.reset();
+ setSuccess(data.success);
+ toast.success(data.success);
+ }
+ });
+ });
+ };
+
+ return (
+
+
+ Create an account
+ Enter your email to access.
+
+
+
+
+
+ {(google || github) && (
+