{"id":22381910,"url":"https://github.com/googleinterns/scan-and-go","last_synced_at":"2025-07-31T02:33:10.318Z","repository":{"id":39109603,"uuid":"264100679","full_name":"googleinterns/scan-and-go","owner":"googleinterns","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-03T20:17:14.000Z","size":5815,"stargazers_count":4,"open_issues_count":93,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-03T21:32:46.001Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://scan-and-go-for-gpay.an.r.appspot.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googleinterns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-15T05:04:55.000Z","updated_at":"2024-05-03T21:32:57.033Z","dependencies_parsed_at":"2024-05-03T21:32:36.493Z","dependency_job_id":"743222d6-46f9-45ba-b0c1-6b0210e9d32f","html_url":"https://github.com/googleinterns/scan-and-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fscan-and-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fscan-and-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fscan-and-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleinterns%2Fscan-and-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googleinterns","download_url":"https://codeload.github.com/googleinterns/scan-and-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228209947,"owners_count":17885595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T00:10:57.771Z","updated_at":"2024-12-05T00:10:58.421Z","avatar_url":"https://github.com/googleinterns.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n# ScanAndGo Development Project\n\nOpen-source 2020 Google Internship project. ScanAndGo is a Spot-as-a-service app within the larger Google Pay app that allows for users to scan barcodes within registered stores for quick checkout without queuing. View the [webapp](https://scan-and-go-for-gpay.an.r.appspot.com/).\n\n## Development\n\n### Prerequisites\n\n1. [Node js v10](https://nodejs.org/en/download/) or recommended with a node version manager [nvm](https://github.com/nvm-sh/nvm)\n2. Npm with node or install [Yarn](https://yarnpkg.com/getting-started/install)\n\n#### First-time set-up\n\n1. cd `/client`\n2. Install project dependencies by running `yarn install .`\n3. Obtain keys for required environment variables specified in `/client/env_template` and `/server/env_template`\n   and store it in .env file. This file or any keys should not be checked in.\n4. cd `/server`\n5. Install project dependencies by running `yarn install .`\n6. Install [git-secrets with GCP support](https://github.com/deshpandetanmay/git-secrets#installing-git-secrets)\n\n### Front-end Server (React)\n\nRun `yarn dev` from `/client` directory. This runs `react-scripts start` and watches folder for changes, updating automatically.\n\n### Back-end Server (Express)\n\nRun `yarn dev` from `/server` directory. This runs `nodemon server.js --watch controllers/ --watch routers/` which starts the express server while watching for changes in the `/server/controllers` and `/server/routers` directory, restarting the server when changes are detected.\n\nAlternatively when developing for front-end, we can just do `yarn start \u0026` to run the express server in the background.\n\n**Development Note:** We start the express server on port:3143 and proxy unknown requests received by front-end to this port. See [`/client/package.json:26`](https://github.com/devYaoYH/scan-and-go/blob/b8569d4fadd267bca7737bde8a597a6a2fd31eaa/client/package.json#L26) where we configure the proxy for the react front-end to `http://127.0.0.1:3143` for local development communication between client and server processes.\n\n## AppEngine Deployment\n\nAfter setup of [gcloud-SDK](https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu), run `gcloud app deploy` in subdirectories `/client` and `/server`. **Note that `/client` needs to be built first with `yarn build`**\n\nWith this, we will deploy client front-end react app to default service and back-end express app to api service. This is configured in `app.yaml` within `/client` and `/server` directories.\n\n### Routing (_initial setup only_)\n\nOn project root directory, run `gcloud app deploy dispatch.yaml` to ensure we re-route all requests to `*/api/*` to our api appengine service which is running our express server.\n\n## Testing Framework\n\nBoth the `/client` and `/server` NodeJS projects are configured to run test suites with Jest.\n\n### Server Testing\n\nIn addition to Jest, the server requires **supertest** and **@firebase/testing** together with an emulated Cloud Firestore running on our local development environment.\n\nThe firebase CLI to run our emulator can be easily installed with `yarn global add firebase-tools` or `npm install -g firebase-tools`. Afterwhich, we require a valid Java Runtime Environment installed to run the Firebase emulator. It is suggested to install `openjdk-11-jdk` on linux machines with `sudo apt-get install default-jdk`.\n\nFinally, we can start our emulator prior to running any tests with:\n\n```\nfirebase emulators:start --only firestore\n```\n\nAnd test with `yarn test`. In `/server/package.json`, we define a pretest script to wipe our emulated database before each run of test to ensure we clean.\n\n**Server Test Steps:**\n\n1. `firebase emulators:start --only firestore`\n2. `yarn test`\n   - Automatically runs `yarn pretest` first: `curl -X DELETE \"http://localhost:8080/emulator/v1/projects/scan-and-go-for-gpay/databases/(default)/documents\"`\n   - `NODE_ENV=\\\"test\\\" jest`\n\n**Note:** Our `firestore.js` module automatically detects which handle to grab based on the environment variable: `NODE_END`. When this is `\"test\"`, we load up the `emulatedFirestore.js` module rather than use the live Firestore variable (connecting to actual Cloud Firestore DB).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleinterns%2Fscan-and-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogleinterns%2Fscan-and-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleinterns%2Fscan-and-go/lists"}