git clone git@github.com:rauno56/climbing-card-check.git
npm ci
Both env vars are required:
SPREADSHEET_ID
: Google Sheet ID used as the database. Can be extracted from a url of the sheet:https://docs.google.com/spreadsheets/d/< it's here >/edit#gid=0
GOOGLE_KEY
: Credentials to access the Google Sheets API. See below for creating and storing it in Vercel.
Once your environment is set up you can run it locally or deploy to Vercel. There's abundance of documentation online for latter. Following has some simplifying steps specific to this app.
Once .env
file is set up, run it locally with npm start
.
Add the two environment vars to Vercel via the UI. And deploy the app with:
npx vercel
- Enable Google Sheets API;
- Under "Credentials" click "Create Credentials" to create a Service Account - no optional permissions or role required;
- Under "Keys" of that service account create a new JSON key;
- Download the key file to
./key.json
of this folder; - To get the base64 encoding of that file run
node scripts/key.to.env.cjs
and store that to your.env
file; - Share the Sheet with the
client_email
of that key. You'll find that in the key file and it should look something likeservice-account-name@youruser.iam.gserviceaccount.com
.