Skip to content
/ sanpush Public

Free Web Push Notification Updates: Just Subscribe to receive notifications.

License

Notifications You must be signed in to change notification settings

mskian/sanpush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanpush 📲

Free Web Push Notification Updates: Just Subscribe to receive notifications.

Built with

Usage and Features

  • API Routes for /api/subscribe, /api/unsubscribe, /api/resubscribe, /api/send-notification
  • All Client Subscribed data was stored in db folder in jSON File Format
  • Automatically removed and Update inactive client tokens in JSON File
  • Bearer Token Support for Send Notification API Route
  • Clone or Download the Repo
  • install dependencies (pnpm recommended)
# dev server
pnpm dev

# Production server
pnpm start
  • Fully Self-Hosted no third party sdk or api not required
  • Generate web push vapid key
npx web-push generate-vapid-keys [--json]
  • Create db folder for store client tokens
mkdir -p db
  • index.js - add vapid key details and Email-ID
  • src/middleware/auth.js add custom key for Bearer Auth Header
  • public/sw.js Update your Website URL
  • public/main.js Update your PUblic Vapid Key
  • Send Push NOtification to all clients
curl -X POST http://localhost:5024/api/send-notification -H "Authorization: Bearer YOURKEY" -H "Content-Type: application/json" -d '{"title": "First Push", "body": "Hello World"}'

Known issues

Credits

LICENSE

MIT