Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deckchairlabs/typescript-fcm-example
Typescript example for Firebase Cloud Messaging
https://github.com/deckchairlabs/typescript-fcm-example
firebase firebase-cloud-messaging parceljs service-worker typescript
Last synced: 25 days ago
JSON representation
Typescript example for Firebase Cloud Messaging
- Host: GitHub
- URL: https://github.com/deckchairlabs/typescript-fcm-example
- Owner: deckchairlabs
- Created: 2020-02-21T04:58:49.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T07:53:51.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T16:24:24.638Z (about 1 month ago)
- Topics: firebase, firebase-cloud-messaging, parceljs, service-worker, typescript
- Language: TypeScript
- Homepage: https://typescript-fcm-example.netlify.com/
- Size: 1.65 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# typescript-fcm-example
[![Netlify Status](https://api.netlify.com/api/v1/badges/46b4c999-5c0c-4427-a012-08b55ac97a91/deploy-status)](https://app.netlify.com/sites/typescript-fcm-example/deploys)
Typescript example for Firebase Cloud Messaging
The following assumes an existing knowledge of NodeJS and Firebase development.
## Environment Setup
1. You will need to create a `.env` or `.env.local` (this is preferred, as to keep any sensitive credentials out of your repository) file with the following variables.
```sh
# .env.local
# Follow the instructions here to obtain your Firebase config https://firebase.google.com/docs/web/setup
FIREBASE_API_KEY=your value here
FIREBASE_PROJECT_ID=your value here
FIREBASE_MESSAGING_SENDER_ID=your value here
FIREBASE_APP_ID=your value here
FIREBASE_MEASUREMENT_ID=your value here
# To get your VAPID key, follow the instructions here https://firebase.google.com/docs/cloud-messaging/js/client
PUBLIC_VAPID_KEY=your value here
```2. Allow Chrome to use insecure certificates for localhost `chrome://flags/#allow-insecure-localhost`
## Testing
Run `yarn dev` to start the local development server powered by ParcelJS. You will be asked for permission to receive notifications, after accepting, the textarea will be populated with your FCM token which you can use to send tests using the Firebase Console.