Handle transaction and save it into google spreadsheet
- API layer - firebase cloud functions
- Persistence layer - firestore
- Presentation layer - google spreadsheets
-
Create a service account in Google Cloud Platform
1.1. Create private keys as JSON (
google-account-email
andgoogle-private-key
) -
Config google spreadsheet
2.1. Remember
google-spread-id
2.2. Share spreadsheet with
google-account-email
with editing permissions -
To work with google spreadsheet API the project uses google-spreadsheet npm package
3.1. To authenticate service account credentials strategy is used
-
Firebase is used as infrastructure layer
4.1 Cloud Functions as API layer and pub-sub layer when database is updated
4.2. Cloud Firestore as database
- Install the dependencies:
$ npm install
-
Setup environment configuration
2.1. The project is depend on the following env variables
- Install
firebase-tools
globally - Export environment configuration:
$ firebase functions:config:get > .runtimeconfig.json
- Use firebase emulator:
$ npm start
# will clean dist; build typescript with watch mode; start emulator
- Or use firebase shell
$ npm run start:shell
# will clean dist; build typescript with watch mode; start local shell
- Deploy all functions
$ npm run deploy
# will clean dist; lint and build typescript; deploy firebase functions
- Deploy a specific function
$ npm firebase deploy --only functions:functionName1,functionName2
TODO