A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { NuqsAdapter } from "nuqs/adapters/next/app";
import "@karakeep/tailwind-config/globals.css";
import type { Viewport } from "next";
import React from "react";
import Providers from "@/lib/providers";
import { THEME_COLORS } from "@/lib/themeColors";
import { getUserLocalSettings } from "@/lib/userLocalSettings/userLocalSettings";
import { getServerAuthSession } from "@/server/auth";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { Toaster } from "sonner";
import { clientConfig } from "@karakeep/shared/config";
const inter = Inter({
subsets: ["latin"],
fallback: ["sans-serif"],
});
export const metadata: Metadata = {
title: "Karakeep",
applicationName: "Karakeep",
description:
"The Bookmark Everything app. Hoard links, notes, and images and they will get automatically tagged AI.",
icons: {
icon: [
{
url: "/icons/logo-icon.svg",
type: "image/svg+xml",
sizes: "any",
media: "(prefers-color-scheme: light)",
},
{
url: "/icons/logo-icon-dark.svg",
type: "image/svg+xml",
sizes: "any",
media: "(prefers-color-scheme: dark)",
},
],
apple: "/apple-icon.png",
},
appleWebApp: {
capable: true,
title: "Karakeep",
},
formatDetection: {
telephone: false,
},
};
export const viewport: Viewport = {
width: "device-width",
initialScale: 1,
maximumScale: 1,
userScalable: false,
// Values match the `--background` token in tooling/tailwind/globals.css.
// These cover the pre-hydration and no-JavaScript cases; once mounted,
// <ThemeColorSync /> updates them to follow an in-app theme override.
themeColor: [
{ media: "(prefers-color-scheme: light)", color: THEME_COLORS.light },
{ media: "(prefers-color-scheme: dark)", color: THEME_COLORS.dark },
],
};
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await getServerAuthSession();
const userSettings = await getUserLocalSettings();
const isRTL = userSettings.lang === "ar";
return (
<html
lang={userSettings.lang}
dir={isRTL ? "rtl" : "ltr"}
suppressHydrationWarning
>
<body className={inter.className}>
<NuqsAdapter>
<Providers
session={session}
clientConfig={clientConfig}
userLocalSettings={await getUserLocalSettings()}
>
{children}
<ReactQueryDevtools initialIsOpen={false} />
</Providers>
<Toaster />
</NuqsAdapter>
</body>
</html>
);
}