Checking results for TOTO (Singapore lottery) is made simple with the help of Turn Down for Huat. Upload an image of your ticket and see the results immediately!
This is the backend repo. Frontend repo can be found here.
Table of Contents
Gambling is a huge part of Chinese culture, particularly in Singapore where the term "huat" is commonly used in a gambling context to hope for good luck. TOTO is Singapore's legalised lottery, operated by Singapore Pools.
TOTO rules / payouts:
https://online.singaporepools.com/en/lottery/how-play-toto
https://online.singaporepools.com/en/lottery/toto-bet-types
https://online.singaporepools.com/en/lottery/toto-prize-structure
Currently, when one buys TOTO, there is no easy way to check the winnings. One way is to check manually, but that becomes very time consuming and labourious. Singapore Pools offers a prize calculator on their website here but that is also not that much better and still fairly manual. There is a need to select the draw date and tick the numbers one by one, and only one bet can be checked at a time.
Furthermore, there is no way to keep track of one's winnings across so many physical tickets that will likely be discarded.
Enter Turn Down for Huat. This app simplifies results checking through the use of optical character recognition, where users can upload images of their tickets, see the results immediately, and store their tickets for easy future reference.
1. On the main page, upload an image of your TOTO ticket. The results of the draw and your win/loss from every bet on this ticket will be shown.
2. Although this application can be used without any sign up needed, signing up for an account will unlock the other features - mainly to save your tickets and keep track of your win/loss. Click on Log In on the nav bar to log in or sign up.
3. Upon log in, you will be brought back to the main page again. This time, you should see a win/loss tracker.
4. Now, when any ticket is uploaded and the results shown, there is an option to save this ticket. Saving the ticket will update the win/loss tracker
5. Go to the profile page to view all your past saved tickets.
Frontend
Backend
Optical character recognition
To get a local copy up and running follow these simple example steps.
- npm
npm install npm@latest -g
- PostgreSQL
- Follow steps here to set up Google Cloud Vision, up to the point where the JSON key file is downloaded to your computer.
Backend
- Clone the repo
- Copy the JSON file from the Google Cloud Vision setup into the root directory of
turn-down-for-huat-backend
asgoogle-credentials.json
- Create .env file
SALT=<your own salt here for hashing passwords>
FRONTEND_URL='http://localhost:3000'
PORT=3004
GOOGLE_APPLICATION_CREDENTIALS='./google-credentials.json'
USERNAME=<your postgresql username>
DATABASE=<your db name>
HOST=<your host>
- Install NPM packages
npm i
- Init db with sequelize
npx sequelize db:create && npx sequelize db:migrate && npx sequelize db:seed:all
- Run backend
npm start
Frontend
- Clone the repo
- Create .env file
REACT_APP_BACKEND_URL='http://localhost:3004'
- Install NPM packages
npm i
- Run frontend
npm start
Jia Hao: GitHub - [email protected]
Bryan: GitHub - [email protected]