A beautiful and user-friendly QR code generator built with React, Vite, and Node.js.
- Generate QR codes from text or URLs
- Customize QR code colors
- Adjust QR code size
- Choose error correction level
- Download generated QR codes as PNG images
- Beautiful, responsive user interface with Tailwind CSS
-
Frontend:
- React
- Vite
- Tailwind CSS
- HeadlessUI
-
Backend:
- Node.js
- Express
- qrcode library
├── public/ # Public assets
├── src/
│ ├── components/ # React components
│ │ ├── Alert.jsx # Alert notifications
│ │ ├── DarkModeToggle.jsx # Dark mode toggle
│ │ ├── Footer.jsx # Page footer
│ │ ├── Header.jsx # Page header
│ │ ├── LoadingSpinner.jsx # Loading indicator
│ │ ├── QRCodeDisplay.jsx # QR code display component
│ │ └── QRCodeForm.jsx # Form for QR code generation
│ ├── utils/ # Utility functions
│ ├── App.jsx # Main application component
│ └── main.jsx # Entry point
├── server.js # Express server
├── server-package.json # Backend dependencies
├── .gitignore # Git ignore file
├── tailwind.config.js # Tailwind CSS configuration
└── vite.config.js # Vite configuration
The project includes a comprehensive .gitignore file that excludes:
- Dependencies: Node modules and package manager files
- Build outputs: Distribution directories and local build files
- Environment variables:
.envfiles with sensitive information - Editor-specific files: Settings for various IDEs
- Temporary files: Logs, cache files, and backups
- OS-specific files: System-generated files
## Getting Started
### Prerequisites
- Node.js (v16 or higher)
- npm (v7 or higher)
### Installation
1. Clone the repository:
```bash
git clone https://github.com/PasinduOG/qr-code-generator.git
cd qr-code-generator
- Install the dependencies:
npm install- Create a
.envfile in the root directory (optional):
# .env
PORT=5000Note: The
.envfile is included in the.gitignorefile and will not be committed to the repository.
You can run both the frontend and backend servers concurrently with a single command:
npm run startAlternatively, you can run them separately:
- Frontend (Vite development server):
npm run dev- Backend (Express server):
npm run serverThe frontend will be available at http://localhost:5173 and the backend API at http://localhost:5000.
POST /api/generate
Request Body:
{
"text": "https://example.com",
"color": "#000000",
"bgColor": "#FFFFFF",
"size": 300,
"errorCorrectionLevel": "M"
}Response:
{
"qrCode": "data:image/png;base64,..."
}Check out the live demo of the application:
The frontend can be built using:
npm run buildThis will create a dist directory with the production build that can be deployed to any static hosting service like GitHub Pages, Netlify, or Vercel.
The backend is a Node.js Express application that can be deployed to any Node.js hosting service like Heroku, Railway, or Render.
Remember to set the environment variables on your hosting platform.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. It puts only very limited restriction on reuse and has high compatibility with other licenses, making it ideal for open source projects.
- qrcode - QR code generation library
- Tailwind CSS - Utility-first CSS framework
- React - Frontend library
- Vite - Frontend build tool
- HeadlessUI - Unstyled, accessible UI components
- PasinduOG - Full Stack Developer
This application is configured to be easily deployed to Heroku. Follow these steps to deploy your own instance:
- Heroku CLI installed
- GitHub account
- Git installed on your local machine
-
Login to Heroku
heroku login
-
Create a new Heroku app
heroku create your-qr-code-app-name
-
Set environment variables (if needed)
heroku config:set NODE_ENV=production
-
Deploy the application You can deploy directly from your local repository:
git push heroku main
Or connect your GitHub repository to Heroku for automatic deployments through the Heroku Dashboard.
-
Open the deployed application
heroku open
- The application is configured to serve the React frontend from the Express backend in production
- Build process is automatically handled by the
heroku-postbuildscript - The Procfile is already set up to start the server correctly on Heroku
