Prerequisites
Before you begin, ensure you have the following installed:Node.js
Version 18 or higher required
npm
Or any compatible Node package manager (pnpm, yarn)
Quick setup
Clone the repository
Clone the Atomix QRGen repository from GitHub:
The repository includes all source code, dependencies configuration, and build scripts needed to run the project.
Install dependencies
Install the required npm packages:This installs:
- astro (5.17.1) - Static site generator
- preact (10.28.3) - UI component library
- tailwindcss (4.1.18) - CSS framework
- qr-code-styling (1.9.2) - QR code generation
- @astrojs/preact (4.1.3) - Astro integration for Preact
Start the development server
Launch the local development server:You should see output similar to:Open http://localhost:4321 in your browser to see the app running.
The dev server includes hot module replacement (HMR), so changes to your code will automatically refresh the browser.
Available commands
Atomix QRGen includes several npm scripts for development and production:| Command | Description |
|---|---|
npm run dev | Start the local development server at http://localhost:4321 |
npm run build | Build the optimized production site to ./dist |
npm run preview | Preview the production build locally before deployment |
npm run astro | Run Astro CLI commands directly |
Development workflow
Project structure
Understanding the codebase structure helps you navigate and modify the project:Component architecture
Component architecture
The app uses a component-based architecture:
- Astro components (
.astro) - Static pages and layouts - Preact components (
.tsx) - Interactive UI with client-side state - Domain logic (
domain/) - Encoders, validators, types (framework-agnostic)
Configuration
Astro config
The Astro configuration enables Preact integration and Tailwind CSS:TypeScript config
TypeScript is configured for strict type checking:Building for production
When youβre ready to deploy:Build the static site
./dist directory with:- Minified JavaScript and CSS
- Optimized images
- Pre-rendered HTML pages
Preview the build
Test the production build locally:This serves the
./dist folder at http://localhost:4321 to verify everything works.Deploy
Deploy the
./dist folder to any static hosting service:- Vercel: Connect your GitHub repo for automatic deployments
- Netlify: Drag and drop the
distfolder or use Git integration - GitHub Pages: Push to
gh-pagesbranch - Cloudflare Pages: Connect repository or upload directly
Atomix QRGen is a static site with no backend requirements, making deployment simple and cost-effective.
Development tips
Hot module replacement
Hot module replacement
The dev server automatically refreshes when you save changes. For Preact components, state is preserved across refreshes when possible.
Adding a new QR type
Adding a new QR type
To add a new QR format:
- Define the type in
src/domain/types/qr.ts - Create an encoder in
src/domain/encoders/encoders.ts - Add validation in
src/domain/validation/validators.ts - Build the form component in
src/components/forms/ - Register in
src/domain/form/form-registry.ts - Add to the type selector in
card-qr-type.tsx
Customizing QR appearance
Customizing QR appearance
Modify QR code styling in
card-qr-preview.tsx:27-33:Browser compatibility
Browser compatibility
Atomix QRGen works in all modern browsers:
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
qr-code-styling library handles browser differences automatically.Troubleshooting
Build errors? Ensure youβre using Node.js 18+ and all dependencies are installed. Try deleting
node_modules and package-lock.json, then run npm install again.Next steps
Quickstart
Learn how to use the app to generate QR codes
QR types
Explore all supported QR code formats
API reference
Deep dive into encoders and validators
Contributing
Contribute to the project on GitHub