Skip to content

JagandeepBrar/lunasea-notification-service

Repository files navigation

LunaSea Notification Service

A TypeScript backend service that handles receiving webhooks from applications supported in LunaSea and sends notifications to the respective user or device.

Setting up an instance of your own notification service is not necessary to get webhook notifications in LunaSea, simply use the hosted notification service available at https://notify.lunasea.app. Setting up your own instance will not send notifications to the officially published LunaSea application.

Setting up your own instance of the notification service is only necessary when building your own version of LunaSea, which utilizes a different Firebase project.

Usage

For documentation on setting up the webhooks, please look at LunaSea's documentation available here.

Installation (Docker)

docker run -d \
    -e FIREBASE_CLIENT_EMAIL=firebase-adminsdk-example@project.iam.gserviceaccount.com \
    -e FIREBASE_DATABASE_URL=https://example-project.firebaseio.com \
    -e FIREBASE_PRIVATE_KEY=example-private-key \
    -e FIREBASE_PROJECT_ID=example-project \
    -e FANART_TV_API_KEY=1234567890 \
    -e THEMOVIEDB_API_KEY=1234567890 \
    -e REDIS_HOST=192.168.1.100
    -e REDIS_PORT=6379
    -p 9000:9000 \
    --restart unless-stopped \
ghcr.io/jagandeepbrar/lunasea-notification-service:latest

Development & Installation

LunaSea's Notification Service requires:

  • Node.js v10.0.0 or higher (v14.0.0 or higher is recommended)
  • Redis 6
  • A Firebase Project

Environment

All environment variables must either be set at an operating system-level, terminal-level, as Docker environment variables, or by creating a .env file at the root of the project. A sample .env is supplied in the project (.env.sample).

Variable Value Default Required?
FIREBASE_CLIENT_EMAIL The Firebase client email for the project.
FIREBASE_DATABASE_URL The Firebase database URL for the project.
FIREBASE_PRIVATE_KEY The Firebase private key for the project.
FIREBASE_PROJECT_ID The Firebase project ID for the project.
FANART_TV_API_KEY A developer Fanart.tv API key.
THEMOVIEDB_API_KEY A developer The Movie Database API key.
REDIS_HOST Redis instance hostname.
REDIS_PORT Redis instance port.
REDIS_USER Redis instance username. ""
REDIS_PASS Redis instance password. ""
REDIS_USE_TLS Use a TLS connection when communicating with Redis? false
PORT The port to attach the service web server to. 9000

Running

  1. Configure the required environmental variables
  2. Run npm install
  3. Run npm start

Building

  1. Configure the required environmental variables
  2. Run npm install
  3. Run npm run build
  4. Run npm run serve

About

Node.js/TypeScript server for sending webhook-based push notifications to LunaSea

Topics

Resources

License

Stars

Watchers

Forks

Languages