Skip to content

Ryan-Carloso/ExpoNotifyKit

Repository files navigation

Supabase Notify Expo

Setup

  1. Install dependencies using pnpm install
  2. Copy .env.example to .env
  3. Configure all required environment variables:
    • SUPABASE_URL: Your Supabase project URL
    • SUPABASE_KEY: Your Supabase anon/public key
    • SUPABASE_DATA_ENDPOINT: API endpoint for data fetching (e.g., /rest/v1/pills)
    • PORT: Server port (default: 3000)
    • REDIS_URL: Redis connection string (optional)

Usage

Run the project with pnpm start

Testing Notifications

Tests are located in testing/get_data.ts (renamed from get_pills.ts to get_data.ts).

To run the data fetching test:

pnpm run dev:getdata

This script fetches data from the configured SUPABASE_DATA_ENDPOINT and logs the result. It is useful for verifying your Supabase connection and data structure.

Expected Output

On success:

✅ Data retrieved successfully:
[
  {
    "id": 1,
    "name": "Medicine Name",
    "scheduled_time": "08:00:00+00",
    "expoToken": "ExponentPushToken[...]"
  },
  ...
]

On error:

❌ Error fetching data:
Status: 401
Data: { message: "JWT expired" }

HTML Components

The service includes a simple HTML status dashboard served at http://localhost:3000 (or configured PORT).

Purpose

  • Service Monitoring: Displays uptime, start time, and current status.
  • Metrics: Shows total notifications sent and Redis memory usage.
  • Activity Log: Lists recent events such as sent notifications, errors, and system messages.

Structure

  • Header: Service title and status indicator.
  • Stats Card: Key metrics including Uptime, Total Notifications Sent, Server Hostname, Storage Mode (Redis), and Memory Usage.
  • Recent Activity Log: A table showing the timestamp and message for the last 50 events.

Environment Variables

Ensure your .env file is properly configured.

  • SUPABASE_URL: Base URL of your Supabase project.
  • SUPABASE_KEY: Service role or Anon key for authentication.
  • SUPABASE_DATA_ENDPOINT: The specific endpoint to fetch notification data from.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors