DEV Community

Cover image for ๐Ÿš€ Stop Rewriting the Same React Boilerplate โ€” I Built a CLI to Fix It
Aditya Sengar
Aditya Sengar

Posted on

๐Ÿš€ Stop Rewriting the Same React Boilerplate โ€” I Built a CLI to Fix It

Every React team eventually runs into this:

  • Different folder structures across developers
  • Inconsistent naming conventions
  • Missing test files
  • Rewriting the same boilerplate again and again

And code reviews filled with:

โ€œMove this fileโ€
โ€œRename this properlyโ€
โ€œWhere is the test?โ€

At some point, I realized:

โŒ We donโ€™t have a coding problem
โœ… We have a standardization problem


๐Ÿ’ฃ Why This Actually Hurts

This slows teams down more than we think:

  • ๐Ÿšซ New developers take longer to onboard
  • ๐Ÿงฉ Codebases become inconsistent
  • ๐Ÿ” Same feedback in every PR
  • โณ Time wasted on setup instead of logic

๐Ÿ’ก So I Built Something

I created rgenex โ€” a config-driven React code generator CLI.

Define your structure once โ†’ generate consistent code across your team automatically


๐ŸŽฌ See It in Action

๐Ÿ“ฆ Install

Install


โš™๏ธ Initialize Project

Init


๐Ÿงฉ Generate Component

Generate


โšก Getting Started (Takes < 1 minute)

1. Install

npm install --save-dev rgenex
Enter fullscreen mode Exit fullscreen mode

2. Initialize

npx rgenex init
Enter fullscreen mode Exit fullscreen mode

3. Generate

npx rgenex g component Button
Enter fullscreen mode Exit fullscreen mode

๐Ÿง  The Core Idea

The real power of rgenex lies in how you use the rgenex.config.js file.

This file acts as the single source of truth for how your project should be structured.

๐Ÿงฉ Define your rules once in rgenex.config.js
๐Ÿš€ Enforce them automatically across your entire team

How it works:
You define your preferred language, styling, and testing setup
You specify where different types of files should live (components, hooks, pages, etc.)
You configure how each generator should behave (structure, test files, styles, etc.)

Once this is set up:

๐Ÿ‘‰ Every time someone runs a generator command, rgenex follows these rules
๐Ÿ‘‰ No manual decisions, no inconsistencies

This means:

โœ… Every component follows the same structure
โœ… Every file is placed in the correct location
โœ… Every developer generates code in the same way

Instead of relying on conventions that people forgetโ€ฆ

You enforce them automatically through configuration.

Example:

module.exports = {
  language: "typescript",
  styling: "scss-modules",
  testing: "vitest",

  paths: {
    components: "src/components",
    pages: "src/pages",
    hooks: "src/hooks",
  },

  generators: {
    component: {
      structure: "grouped",
      includeTest: true,
      includeStyle: true,
    },
  },
};
Enter fullscreen mode Exit fullscreen mode

โœจ What You Get

  • โšก Instant scaffolding (components, hooks, pages)
  • ๐Ÿงช Auto-generated test files
  • ๐ŸŽจ Styling support (SCSS, Tailwind, CSS)
  • ๐Ÿง  Smart project detection
  • ๐Ÿ“ฆ Zero production impact

๐ŸŽฏ Why I Built This

Iโ€™ve worked on projects where:

  • Everyone had a different way of structuring files
  • Boilerplate was repeated constantly
  • Code reviews focused on structure instead of logic

I wanted something that:

  • Enforces standards automatically
  • Saves time
  • Improves developer experience

๐Ÿš€ Try It Out

npm install --save-dev rgenex
Enter fullscreen mode Exit fullscreen mode

๐Ÿ‘‰ GitHub: https://github.com/asengar14/rgenex
๐Ÿ‘‰ npm: https://www.npmjs.com/package/rgenex


๐Ÿ”ฎ Whatโ€™s Coming Next

  • Custom generators (services, APIs, etc.)
  • Interactive CLI
  • Plugin system
  • More flexibility in templates

๐Ÿค Would Love Your Feedback

If you try it:

  • What worked well?
  • Whatโ€™s missing?
  • What would make it more useful for your team?

๐Ÿ Final Thought

We spend most of our time writing logic.

But a surprising amount of time goes into:

๐Ÿ“ Creating files
๐Ÿ“‚ Setting up folders
๐Ÿงฑ Maintaining structure

If we automate thatโ€ฆ

We can focus on what actually matters.


โœจ Built with โค๏ธ by Aditya Singh Sengar

Top comments (0)