Other Packages
Supporting packages that handle common tasks — type safety, icons, validation, dates, theming, and more.
Reference for the utility packages included in Catalyst.
Check here before adding a new package — it might already be included.
Type Safety
TypeScript
5.xStatic type checking for JavaScript. Catches errors at compile time and improves editor intelligence.
Configured in tsconfig.json. All Catalyst code is TypeScript.
Zod
3.xSchema validation with TypeScript inference. Define schemas, validate data, and infer types automatically.
import { z } from "zod"
const schema = z.object({
email: z.string().email(),
age: z.number().min(18),
})
type User = z.infer<typeof schema>
const result = schema.safeParse(data)Forms
React Hook Form
7.xPerformant form handling with minimal re-renders. Integrates with Zod for validation.
import { useForm } from "react-hook-form"
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema"
const form = useForm({
resolver: standardSchemaResolver(schema),
defaultValues: { email: "", age: 0 },
})
<form onSubmit={form.handleSubmit(onSubmit)}>
<input {...form.register("email")} />
{form.formState.errors.email?.message}
</form>Icons
Lucide React
latestBeautiful, consistent icons. Tree-shakeable — only imports the icons you use.
import { HomeIcon, SettingsIcon, UserIcon } from "lucide-react"
<HomeIcon className="h-5 w-5" />
<SettingsIcon className="h-5 w-5 text-muted-foreground" />Styling Utilities
class-variance-authority (CVA)
0.7.xType-safe component variants. Define variants once, get autocomplete everywhere.
import { cva } from "class-variance-authority"
const button = cva("rounded font-medium", {
variants: {
size: { sm: "px-2 py-1", md: "px-4 py-2" },
intent: { primary: "bg-primary", secondary: "bg-muted" },
},
})
<button className={button({ size: "md", intent: "primary" })} />clsx + tailwind-merge
latestClass name utilities. clsx handles conditionals, tailwind-merge resolves conflicts.
import { cn } from "@/lib/utils" // Combines both
// Merges classes, resolves conflicts
cn("p-4 bg-red-500", isActive && "bg-blue-500")
// Result: "p-4 bg-blue-500" (not both backgrounds)Dates
date-fns
4.xModern date utility library. Tree-shakeable, immutable, and TypeScript-first.
import { format, formatDistance, addDays } from "date-fns"
format(new Date(), "PPP") // "January 15, 2024"
formatDistance(date, new Date()) // "3 days ago"
addDays(new Date(), 7) // Date 7 days from nowTheming
next-themes
0.4.xSSR-safe theme switching. Handles dark mode toggle without flash of wrong theme.
import { useTheme } from "next-themes"
const { theme, setTheme } = useTheme()
<button onClick={() => setTheme(theme === "dark" ? "light" : "dark")}>
Toggle theme
</button>Content & Markdown
gray-matter
4.xParse frontmatter from Markdown. Used for reading project state and briefs.
import matter from "gray-matter"
const { data, content } = matter(fileContent)
// data = { title: "...", date: "..." }
// content = markdown bodyreact-markdown
10.xRender Markdown as React components. Supports custom renderers.
import ReactMarkdown from "react-markdown"
<ReactMarkdown>{markdownContent}</ReactMarkdown>Quick Reference
All utility packages at a glance:
TypeScriptType checking
ZodSchema validation
React Hook FormForm handling
Lucide ReactIcons
CVAComponent variants
clsx + tailwind-mergeClass utilities
date-fnsDate formatting
next-themesDark mode
gray-matterFrontmatter parsing
react-markdownMarkdown rendering
For AI Agents
Key rules:
- Use
cn()from@/lib/utilsfor class merging - Use Zod for form validation with React Hook Form
- Import only needed icons from Lucide
- Use date-fns for date operations, not native Date methods
- Check this page before adding new utility packages