import Image from 'next/image' import Link from 'next/link' import { Bot, Terminal, Settings2, Code, Search, Plug, Brain, Globe, ShieldCheck, ArrowRight, Github, Star, MessageSquare, } from 'lucide-react' import { HomeLayout } from 'fumadocs-ui/layouts/home' import { baseOptions } from '@/app/layout.config' import type { Metadata } from 'next' import DemoImageDark from '@/components/home/img/demo_dark.png' import DemoImageLight from '@/components/home/img/demo_light.png' import DemoImageMobileDark from '@/components/home/img/demo_mobile_dark.png' import DemoImageMobileLight from '@/components/home/img/demo_mobile_light.png' import FooterMenu from '@/components/FooterMenu' export const metadata: Metadata = { title: 'LibreChat - The Open-Source AI Platform', description: 'LibreChat brings together all your AI conversations in one unified, customizable interface.', } /* --------------------------------------------------------------------------- * Data fetching (server-side, cached) * --------------------------------------------------------------------------- */ async function getGitHubData(): Promise<{ stars: number; contributors: number }> { try { const [repoRes, contribRes] = await Promise.all([ fetch('https://api.github.com/repos/danny-avila/LibreChat', { next: { revalidate: 3600 }, }), fetch( 'https://api.github.com/repos/danny-avila/LibreChat/contributors?per_page=1&anon=true', { next: { revalidate: 3600 } }, ), ]) const repoData = repoRes.ok ? await repoRes.json() : {} const stars = repoData.stargazers_count ?? 0 let contributors = 0 if (contribRes.ok) { const linkHeader = contribRes.headers.get('link') if (linkHeader) { const match = linkHeader.match(/page=(\d+)>;\s*rel="last"/) contributors = match ? parseInt(match[1], 10) : 0 } } return { stars, contributors } } catch { return { stars: 0, contributors: 0 } } } const DOCKER_HUB_REPOS = [ 'librechat/librechat', 'librechat/librechat-api', 'librechat/librechat-dev', 'librechat/librechat-dev-api', 'librechat/lc-dev', 'librechat/lc-dev-api', ] const GHCR_PACKAGES = ['librechat', 'librechat-api', 'librechat-dev', 'librechat-dev-api'] async function getDockerHubPulls(repo: string): Promise { try { const res = await fetch(`https://hub.docker.com/v2/repositories/${repo}/`, { next: { revalidate: 3600 }, }) if (!res.ok) return 0 const data = await res.json() return data.pull_count ?? 0 } catch { return 0 } } async function getGhcrDownloads(pkg: string): Promise { try { const res = await fetch(`https://github.com/danny-avila/LibreChat/pkgs/container/${pkg}`, { next: { revalidate: 3600 }, }) if (!res.ok) return 0 const html = await res.text() const match = html.match(/Total downloads[\s\S]*?title="(\d+)"/) return match ? parseInt(match[1], 10) : 0 } catch { return 0 } } async function getContainerPulls(): Promise { const [dockerHubCounts, ghcrCounts] = await Promise.all([ Promise.all(DOCKER_HUB_REPOS.map(getDockerHubPulls)), Promise.all(GHCR_PACKAGES.map(getGhcrDownloads)), ]) return [...dockerHubCounts, ...ghcrCounts].reduce((sum, n) => sum + n, 0) } /* --------------------------------------------------------------------------- * Helpers * --------------------------------------------------------------------------- */ function formatNumber(num: number): string { if (num >= 1_000_000) { return `${(num / 1_000_000).toFixed(1).replace(/\.0$/, '')}M` } if (num >= 1_000) { return `${(num / 1_000).toFixed(1).replace(/\.0$/, '')}k` } return num.toString() } /* --------------------------------------------------------------------------- * Company logos data * --------------------------------------------------------------------------- */ const companies = [ { name: 'Shopify', logoLight: '/images/logos/Shopify_light.svg', logoDark: '/images/logos/Shopify_dark.svg', isSvg: true, height: 'h-12', imgHeight: 48, }, { name: 'Daimler Truck', logoLight: '/images/logos/DaimlerTruck_light.svg', logoDark: '/images/logos/DaimlerTruck_dark.svg', isSvg: true, height: 'h-6', imgHeight: 24, }, { name: 'Boston University', logoLight: '/images/logos/BostonUniversity_light.png', logoDark: '/images/logos/BostonUniversity_dark.png', isSvg: false, height: 'h-12', imgHeight: 48, }, { name: 'ClickHouse', logoLight: '/images/logos/ClickHouse_light.svg', logoDark: '/images/logos/ClickHouse_dark.svg', isSvg: true, height: 'h-14', imgHeight: 56, }, ] /* --------------------------------------------------------------------------- * Features data * --------------------------------------------------------------------------- */ const features = [ { icon: Bot, title: 'Agents', description: 'Advanced agents with file handling, code interpretation, and API actions', href: '/docs/features/agents', }, { icon: Terminal, title: 'Code Interpreter', description: 'Execute code in multiple languages securely with zero setup', href: '/docs/features/code_interpreter', }, { icon: Settings2, title: 'Models', description: 'AI model selection including Anthropic, AWS, OpenAI, Azure, and more', href: '/docs/configuration/pre_configured_ai', }, { icon: Code, title: 'Artifacts', description: 'Create React, HTML code, and Mermaid diagrams in chat', href: '/docs/features/artifacts', }, { icon: Search, title: 'Search', description: 'Search for messages, files, and code snippets in an instant', href: '/docs/configuration/meilisearch', }, { icon: Plug, title: 'MCP', description: 'Connect to any tool or service with Model Context Protocol support', href: '/docs/features/mcp', }, { icon: Brain, title: 'Memory', description: 'Persistent context across conversations so your AI remembers you', href: '/docs/features/memory', }, { icon: Globe, title: 'Web Search', description: 'Give any model live internet access with built-in search and reranking', href: '/docs/features/web_search', }, { icon: ShieldCheck, title: 'Authentication', description: 'Enterprise-ready SSO with OAuth, SAML, LDAP, and two-factor auth', href: '/docs/configuration/authentication', }, ] /* --------------------------------------------------------------------------- * Hero Section * --------------------------------------------------------------------------- */ function HeroSection({ stars }: { stars: number }) { return (
{/* GitHub stars badge */} {stars > 0 && ( )}

The Open-Source
AI Platform

LibreChat brings together all your AI conversations in one unified, customizable interface

{/* CTAs */}
{/* Demo screenshot */}
{/* Desktop */}
LibreChat desktop interface in light mode LibreChat desktop interface in dark mode
{/* Mobile */}
LibreChat mobile interface in light mode LibreChat mobile interface in dark mode
) } /* --------------------------------------------------------------------------- * Trusted By Section * --------------------------------------------------------------------------- */ function TrustedBySection() { return (

Trusted by companies worldwide

{companies.map((company) => (
{/* Light mode logo */} {`${company.name} {/* Dark mode logo */} {`${company.name}
))}
) } /* --------------------------------------------------------------------------- * Features Section * --------------------------------------------------------------------------- */ function FeaturesSection() { return (

Everything you need

A comprehensive platform for AI-powered conversations

{features.map((feature) => { const Icon = feature.icon return (
) })}
) } /* --------------------------------------------------------------------------- * Community Section * --------------------------------------------------------------------------- */ function CommunitySection({ stars, pulls, contributors, }: { stars: number pulls: number contributors: number }) { return (

Open source, community driven

Join thousands of developers and organizations building with LibreChat

{/* Stats */}

{stars > 0 ? formatNumber(stars) : '--'}

GitHub Stars

{pulls > 0 ? formatNumber(pulls) : '--'}

Docker Pulls

{contributors > 0 ? formatNumber(contributors) : '--'}

Contributors

{/* Links */}
) } /* --------------------------------------------------------------------------- * CTA Section * --------------------------------------------------------------------------- */ function CTASection() { return (

Start building with LibreChat

Get up and running in minutes with our quickstart guide

Quickstart Guide
) } /* --------------------------------------------------------------------------- * Page Component * --------------------------------------------------------------------------- */ export default async function HomePage() { const [{ stars, contributors }, pulls] = await Promise.all([getGitHubData(), getContainerPulls()]) return (
) }