Installation
This guide provides comprehensive instructions for installing and setting up Generador QR Pro for development. Whether you’re contributing to the project or customizing it for your needs, this guide covers everything you need to know.Prerequisites
Before installing Generador QR Pro, ensure your development environment meets these requirements:Node.js and npm
Generador QR Pro requires Node.js version 16 or higher.If you don’t have Node.js installed, download it from nodejs.org. We recommend using the LTS (Long Term Support) version.
Git
You’ll need Git to clone the repository:Clone the repository
Clone the Generador QR Pro repository to your local machine:Install dependencies
Install all required npm packages using your preferred package manager:package.json, including:
Core dependencies:
react@^19.2.0- React libraryreact-dom@^19.2.0- React DOM rendererqrcode.react@^4.2.0- QR code generation librarylucide-react@^0.576.0- Icon library
vite@^7.3.1- Build tool and dev server@vitejs/plugin-react@^5.1.1- Vite plugin for Reacteslint@^9.39.1- JavaScript linter- ESLint plugins for React development
Available npm scripts
Generador QR Pro includes several npm scripts for development, building, and maintenance. All scripts are defined inpackage.json.
Development server
Start the Vite development server with hot module replacement:- Starts a local development server (usually on
http://localhost:5173) - Enables Hot Module Replacement (HMR) for instant updates
- Watches for file changes and rebuilds automatically
- Provides detailed error messages in the browser
The development server runs the
vite command, which starts the Vite dev server with all optimizations for React development.Build for production
Create an optimized production build:- Runs the
vite buildcommand - Compiles and bundles all source code
- Optimizes assets (minification, tree-shaking, code splitting)
- Outputs production-ready files to the
dist/directory
Lint code
Run ESLint to check code quality and consistency:- Runs
eslint .to check all JavaScript/JSX files - Reports code quality issues, potential bugs, and style violations
- Uses the ESLint configuration from
eslint.config.js - Includes React-specific rules via
eslint-plugin-react-hooksandeslint-plugin-react-refresh
Preview production build
Preview the production build locally:- Runs
vite previewto serve the production build - Starts a local static server for the
dist/directory - Useful for testing the production build before deployment
- Typically runs on
http://localhost:4173
Project structure
Generador QR Pro follows a standard Vite + React project structure:Key files explained
src/main.jsx
The application entry point that renders the root React component:
src/App.jsx
The root component that provides the application structure:
src/components/QRGenerator.jsx
The main component containing all QR generation logic. Key features:
- State management: Uses React hooks (
useState,useRef,useEffect) to manage QR data, customization, and active template - Four templates: URL, WiFi, vCard, and Email with dedicated input forms
- Real-time generation:
useEffecthook updates QR value whenever data or template changes - Dual rendering: Uses both
QRCodeSVG(for display and vector export) andQRCodeCanvas(for high-res PNG export) - Logo support: Allows custom logo upload with automatic Level H error correction
- Export functions:
handleDownloadPNG()andhandleDownloadSVG()for different export formats
vite.config.js
Vite configuration with React plugin:
index.html
The HTML entry point that loads the Vite/React application:
Development workflow
Here’s the recommended workflow for developing with Generador QR Pro:Make your changes
Edit files in the
src/ directory. Changes will be reflected instantly in the browser thanks to Vite’s HMR.- Component logic:
src/components/QRGenerator.jsx - Styles:
src/index.cssandsrc/App.css - App structure:
src/App.jsx
Understanding QR code generation
Generador QR Pro uses theqrcode.react library, which provides two components:
QRCodeSVG
Used for display and vector export:QRCodeCanvas
Used for high-resolution PNG export:The
excavate: true option removes QR modules behind the logo to ensure the code remains scannable. This is why Level H error correction (30%) is used with logos.Environment configuration
Generador QR Pro uses Vite’s built-in environment variable support. If you need to add environment-specific configuration:-
Create
.envfiles:.env- Default environment variables.env.local- Local overrides (git-ignored).env.production- Production-specific variables
-
Prefix variables with
VITE_to expose them to your app: -
Access in your code:
Troubleshooting
Module not found errors
If you encounter module resolution errors:Vite port already in use
Vite will automatically use the next available port. Check your terminal for the actual URL, or specify a custom port invite.config.js:
ESLint errors
If ESLint reports errors, you can:- Fix them manually based on the error messages
- Use auto-fix for some issues:
npx eslint . --fix - Temporarily disable specific rules in
eslint.config.js(not recommended)
Build fails
If the production build fails:- Ensure all dependencies are installed:
npm install - Check for TypeScript errors (if using TypeScript)
- Clear Vite cache:
rm -rf node_modules/.vite - Try building again:
npm run build
Next steps
Customization
Learn how to customize colors, logos, quality settings, and export options
Components
Explore the QRGenerator component architecture and props API
QR Templates
Learn about URL, WiFi, vCard, and Email QR code templates
Examples
See real-world usage examples and integration patterns