This is an Express-based notification service that sends push notifications to both Android and iOS devices using Firebase Cloud Messaging (FCM) and Apple Push Notification Service (APNs).
-
Clone the repository:
git clone https://github.com/avezqureshi14/apns-fcm-notification-service cd apns-fcm-notification-service
-
Install dependencies:
npm install
-
Build Typescript files:
tsc ./index.ts
-
Run:
node ./index.js
-
Place your Firebase service account key JSON file in the root directory and update the path in
app.ts
orindex.ts
. -
Place your APNs auth key file in the root directory and update the path in
app.ts
orindex.ts
.
- Go to the Firebase Console.
- Navigate to your project settings.
- Generate a new private key in the "Service accounts" tab and download the JSON file.
- Save this file in your project directory (e.g.,
./path/to/serviceAccountKey.json
).
- Log in to your Apple Developer account.
- Navigate to "Certificates, Identifiers & Profiles".
- Create a new APNs auth key and download the
.p8
file. - Note the
Key ID
andTeam ID
. - Save the
.p8
file in your project directory (e.g.,./path/to/APNsAuthKey_XXXXXXXXXX.p8
).