i made a cli tool to clean the next.js boilerplate

bhaskar rijal / 30.01.2026

Cover Image for I made a CLI tool to clean the Next.js boilerplate

It happens every single time I run the Next.js install command. I open the project and spend the first few minutes just gutting the default files. I delete the logos in the public folder, wipe the main page file completely blank and maybe cleanup the CSS file too. I just prefer starting from absolute zero because every new idea deserves a clean start without looking at the same boilerplate demo I have seen a thousand times.

It's maybe two minutes of work. But when you are initiating projects all the time, those two minutes add up pretty fast. It's more of the mental drain of knowing you have to do boring setup tasks before you can write any real code.

That is the reason I made this tool which allows you to run one command and get a blank canvas of a project.

What it does

npx next-cleaner

That's it. It detects your Next.js project, asks what you want removed, and cleans it out.

By default it handles:

  • Demo SVGs in public/ (next.svg, vercel.svg, file.svg, globe.svg, window.svg)

  • The default favicon

  • That chunky page.tsx with all the boilerplate

You can also opt into cleaning globals.css and layout.tsx if you want to strip out the default fonts and start completely fresh.

It figures out your setup

The annoying thing about Next.js tooling is that everyone's project looks different. App Router or Pages Router. TypeScript or JavaScript. Using src/ or not.

next-cleaner detects all of this automatically. It looks for next.config.*, checks your folder structure, and adjusts accordingly. You don't have to tell it anything.

// Replaces your page with this
export default function Home() {
  return null;
}

Clean slate. Nothing to delete.

Interactive or scripted

By default it runs interactively with checkboxes amd confirmation prompt. Pretty good for when you want to pick and choose.

But if you're piping it into a setup script or just want it to shut up and clean-

npx next-cleaner -y --all

Skip the prompts, clean everything. There's also --dry-run if you want to see what it would do without actually touching files.

Stack

  • TypeScript for the source

  • Commander for CLI parsing

  • Inquirer for the interactive prompts

  • picocolors for terminal output

  • tsup for bundling

No dependencies at runtime that aren't necessary. Installs fast, runs fast.

Why not just use a custom template?

I thought about that. But templates get stale. Next.js updates, your template doesn't, now you're maintaining two things. And custom templates don't help when you're cloning a starter repo or inheriting someone else's project.

This approach is much simpler which use the official create-next-app, then clean it. You always get the latest Next.js defaults, minus the stuff you don't want.

Usage

npx next-cleaner

Or if you want it globally-

npm i -g next-cleaner

No config files. No setup. Just run it in a new Next.js project directory.


If you're tired of manually deleting the same files every time you start a project, this might save you some annoyance. It's a small tool that does one thing and that's kind of the point.