This is the runnable sample code from the blog post [Patterns for security with Firebase Authentication: offload work to Cloud Functions]. It discusses offloading work from a client app to Cloud Functions using an authentication trigger.
- Create a new Firebase project
- Enable email/password authentication
- Provision Cloud Firestore and apply the rules given in this gist
- Use the Firebase CLI to create a workspace for Functions using TypeScript
- Deploy the function code to Cloud Functions using the Firebase CLI