A modern, open-source QR code scanning and management application built with Next.js, Express, and TypeScript. Perfect for developers who want to learn full-stack development or need a starting point for their own QR code projects.
- π± Scan QR codes using your device camera
- π€ Upload QR code images for scanning
- π View scan history and statistics
- π User authentication and authorization
- β‘ Rate limiting to prevent abuse
- π± Responsive design for all devices
- π Real-time updates using React
- π¨ Modern UI with Tailwind CSS
- π Server-side rendering with Next.js
- π TypeScript for better code quality
- π Comprehensive API documentation
- β Extensive test coverage
The easiest way to get started is using Docker. Make sure you have Docker and Docker Compose installed.
git clone https://github.com/msdevsec/qrdecode.ai.git
cd qrdecode.ai# Copy environment files
cp .env.example .env
cp frontend/.env.example frontend/.env.local
cp backend/.env.example backend/.env# Build and start all services
docker-compose up -d
# start Prisma and apply migration in docker
docker-compose exec backend npx prisma migrate dev
# The following services will be available:
# - Frontend: http://localhost:3000
# - Backend API: http://localhost:4000
# - API Documentation: http://localhost:4000/api-docsThat's it! The application should now be running. π
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs -f
# Rebuild services
docker-compose up -d --build
# Remove all containers and volumes
docker-compose down -vIf you prefer to run the services directly on your machine:
- Node.js 18+
- PostgreSQL 15+
- Redis 7+
cd backend
npm install
npm run prisma:migrate
npm run devcd frontend
npm install
npm run dev.
βββ frontend/ # Next.js frontend application
β βββ app/ # App router pages
β βββ components/ # React components
β βββ context/ # React context providers
β βββ public/ # Static assets
β
βββ backend/ # Express.js backend application
β βββ src/ # Source code
β β βββ controllers/ # Route controllers
β β βββ middleware/ # Express middleware
β β βββ routes/ # API routes
β β βββ utils/ # Utility functions
β βββ prisma/ # Database schema and migrations
β
βββ docker/ # Docker configuration files
PORT: API server port (default: 4000)DATABASE_URL: PostgreSQL connection stringREDIS_URL: Redis connection stringJWT_SECRET: Secret for JWT tokensRATE_LIMIT_MAX_REQUESTS: Max requests per window (default: 5)
NEXT_PUBLIC_API_URL: Backend API URLNEXT_PUBLIC_APP_NAME: Application nameNEXT_PUBLIC_FREE_TIER_LIMIT: Free tier scan limit
We use Jest for testing. All tests are in the __test__ directories.
# Run backend tests
cd backend
npm test
# Run frontend tests
cd frontend
npm testAPI documentation is available at http://localhost:4000/api-docs when running the development server. It includes:
- All available endpoints
- Request/response schemas
- Authentication requirements
- Error codes and messages
- JWT authentication
- Rate limiting
- Input validation
- CORS protection
- Error sanitization
- TypeScript type safety
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- QR code scanning powered by jsQR
- UI components inspired by Tailwind UI
- Icons from Heroicons
-
Ports already in use
# Check what's using the port netstat -ano | findstr :3000 netstat -ano | findstr :4000
-
Database connection issues
# Restart the database container docker-compose restart postgres -
Redis connection issues
# Check Redis logs docker-compose logs redis
-
TypeScript errors
# Rebuild TypeScript npm run clean npm run build -
Prisma issues
# Reset database and migrations npx prisma migrate reset npx prisma generate
- Create an issue for bug reports
- Star the repository if you find it useful
- Fork it if you want to contribute
The application uses Docker volumes to ensure data persistence. Here's what you need to know:
- All database data is stored in the
postgres_dataDocker volume - Data persists across container restarts and rebuilds
- Data remains intact when using
docker-compose down
Data is only lost in these specific scenarios:
- Using
docker-compose down -v(which removes volumes) - Manually deleting the postgres_data volume
- Running
docker volume rmon the postgres volume
To prevent data loss, regularly:
- Use
docker execto create database backups - Store backups outside the Docker environment
- Avoid using
-vflag withdocker-compose downunless necessary
Built with β€οΈ by msdevsec
