"use client"; import { TECH_OPTIONS } from "@/lib/constant"; import { cn } from "@/lib/utils"; import discordLogo from "@/public/icon/discord.svg"; import { Check, ChevronRight, Copy, Github, Star, Terminal, } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { useEffect, useState } from "react"; import Footer from "./_components/footer"; import PackageIcon from "./_components/icons"; import Navbar from "./_components/navbar"; import NpmPackage from "./_components/npm-package"; import SponsorsSection from "./_components/sponsors-section"; import Testimonials from "./_components/testimonials"; export default function HomePage() { const [stars, setStars] = useState(null); const [isLoadingStars, setIsLoadingStars] = useState(true); const [copiedCommand, setCopiedCommand] = useState(null); const [selectedPM, setSelectedPM] = useState<"npm" | "pnpm" | "bun">("bun"); const commands = { npm: "npx create-better-t-stack@latest", pnpm: "pnpm create better-t-stack@latest", bun: "bun create better-t-stack@latest", }; useEffect(() => { async function fetchStars() { try { const response = await fetch( "https://api.github.com/repos/amanvarshney01/create-better-t-stack", ); if (response.ok) { const data = await response.json(); setStars(data.stargazers_count); } else { console.error("Failed to fetch GitHub stars"); } } catch (error) { console.error("Error fetching GitHub stars:", error); } finally { setIsLoadingStars(false); } } fetchStars(); }, []); const copyCommand = (command: string, packageManager: string) => { navigator.clipboard.writeText(command); setCopiedCommand(packageManager); setTimeout(() => setCopiedCommand(null), 2000); }; const frontendOptions = [ ...TECH_OPTIONS.webFrontend.filter((option) => option.id !== "none"), ...TECH_OPTIONS.nativeFrontend.filter((option) => option.id !== "none"), ]; const backendOptions = TECH_OPTIONS.backend.filter( (option) => option.id !== "none", ); const databaseOptions = TECH_OPTIONS.database.filter( (option) => option.id !== "none", ); const runtimeOptions = TECH_OPTIONS.runtime; const packageManagerOptions = TECH_OPTIONS.packageManager; const apiOptions = TECH_OPTIONS.api.filter((option) => option.id !== "none"); const ormOptions = TECH_OPTIONS.orm.filter((option) => option.id !== "none"); const dbSetupOptions = TECH_OPTIONS.dbSetup.filter( (option) => option.id !== "none", ); const authOptions = TECH_OPTIONS.auth.filter( (option) => option.id !== "false", ); const addonsOptions = TECH_OPTIONS.addons; const examplesOptions = TECH_OPTIONS.examples; const techStackCategories = [ { category: "Frontend", options: frontendOptions, }, { category: "Backend", options: backendOptions, }, { category: "Database", options: databaseOptions, }, { category: "Runtime", options: runtimeOptions, }, { category: "API", options: apiOptions, }, { category: "ORM", options: ormOptions, }, { category: "Database Setup", options: dbSetupOptions, }, { category: "Authentication", options: authOptions, }, { category: "Package Managers", options: packageManagerOptions, }, { category: "Addons", options: addonsOptions, }, { category: "Examples", options: examplesOptions, }, ]; return (
							{`
██████╗  ██████╗ ██╗     ██╗
██╔══██╗██╔═══██╗██║     ██║
██████╔╝██║   ██║██║     ██║
██╔══██╗██║   ██║██║     ██║
██║  ██║╚██████╔╝███████╗███████╗
╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚══════╝`}
						
							{`
██╗   ██╗ ██████╗ ██╗   ██╗██████╗
╚██╗ ██╔╝██╔═══██╗██║   ██║██╔══██╗
 ╚████╔╝ ██║   ██║██║   ██║██████╔╝
  ╚██╔╝  ██║   ██║██║   ██║██╔══██╗
   ██║   ╚██████╔╝╚██████╔╝██║  ██║
   ╚═╝    ╚═════╝  ╚═════╝ ╚═╝  ╚═╝`}
						
							{`
 ██████╗ ██╗    ██╗███╗   ██╗
██╔═══██╗██║    ██║████╗  ██║
██║   ██║██║ █╗ ██║██╔██╗ ██║
██║   ██║██║███╗██║██║╚██╗██║
╚██████╔╝╚███╔███╔╝██║ ╚████║
 ╚═════╝  ╚══╝╚══╝ ╚═╝  ╚═══╝`}
						
							{`
███████╗████████╗ █████╗  ██████╗██╗  ██╗
██╔════╝╚══██╔══╝██╔══██╗██╔════╝██║ ██╔╝
███████╗   ██║   ███████║██║     █████╔╝
╚════██║   ██║   ██╔══██║██║     ██╔═██╗
███████║   ██║   ██║  ██║╚██████╗██║  ██╗
╚══════╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝`}
						

# Modern CLI for scaffolding end-to-end type-safe TypeScript projects

# Production-ready • Customizable • Best practices included

QUICK_START
{(["bun", "pnpm", "npm"] as const).map((pm) => ( ))}
$ {commands[selectedPM]}
STACK_BUILDER.EXE

[EXEC] Interactive configuration wizard

GITHUB_REPO.GIT
{stars !== null && !isLoadingStars && (
{stars}
)}

[LINK] Star the repository on GitHub

discord DISCORD_CHAT.IRC

[JOIN] Connect to developer community

TECH_STACK_MATRIX.DB
[ {techStackCategories.reduce( (acc, cat) => acc + cat.options.length, 0, )}{" "} PACKAGES]
/tech-stack/packages/
{techStackCategories.map((category, categoryIndex) => (
{category.category.toLowerCase().replace(/\s+/g, "-")}/ ({category.options.length} items)
{category.options.map((option, optionIndex) => (
{option.icon !== "" && ( {option.name} )} {option.name.toLowerCase().replace(/\s+/g, "-")} -rw-r--r--
))}
))}
$ ls -la /tech-stack/packages/ {techStackCategories.length} directories,{" "} {techStackCategories.reduce( (acc, cat) => acc + cat.options.length, 0, )}{" "} files
SYSTEM_INFO.LOG
OS: TypeScript_Runtime_v5.x
ARCH: Full_Stack_Framework
STATUS:{" "} READY
); }