A modern, professional QR code generator built with Next.js 14, TypeScript, and Tailwind CSS. Generate high-quality QR codes for URLs, text, emails, phone numbers, SMS, and WiFi credentials with custom colors and multiple export formats.
- Multiple Data Types: URLs, plain text, email, phone, SMS, WiFi
- 4 Generation Modes: Basic, Colored, SVG, High Quality
- Multiple Formats: PNG, SVG, JPG, WebP with high-quality output
- Custom Colors: Brand color matching with contrast validation
- Error Correction: Adjustable levels for different use cases
- Real-time Preview: Instant QR code generation with live updates
- Responsive Design: Works perfectly on desktop, tablet, and mobile
- Privacy Focused: All processing happens locally - no data sent to servers
- Fast & Reliable: Optimized for performance with error handling
- Accessibility: Screen reader support and keyboard navigation
- Progressive Web App: Installable with offline capabilities
- Batch Generation: Create multiple QR codes at once
- Analytics Tracking: Usage analytics with privacy compliance
- Error Recovery: Comprehensive error handling with retry mechanisms
- Performance Monitoring: Built-in performance tracking
- User Guide: Complete in-app documentation
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- QR Generation: QRCode.js library
- Canvas Processing: HTML5 Canvas API
- File Handling: File-saver for downloads
- Deployment: Vercel (optimized)
- Node.js 18.0 or higher
- npm or yarn package manager
- Clone the repository
git clone https://github.com/Ikrar06/qr-generator-web.git
cd qr-generator-web- Install dependencies
npm install
# or
yarn install- Set up environment variables
cp .env.example .env.local- Run the development server
npm run dev
# or
yarn dev- Open your browser Visit http://localhost:3000
npm run build
npm startqr-generator-web/
βββ src/
β βββ app/ # Next.js app directory
β β βββ components/ # React components
β β β βββ ui/ # Reusable UI components
β β β βββ ErrorBoundary.tsx
β β β βββ UserGuide.tsx
β β β βββ LoadingSpinner.tsx
β β βββ api/ # API routes
β β β βββ generate-qr/
β β β βββ health/
β β β βββ analytics/
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β βββ components/ # Shared components
β βββ lib/ # Utilities and core logic
β β βββ qr-generator.ts # QR generation logic
β β βββ error-handling.ts # Error management
β β βββ analytics.ts # Analytics tracking
β β βββ utils.ts # Helper functions
β βββ hooks/ # React hooks
β β βββ useQRGenerator.ts # QR generation hook
β βββ types/ # TypeScript definitions
β βββ qr-types.ts # QR-related types
βββ public/ # Static assets
βββ docs/ # Documentation
βββ generated-qr/ # Generated QR codes
βββ downloads/ # Download cache
- Select Data Type: Choose from URL, Text, Email, Phone, SMS, or WiFi
- Enter Content: Input your data in the text field
- Choose Mode: Select Basic, Colored, SVG, or High Quality
- Customize: Adjust colors, size, and error correction
- Generate: Click "Generate QR Code"
- Download: Choose your preferred format and download
- Low (7%): Maximum data capacity
- Medium (15%): Balanced option (recommended)
- Quartile (25%): Good for print materials
- High (30%): Maximum damage resistance
- Basic: Standard black and white QR codes
- Colored: Custom foreground and background colors
- SVG: Vector format for infinite scalability
- High Quality: Professional grade with maximum error correction
- PNG: Best for web use with transparency support
- SVG: Perfect for print and scalable graphics
- JPG: Smallest file size for quick sharing
- WebP: Modern format with superior compression
# Application
NEXT_PUBLIC_BASE_URL=http://localhost:3000
NODE_ENV=development
# Analytics (optional)
NEXT_PUBLIC_GA_ID=G-XXXXXXXXXX
NEXT_PUBLIC_ANALYTICS_CONSENT=false
# Error Reporting (optional)
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn
# Performance Monitoring
NEXT_PUBLIC_PERFORMANCE_MONITORING=trueEdit tailwind.config.js to customize the color palette:
module.exports = {
theme: {
extend: {
colors: {
primary: {
50: '#eff6ff',
500: '#3b82f6',
600: '#2563eb',
// ... more colors
}
}
}
}
}Modify src/lib/constants.ts for default settings:
export const QR_DEFAULTS = {
width: 256,
height: 256,
margin: 2,
errorCorrectionLevel: 'M',
quality: 0.92
};- QR generation tracking
- Error monitoring
- Performance metrics
- User interaction analytics
- GDPR-compliant data collection
- Page load times
- Generation performance
- Download success rates
- Error rates and categorization
- Local processing only
- No data collection without consent
- GDPR compliance
- Do Not Track respect
- Local Processing: All QR generation happens in the browser
- No Server Storage: No user data stored on servers
- HTTPS Only: Secure connections in production
- Content Validation: Input sanitization and validation
- Input validation and sanitization
- XSS protection
- CSRF protection
- Secure headers configuration
- Regular dependency updates
- Connect Repository
vercel-
Configure Environment Set environment variables in Vercel dashboard
-
Deploy
vercel --prod- Build Image
docker build -t qr-generator-web .- Run Container
docker run -p 3000:3000 qr-generator-webnpm run build
npm run export# Unit tests
npm run test
# Integration tests
npm run test:integration
# E2E tests
npm run test:e2e
# Coverage report
npm run test:coverageTest on multiple browsers and devices:
- Chrome/Edge (Chromium-based)
- Firefox
- Safari (WebKit)
- Mobile browsers (iOS Safari, Android Chrome)
- Check color contrast (minimum 4.5:1 ratio)
- Increase QR code size
- Use higher error correction level
- Ensure adequate quiet space
- Check browser permissions
- Try different format (PNG vs SVG)
- Clear browser cache
- Disable ad blockers temporarily
- Reduce QR code size
- Use Basic mode instead of High Quality
- Close other browser tabs
- Update browser to latest version
Enable debug logging:
localStorage.setItem('qr_debug', 'true');We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite
- Submit a pull request
- TypeScript strict mode
- ESLint configuration
- Prettier formatting
- Conventional commits
- Component testing
This project is licensed under the MIT License - see the LICENSE file for details.
- QRCode.js for QR generation
- Next.js for the amazing framework
- Tailwind CSS for styling
- Vercel for hosting and deployment
- The open-source community for inspiration and tools
- π Documentation
- π¬ Discussions
- π Issue Tracker
- βοΈ Email Support
When reporting issues, please include:
- Browser and version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Screenshots if applicable
- Console error messages
We love hearing about new feature ideas! Please check existing issues first and provide:
- Clear use case description
- Expected behavior
- Any relevant examples or mockups
- Initial release with core QR generation
- Multiple data type support
- Custom color options
- Real-time preview
- Multiple output formats
- Error handling and recovery
- Analytics and performance monitoring
- Comprehensive user guide
- PWA capabilities
- QR code templates and presets
- Batch processing improvements
- Advanced customization options
- Integration APIs
- Enhanced accessibility features
- Generation Time: < 100ms for standard QR codes
- File Sizes:
- PNG: 2-10KB typical
- SVG: 1-5KB typical
- WebP: 1-8KB typical
- Browser Support: 95%+ modern browsers
- Mobile Performance: Optimized for all devices
- Lazy loading for non-critical components
- Image optimization and compression
- Code splitting for faster initial loads
- Service worker for offline functionality
- Progressive enhancement
| Browser | Version | Support Level |
|---|---|---|
| Chrome | 88+ | Full |
| Firefox | 85+ | Full |
| Safari | 14+ | Full |
| Edge | 88+ | Full |
| iOS Safari | 14+ | Full |
| Android Chrome | 88+ | Full |
| IE | Not supported | - |
The app includes progressive enhancement:
- Core functionality works in all supported browsers
- Advanced features degrade gracefully
- Polyfills included for older browser support
const {
generate,
download,
state,
progress,
clear
} = useQRGenerator();Generate a QR code with specified options.
const result = await generate({
data: 'https://example.com',
mode: QRMode.COLORED,
options: {
width: 256,
height: 256,
color: {
dark: '#000000',
light: '#ffffff'
}
}
});Download generated QR code in specified format.
await download(response, {
format: OutputFormat.PNG,
filename: 'my-qr-code.png'
});import { handleError } from '@/lib/error-handling';
try {
// Your code here
} catch (error) {
const processedError = await handleError(error, {
component: 'QRGenerator',
function: 'generate'
});
}import { trackQRGeneration } from '@/lib/analytics';
trackQRGeneration({
mode: 'colored',
dataType: 'url',
format: 'png',
success: true
});Modify the default theme in tailwind.config.js:
module.exports = {
theme: {
extend: {
colors: {
brand: {
primary: '#your-color',
secondary: '#your-color'
}
},
fontFamily: {
sans: ['Your Font', 'system-ui']
}
}
}
}Override default component styles:
/* In your custom CSS file */
.qr-generator-container {
@apply your-custom-classes;
}Extend the QR generator with custom data types:
// In src/types/qr-types.ts
export enum QRDataType {
// ... existing types
CUSTOM = 'custom'
}
// Add validation logic in src/lib/validation.ts
// Add formatting logic in src/lib/qr-generator.ts- Touch-optimized interfaces
- Responsive design for all screen sizes
- Optimized file sizes for mobile networks
- Offline functionality with service workers
- Native app-like experience
Users can install the app on mobile devices:
- Visit the website in a mobile browser
- Tap "Add to Home Screen" when prompted
- Access the app like a native application
All user inputs are validated and sanitized:
- URL format validation
- Email format checking
- Phone number validation
- Text length limits
- Character encoding validation
The app implements strict CSP headers:
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'
- No user data stored on servers
- Local storage only for user preferences
- Analytics data anonymized
- GDPR compliance built-in
- Unit tests for utility functions
- Integration tests for QR generation
- Component tests for UI elements
- E2E tests for user workflows
- Performance tests for optimization
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run test
- run: npm run build- QR generation success rates
- Popular data types and formats
- User interaction patterns
- Performance bottlenecks
- Error rates and types
- No personal data collection
- Opt-in analytics only
- Anonymized metrics
- GDPR compliant
- Local data processing
- Automated testing on PR
- Dependency updates
- Security scanning
- Performance monitoring
- Automated releases
{
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
}Built with β€οΈ using Next.js, TypeScript, and modern web technologies.
For more information, visit our website or check out the live demo.
