Prerequisites
Before installing RTO Profit Simulator, ensure you have the following:- Node.js version 18.0 or higher
- npm, yarn, or pnpm package manager
- A modern code editor (VS Code recommended)
- Git for version control
This project uses React 19 and Vite 7, which require Node.js 18+. Check your version with
node --version.Installation steps
Clone the repository
Clone the project to your local machine:The main application code lives in the
source directory.Install dependencies
Install all required packages:This installs the following key dependencies:Core:
react(19.2.0) - React frameworkreact-dom(19.2.0) - React DOM renderervite(7.3.1) - Build tool and dev server
recharts(3.7.0) - Charting library for analyticslucide-react(0.575.0) - Icon libraryreact-countup(6.5.3) - Animated number transitions
jspdf(4.2.0) - PDF generationjspdf-autotable(5.0.7) - Table formatting for PDFshtml2canvas(1.4.1) - HTML to canvas rendering
eslint(9.39.1) - Code linting@vitejs/plugin-react(5.1.1) - Vite React plugin
Start the development server
Launch the app in development mode with hot module replacement:The development server will start at
http://localhost:5173. Vite automatically opens your browser.Vite’s dev server includes hot module replacement (HMR), so changes to your code instantly reflect in the browser without full page reloads.
Verify the installation
Open your browser and navigate to
http://localhost:5173. You should see:- The RTO Profit Simulator dashboard
- Business Inputs card on the left with default values
- Financial Impact Overview showing metrics
- Charts displaying financial composition
Project structure
Understanding the codebase structure:Key files to understand
App.jsx (src/App.jsx:1)
The main application component that:
- Manages state for all business inputs
- Handles localStorage persistence
- Implements dark mode toggle
- Orchestrates PDF export functionality
- Renders all child components
src/utils/calculations.js:1)
Contains the core business logic:
src/components/InputSection.jsx:1)
Handles user input with validation:
- Text inputs with prefix/suffix formatting (₹, %)
- Real-time onChange handling
- Reset to defaults functionality
- localStorage persistence via parent component
Environment configuration
RTO Profit Simulator runs entirely client-side with no backend or environment variables required. Data persistence: The app uses browser localStorage to persist:- Business input values (key:
rtoSimulatorData) - Theme preference (key:
rtoSimulatorTheme)
src/App.jsx:26-54:
src/App.jsx:14-22:
If you want to customize these defaults for your business or region, modify the values in the
defaultData object. These will be the initial values when users first load the app.Build for production
Create production build
Build optimized static assets:This creates a
dist/ directory with:- Minified JavaScript bundles
- Optimized CSS
- Compressed assets
- Production-ready
index.html
Preview production build locally
Test the production build before deployment:This serves the
dist/ directory at http://localhost:4173.Deploy to hosting
The
dist/ folder contains static files that can be deployed to any hosting service:Recommended platforms:- Vercel - Zero-config deployment for Vite apps
- Netlify - Drag-and-drop deployment
- Cloudflare Pages - Global CDN with free tier
- GitHub Pages - Free hosting for public repos
- AWS S3 + CloudFront - Enterprise-grade hosting
dist/ to your hosting provider.Production optimization
The production build automatically includes:- Code splitting - Separate chunks for better caching
- Tree shaking - Removes unused code
- Minification - Reduces file sizes
- Asset optimization - Compresses images and fonts
- JavaScript: ~250KB gzipped
- CSS: ~15KB gzipped
- Total initial load: ~265KB
Development commands
Available npm scripts frompackage.json:
eslint-plugin-react-hooks- Enforces React Hooks ruleseslint-plugin-react-refresh- Ensures HMR compatibility
Troubleshooting
Port already in use
If port 5173 is already taken:Build errors with Node.js version
Ensure Node.js 18+:localStorage not persisting
If your inputs don’t save between sessions:- Check browser privacy settings (localStorage must be enabled)
- Ensure you’re not in incognito/private mode
- Clear browser cache and try again
Charts not rendering
If Recharts visualizations don’t appear:- Check browser console for errors
- Ensure
rechartsdependency installed correctly - Try clearing
node_modulesand reinstalling:
What’s next?
Quickstart guide
Learn how to use the calculator and interpret results
Customization
Customize default values, branding, and add new features
Understanding calculations
Deep dive into the business logic and formulas
Deployment guide
Deploy to production on Vercel, Netlify, or other platforms