Thank you for your interest in contributing to the Mini QR project! Contributions from the community are welcome to help improve and enhance this tool.
You can work on existing issues or suggest new ones. You can also share your presets with the world by referring to this section.
Before you start, please take a moment to read through these guidelines.
- Contributing to Mini QR
Please read the official MDN docs for open source etiquette, if you're new to contributing to open source projects.
- Please check for existing duplicate issues before opening an issue for improvement suggestion or bug report.
- Always request to be assigned to an issue before working on it. This helps prevent conflicting and duplicate work.
- Comment on the issue you'd like to work on, asking to be assigned.
- Wait for @lyqht to assign you before starting work.
- For improvement suggestions,
- Include mockups if the change is UI-based.
- For self-hosting related feature requests, please note that I, the main project maintainer (@lyqht) will likely not work on those. This is because I do not have docker expertise and I don't really have an interest to learn it. The current docker images are setup by kind public contributors. Thanks for your understanding!
- Please note that the following issues are known and are caused by the
qr-code-stylinglibrary, and cannot be fixed within this project.- Encoding issues with accented characters
- Image margin inconsistency
- SVG export not containing actual svg paths, causing black images on certain software like Adobe Photoshop. -> Due to its unreliability, I've tried removing this export option sometime ago but many users requested to have it back since they don't use the SVG file for editing, and merely for displaying it on the web. So please stop requesting this to be removed/fixed.
- For all other bugs, provide clear steps for reproduction.
- Fork the repository and clone it to your local machine.
- Install the necessary dependencies by running
pnpm install. If you don't have pnpm installed, you can install it by runningnpm install -g pnpm. - Start the development server by running
pnpm dev. - Create a new branch for your contribution, preferably with a name related to the issue you're working on. e.g.
author/issue-description. - Create a pull request for that branch, with the base branch set to
main. Ensure that commit messages are clear and concise.
Note that your changes may be modified by the maintainer to ensure consistency and best practices. The maintainer may also update documentation(README.md) on your PR.
The project is a modern Vite-powered Vue.js 3 application with TypeScript support and Tailwind CSS for styling. Here's an overview of the main directories and files:
Entry Points:
src/main.js: Application entry point that initializes Vue appsrc/App.vue: Main application component with comment regions for different functionality:- Scroll-aware header functionality
- App mode switching (Create/Scan)
- Component integration and routing logic
index.html: Main HTML template
Components (src/components/):
QRCodeCreate.vue: Main component for QR code creation with extensive customization optionsQRCodeScan.vue: Component for scanning QR codes via camera or file uploadStyledQRCode.vue: Component that renders the actual QR code outputQRCodeFrame.vue: Component for adding frames around QR codesDataTemplatesModal.vue: Modal for managing QR code data templatesVCardPreview.vue: Preview component for vCard QR codesQRCodeCameraScanner.vue: Camera-based QR code scanning functionalityCopyImageModal.vue: Modal for copying QR code imagesAppFooter.vue: Application footer componentMobileMenu.vue: Mobile navigation menuLanguageSelector.vue: Language selection componentui/: Directory containing auto-generated UI components from radix-vue (don't modify these)
Utilities (src/utils/):
qrCodePresets.ts: QR code style presets and preset managementdataEncoding.ts: Data encoding/decoding utilities for different QR code typesconvertToImage.ts: Image conversion and export utilities (PNG, JPG, SVG)csv.ts: CSV parsing and validation for batch operationsi18n.ts: Internationalization setup and utilitieslanguage.ts: Language detection and managementuseDarkModePreference.ts: Dark mode preference managementcolor.ts: Color utility functionsformatting.ts: Text formatting utilities
Library utilities (src/lib/):
utils.ts: Shared utility functions
Styles:
src/style.css: Main application stylessrc/index.css: Additional base styles- Tailwind classes used throughout components
- Component-specific styles in
<style>blocks within Vue files
Assets (src/assets/):
vue.svg: Vue logoplaceholder_image.png: Placeholder image for QR codespresets/: Directory for preset-related assets
Public assets (public/):
- Sample CSV files for batch operations
- App icons and favicons
- Demo videos and preview images
CHANGELOG.md: Version changelog
Testing (tests/):
e2e/: End-to-end tests using Playwrightcreate.spec.ts: Tests for QR code creation functionalityapp.spec.ts: General application testsfixtures/: Test fixture files*.spec.ts-snapshots/: Visual regression test snapshots
Configuration files:
vite.config.js: Vite build configurationtailwind.config.js: Tailwind CSS configurationtsconfig.json&tsconfig.node.json: TypeScript configurationplaywright.config.ts: Playwright testing configurationvitest.config.ts: Vitest unit testing configurationcomponents.json: Radix Vue components configuration.eslintrc.cjs: ESLint configuration.prettierrc.json: Prettier formatting configuration
Internationalization:
locales/: Translation files for different languages- Integration with Crowdin for community translations
Important Notes:
- The actual QR code output includes a wrapper around
StyledQRCode.vue, which can be found byid="qr-code-container"insrc/App.vue - The project uses TypeScript throughout for better type safety
- UI components in
src/components/ui/are auto-generated from radix-vue and should not be modified manually - The application supports both light and dark themes with system preference detection
This project uses Playwright for end-to-end testing.
Running Tests:
To run all E2E tests, use the following command:
pnpm test:e2eWriting Tests:
- Tests are located in the
tests/e2edirectory. - Use clear and descriptive test names.
- Utilize Playwright's locators (e.g.,
getByRole,getByLabel,getByText, IDs) for selecting elements robustly. - Avoid relying on brittle selectors like complex CSS paths or auto-generated class names.
- Use
test.beforeEachto set up common preconditions for tests within a file (e.g., navigating to the page, clearing local storage). - Prefer testing file uploads over camera interactions for scanning tests, as camera access can be inconsistent in test environments.
- Use snapshot testing (
toHaveScreenshot) for verifying visual elements like the generated QR code. Remember to commit the baseline snapshot files located in thetests/e2e/*.spec.ts-snapshotsdirectory.
Debugging Failed Tests:
- Playwright automatically generates an HTML report (
playwright-report/index.html) after each run. - For failed tests, the report includes:
- Detailed error messages and stack traces.
- Screenshots taken at the point of failure (configured in
playwright.config.ts). - Trace files (
*.zipintest-results/) which can be viewed withpnpm exec playwright show-trace <trace-file.zip>for a step-by-step replay.
Limitations:
- Zip File Verification: While tests verify that batch exports download a zip file, they do not automatically verify the contents (e.g., number of images) of the zip file due to browser sandbox limitations. This requires manual inspection or a separate post-test script if full automation is needed.
An easy way to add a new preset is to create the QR code on the website first, and then save the config. The config JSON file will look something like this:
{
"props": {
"data": "https://github.com/lyqht/mini-qr"
// other props...
},
"style": {
// other styles...
}
}Combine "style" with the value of "props" in a new json.
const yourNewPreset = {
data: 'https://github.com/lyqht/mini-qr',
// other props...
style: {
// other styles...
}
}Then add it to the allQrCodePresets array in src/utils/qrCodePresets.ts. New presets should always be added as the last item in the array.
You will then see your new preset in the Presets dropdown in the website.
- Follow this documentation to create a free account on Crowdin
- Visit our Mini QR Crowdin project
- Select the language you want to translate to
- Start translating! No approval needed to begin
If your language isn't available:
- Open an issue requesting the new language
- Wait for confirmation from @lyqht
- Once added, you can begin translating
You can check the current translation status on our Crowdin project page.
By contributing to Mini QR, you agree that your contributions will be licensed under the GPL v3 license.
Please refer to the Code of Conduct for more details.
The project maintainer, @lyqht, has the final say on whether a pull request will be merged. Please be patient and respectful throughout the review process.
Thank you for contributing to Mini QR! ✨
