Tools/aidenybai/cnfast

cnfast

Fast drop in replacement for `cn`

1.2k+8/wkemergingTypeScriptnew this week

The Lens

By Erik Loyd, SaaS CEO and former COO/CFO of an AWS Premier Partner.

Updated Jun 2026

cnfast does the same job as the `cn` helper in every shadcn/ui project: it merges Tailwind class names so the right utility wins when two conflict (the thing that lets `p-2` and `p-4` resolve cleanly instead of fighting). It rolls clsx and tailwind-merge into one package and runs them faster, around 3.8x on average and up to 7x in component-heavy code, with byte-identical output. MIT-licensed, free, on npm.

Nothing to operate. It's a dependency. The speed comes from caching and a tagged-template syntax, and since the output matches tailwind-merge exactly, swapping it in is a find-and-replace on your import. There's a shadcn registry entry if you want it dropped straight into an existing project.

Solo: install it if className merging shows up in your render profiles, otherwise the default cn is fine. Small teams: low-risk swap, do it once and forget it. Large teams: the per-call savings add up across thousands of components, and the zero-breaking-change promise makes it an easy approval.

The catch: this solves a problem most apps don't have. className merge time is rarely your bottleneck, and adding a dependency to shave microseconds off something you never measured is premature optimization. Profile first. If clsx plus tailwind-merge isn't showing up, you don't need this.

Free vs Self-Hosted vs Paid

fully free

Free

The entire package. cnfast is MIT-licensed and published to npm. You get cn, clsx, twMerge, and twJoin exports, plus a shadcn/ui registry install. Byte-identical output to the tools it replaces.

Self-hosted

Not applicable. It's an npm dependency you bundle into your app.

Paid

None.

Free, MIT-licensed, and a one-command swap for the cn helper you already use.

What to do by team size

Solo
free
Small team
free
Larger team
free
Self-hosting ops:trivial

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
55/100 · C+
Adoption12/30
Maintenance21/25
Community7/20
License5/15
Analysis10/10

A low score is not a verdict on quality. Young and niche tools start low by design. How we calculate scores

Trust Signals

Notable author: 5,607 followers

License: Other

Review license manually.

Commercial use: ✗ Restricted

About

Owner
Aiden Bai (User)
Stars
1,173
Forks
14

Explore Further

More tools in the directory