🚀 A CLI tool to quickly create a custom structured React application with TypeScript and Vite, following a Custom Component-Page-Service architecture pattern.
- ⚡️ Vite-powered - Lightning fast development server and optimized builds
- 🧩 TypeScript - Type safety and better developer experience
- 📁 Custom Structure - Organized folder structure with components, pages, and services
- 🎨 SCSS Support - Enhanced styling capabilities with Sass
- 🌓 Theme Switching - Built-in light/dark mode with theme service
- 🧭 React Router - Configured routing with strict mode and navigation
- 🔧 ESLint - Code quality and consistency
- 🔄 Auto-merging - Automatically merges scripts and dependencies into your project's
package.json
You don't need to install it globally — just use npx:
npx @imprakhartripathi/reactron initOr install globally:
npm install -g @imprakhartripathi/reactron
reactron initRun inside an empty directory (or an existing React project):
# Create a new directory for your project
mkdir my-react-app
cd my-react-app
# Initialize a new React app with Reactron
npx @imprakhartripathi/reactron init
# Install dependencies
npm install
# Start the development server
npm run devThis will:
- Copy the React template into your current directory.
- Merge the template's
scripts,dependencies, anddevDependenciesinto your project's rootpackage.json. - Leave you ready to go with a working React setup.
After initialization, you'll have these scripts in your package.json:
{
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
}
}Reactron creates a project with the following structure:
my-reactron-app/
├── public/
│ └── vite.svg
├── src/
│ ├── app/
│ │ ├── components/
│ │ │ ├── homepage/
│ │ │ │ ├── homepage.component.scss
│ │ │ │ └── homepage.component.tsx
│ │ │ └── navigation/
│ │ │ ├── navigation.component.scss
│ │ │ └── navigation.component.tsx
│ │ ├── pages/
│ │ │ └── welcome/
│ │ │ ├── welcome.scss
│ │ │ └── welcome.tsx
│ │ └── services/
│ │ └── theme/
│ │ └── theme.service.tsx
│ ├── assets/
│ │ └── react.svg
│ ├── App.scss
│ ├── App.tsx
│ ├── index.scss
│ ├── main.tsx
│ └── router.tsx
├── index.html
├── package.json
├── tsconfig.json
├── tsconfig.node.json
└── vite.config.ts
The template includes a built-in theme service that provides light and dark mode functionality:
// Using the theme service
import { useTheme } from './app/services/theme/theme.service';
function MyComponent() {
const { theme, toggleTheme } = useTheme();
return (
<div>
<p>Current theme: {theme}</p>
<button onClick={toggleTheme}>Toggle Theme</button>
</div>
);
}The application comes with pre-configured React Router:
// Adding a new route in router.tsx
{
path: 'about',
element: <AboutPage />,
}The template uses SCSS for styling. Global styles are defined in src/index.scss, and component-specific styles are in their respective .scss files.
- Create a new directory in
src/app/components/orsrc/app/pages/ - Add your component files (e.g.,
my-component.component.tsxandmy-component.component.scss) - Import and use your component where needed
- Create a new directory in
src/app/services/ - Add your service file (e.g.,
my-service.service.tsx) - Import and use your service where needed
- React 19
- TypeScript
- Vite 7
- React Router 6
- SCSS/Sass
- ESLint 9
- The template includes the latest React 19 and Vite 7
MIT © Prakhar Tripathi