This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a TanStack Router-based React application built with Vite+, TypeScript, and Tailwind CSS. The project serves as a code library viewer with Discord theme hosting capabilities, deployed to GitHub Pages.
The package manager is Bun. Use the vp CLI for day-to-day commands; vp install / vp add / vp remove delegate to Bun via packageManager.
# Install dependencies (Bun, through Vite+)
vp install
# Start development server (runs on port 3000)
vp dev
# Format, lint, and type-check
vp check
vp check --fix
# Run tests
vp test
# Build for production (Vite+ bundle + 404.html for GitHub Pages)
vp run build
# Preview production build
vp previewvp dev, vp test, vp check, vp lint, vp fmt, vp build, and vp preview are Vite+ builtins. vp run <script> runs package.json scripts (sync, build, and so on).
- File-based routing: TanStack Router manages routes as files in
src/routes/ - Root layout:
src/routes/__root.tsxprovides the application shell with sidebar navigation - Route generation: Routes are auto-generated into
src/routeTree.gen.tsby the TanStack Router plugin - New routes automatically generate when you create files in
src/routes/
The project uses a custom Vite plugin (codeLibraryManifestPlugin) that:
- Scans the
public/directory at build time - Generates a virtual module
virtual:code-librarycontaining file metadata - Provides manifest data including file paths, sizes, and modification times
- Auto-reloads during development when public files change
This powers the code library viewer functionality by exposing public/ directory contents to the application.
src/lib/library.ts: Consumes the virtual module manifest and enriches it with metadatasrc/data/library-metadata.ts: Contains display metadata (titles, descriptions, language labels) for assets and folders- The system organizes files into hierarchical folder groups for navigation
src/components/code-file-viewer.tsx:
- Uses Shiki for syntax highlighting with theme support
- Dynamically imports Shiki to avoid bundle bloat
- Adapts to light/dark mode from the theme provider
- Supports copying code and raw file URLs
- Extracts background/foreground colors from Shiki output for seamless integration
src/components/theme-provider.tsx: Provides dark/light/system theme context- Theme preference persisted to localStorage with key
vite-ui-theme - Mode toggle component available at
src/components/mode-toggle.tsx
- Located in
src/components/ui/ - Uses Radix UI primitives with custom styling
- Tailwind CSS v4 for styling
- Class variance authority (CVA) for component variants
cn()utility fromsrc/lib/utils.tsmerges Tailwind classes
vp run build runs two steps:
vp build- Bundles the application with Vite+node scripts/copy-404.mjs- Copiesdist/index.htmltodist/404.htmlfor GitHub Pages client-side routing support
Type-checking lives in vp check (Oxlint + tsgo), not in the production build.
- Deploys to GitHub Pages via
.github/workflows/deploy.yml - Triggered on pushes to
masterbranch - Uses
voidzero-dev/setup-vpand Bun (packageManager:bun@1.4.0) - Artifacts uploaded from
./distdirectory
When adding new routes:
- Create a new
.tsxfile insrc/routes/ - Use
createFileRoute()to define the route - TanStack Router will auto-generate the route configuration
- Add navigation links using
<Link to="/route-path">from@tanstack/react-router
Example route structure:
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/your-route')({
component: YourComponent,
})
function YourComponent() {
return <div>Your content</div>
}The /discord-themes route demonstrates the code library viewer:
- Fetches files from
public/discord/themes/ - Uses the library system to organize and display theme files
- Renders CSS files with syntax highlighting
- Provides copy and download functionality
The @/ alias resolves to ./src/ for cleaner imports:
import { cn } from '@/lib/utils'
import { Button } from '@/components/ui/button'- Vitest is bundled with Vite+ (
vp test) and configured with jsdom - React Testing Library available for component tests
- Tests run in globals mode (no need to import
describe,it,expect) - Import test APIs from
vite-plus/testwhen you need explicit imports