Skip to content

Stefan98167/TicketScanner

Repository files navigation

TicketScanner 📱

A modern React Native mobile application for scanning and validating QR code tickets using Expo and Supabase.

🚀 Features

  • QR Code Scanning: Scan QR codes using device camera
  • Manual Code Entry: Enter ticket codes manually for validation
  • Real-time Validation: Check ticket validity against Supabase database
  • Analytics Dashboard: View scanning statistics and insights
  • Multi-language Support: Internationalization (i18n) support
  • Dark/Light Theme: Adaptive theming system
  • Cross-platform: Works on iOS, Android, and Web

🛠️ Tech Stack

  • Framework: Expo with React Native
  • Language: TypeScript
  • Backend: Supabase (PostgreSQL + Real-time)
  • Navigation: Expo Router
  • Camera: Expo Camera for QR code scanning

📋 Prerequisites

🔧 Quick Start

  1. Clone and install

    git clone https://github.com/Stefan98167/TicketScanner.git
    cd TicketScanner
    npm install
  2. Set up environment variables

    Create a .env file in the root directory:

    EXPO_PUBLIC_SUPABASE_URL=your_supabase_project_url
    EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

    Note: A .env file with test credentials has been created for development purposes.

  3. Set up Supabase Database

    Create the following tables in your Supabase database:

    -- Tickets table for storing ticket information
    CREATE TABLE tickets (
      id TEXT PRIMARY KEY,
      devalued BOOLEAN DEFAULT FALSE,
      scanned_at TIMESTAMP WITH TIME ZONE,
      created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
    );
    
    -- Scan logs table for analytics and audit trail
    CREATE TABLE scan_logs (
      id BIGSERIAL PRIMARY KEY,
      device_id TEXT NOT NULL,
      action TEXT NOT NULL CHECK (action IN ('check', 'devalue')),
      ticket_code TEXT NOT NULL,
      is_valid BOOLEAN,
      was_devalued BOOLEAN,
      success BOOLEAN NOT NULL,
      message TEXT,
      meta JSONB,
      created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
    );
    
    -- Devices table for tracking scanning devices
    CREATE TABLE devices (
      id TEXT PRIMARY KEY,
      name TEXT,
      created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
    );
  4. Start the development server

    npx expo start

🚀 Usage

  • iOS Simulator: Press i in the terminal
  • Android Emulator: Press a in the terminal
  • Web: Press w in the terminal
  • Physical Device: Scan the QR code with Expo Go

🔒 Security

Environment Variables

  • Never commit .env files to version control
  • Use environment variables for sensitive configuration
  • The app uses EXPO_PUBLIC_ prefix for client-side environment variables

GitHub Codespaces

For enhanced security when contributing, consider using GitHub Codespaces to securely manage API keys.

Database Security

  • Enable Row Level Security (RLS) in Supabase
  • Implement proper database policies
  • Use prepared statements for all queries

🤝 Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'feat: add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Write meaningful commit messages
  • Add tests for new features
  • Update documentation as needed
  • Remove console.log statements in production

🐛 Bug Reports

If you find a bug, please create an issue with:

  • Clear description of the problem
  • Steps to reproduce
  • Expected vs actual behavior
  • Device/OS information

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Support

If you need help:


Note: This is an open-source project. Please ensure you follow security best practices when deploying to production environments.

About

A modern React Native mobile application for scanning and validating QR code tickets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors