Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/supabase-community/onesignal
Next.js app showcasing how you can implement push notification using OneSignal and Supabase
https://github.com/supabase-community/onesignal
onesignal push-notifications supabase
Last synced: 3 months ago
JSON representation
Next.js app showcasing how you can implement push notification using OneSignal and Supabase
- Host: GitHub
- URL: https://github.com/supabase-community/onesignal
- Owner: supabase-community
- Created: 2022-12-09T08:45:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T00:47:21.000Z (about 1 year ago)
- Last Synced: 2024-11-04T18:50:30.419Z (3 months ago)
- Topics: onesignal, push-notifications, supabase
- Language: TypeScript
- Homepage: https://onesignal-example.vercel.app
- Size: 1.23 MB
- Stars: 17
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# OneSignal Next.js Push Notification Example
Simple ordering app to demonstrate how you can use OneSignal with your Supabase project to send push notifications when a new data is inserted in your database.
You can find the full guide [here](https://supabase.com/docs/guides/integrations/onesignal).
![Screenshot](https://raw.githubusercontent.com/supabase-community/onesignal/main/assets/screenshot.png)
.
├── app # Next.js app to place orders from
├── supabase # Supabase directory containing functions to send push notifications
└── README.md## Get Started
- Create a [OneSignal app with Custom Code Setup](https://documentation.onesignal.com/docs/web-push-custom-code-setup)
- Rename `app/.env.example` to `app/.env.local` and add your Supabase URL, Anon Key, and OneSignal App ID.
- Run `supabase link --project-ref YOUR_SUPABASE_PROJECT_REF` to link the edge functions to your Supabase project
- Set environment variables for edge functions
- Rename `supabase/.env.example` to `supabase/.env`
- Add your OneSignal App ID, User Auth Key, and REST API Key
- Run `supabase secrets set --env-file ./supabase/.env`
- Deploy the `notify` edge function by running `supabase functions deploy notify --no-verify-jwt`
- Run the SQL below to create the `orders` table
- Setup [Database Webhooks](https://supabase.com/docs/guides/database/webhooks) to call the edge function when a new row is inserted into `orders` table```sql
create table if not exists public.orders (
id uuid not null primary key default uuid_generate_v4(),
created_at timestamptz not null default now(),
user_id uuid not null default auth.uid(),
price int8 not null
);
```## Running the app locally
Run the following command to start the Next.js app
```bash
cd appnpm install
npm run dev
```