This repository contains a complete solution for an event ticketing system. The system allows the generation, storage, and validation of tickets for an event, ensuring that each ticket is unique and can only be used once.
- Ticket Generation: Generate unique tickets with QR codes.
- Ticket Storage: Store ticket information including buyer's name, email, and usage status.
- Ticket Validation: Validate tickets at the event entrance using a web application accessible from an Android phone.
- Backend: FastAPI, Uvicorn
- Frontend: HTML, JavaScript
- QR Code Generation: qrcode (Python library)
- QR Code Scanning: html5-qrcode (JavaScript library)
- Python 3.7+
- Node.js (for serving the frontend, optional)
-
Clone the repository:
git clone https://github.com/yourusername/event-ticketing-system.git cd event-ticketing-system
-
Set up the backend:
- Install the required Python packages:
pip install fastapi uvicorn qrcode[pil]
- Run the FastAPI server:
uvicorn main:app --reload
- Install the required Python packages:
-
Set up the frontend:
- Open the
index.html
file in a web browser. Alternatively, you can serve it using a simple HTTP server:npx http-server .
- Open the
-
Generate a Ticket:
- Send a POST request to
/generate_ticket/
with the buyer's name and email:curl -X POST `https://HOST:8000/generate_ticket/`
- The response will include the ticket ID and a base64-encoded QR code image.
- Send a POST request to
-
Validate a Ticket:
- Open the
index.html
file in a web browser on an Android phone. - Click the "Scan QR Code" button to start scanning.
- Point the camera at the QR code to validate the ticket.
- The web application will communicate with the FastAPI backend to check if the ticket is valid and not used.
- Open the
event-ticketing-system/ │ ├── main.py # FastAPI application ├── index.html # Frontend web application ├── README.md # Project documentation └── requirements.txt # Python dependencies
-
Generate Ticket:
- URL:
/generate_ticket/
- Method:
POST
- Parameters:
name
,email
- Response:
ticket_id
,qr_code
- URL:
-
Validate Ticket:
- URL:
/validate_ticket/{ticket_id}
- Method:
GET
- Response:
message
- URL:
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License.
Feel free to customize this README.md
file according to your specific requirements.