A clean, minimal Progressive Web App demonstrating real-time Web Push Notifications across all devices.
Demo: Open on multiple devices. One device sends a message, others receive push notifications instantlyβeven when the app is closed.
- Cross-Platform - iPhone (iOS 16.4+), Android, Desktop browsers
- Real-Time Push - Instant notifications to all subscribed devices
- PWA Ready - Installable on home screen
- Self-Hosted - No Firebase, no third-party services
- MongoDB Backed - Persistent cloud storage
- Secure - VAPID authentication, Helmet security headers, rate limiting
- Modern Slate UI - Responsive masonry layout with dark/slate aesthetic and smooth animations
- Open Source - MIT licensed
Frontend: Vanilla JS, Service Worker API, Web Push API, PWA Manifest Backend: Node.js, Express, MongoDB, web-push DevOps: Helmet, Morgan, Express Rate Limit, Husky, ESLint, Prettier
- Node.js 20+ and pnpm
- MongoDB Atlas account (free tier works)
git clone https://github.com/Marmik-Soni/PushFlow.git
cd PushFlow
pnpm install-
MongoDB Atlas:
- Create free cluster at MongoDB Atlas
- Get connection string
-
Generate VAPID Keys:
pnpm exec web-push generate-vapid-keys -
Setup Environment:
cp .env.example .env # Edit .env with your MongoDB URI and VAPID keys
pnpm dev # Start with auto-reload
pnpm lint # Check code quality
pnpm format # Format codeVisit http://localhost:3000
| Platform | Browser | Support | Notes |
|---|---|---|---|
| iPhone | Safari, Chrome, Firefox, Edge | β iOS 16.4+ | Requires PWA installation |
| Android | Chrome, Firefox, Edge | β | Works in browser |
| Desktop | Chrome, Firefox, Edge | β | Works in browser |
| macOS | Safari | β Ventura+ | Works in browser |
- Open
http://localhost:3000in your browser - Click "Enable Notifications"
- Allow notifications when prompted
- Open
http://localhost:3000in Safari - Tap Share button β "Add to Home Screen"
- Open PushFlow from home screen
- Click "Enable Notifications"
curl -X POST http://localhost:3000/send-notification \
-H "Content-Type: application/json" \
-d '{"title":"Hello!","body":"Test notification","icon":"/icons/icon-192.png"}'| Method | Endpoint | Description |
|---|---|---|
POST |
/subscribe |
Register new push subscription |
POST |
/unsubscribe |
Remove push subscription |
POST |
/send-notification |
Broadcast push notification |
GET |
/devices |
List all subscribed devices |
GET |
/vapid-public-key |
Get VAPID public key |
GET |
/health |
Health check |
| Variable | Description | Required |
|---|---|---|
MONGODB_URI |
MongoDB connection string | β |
MONGODB_DB_NAME |
Database name | β |
VAPID_PUBLIC_KEY |
VAPID public key | β |
VAPID_PRIVATE_KEY |
VAPID private key | β |
VAPID_SUBJECT |
mailto: or https:// URL | β |
PORT |
Server port (default: 3000) | β |
LOG_FORMAT |
Morgan log format (default: dev) | β |
RATE_LIMIT_WINDOW_MS |
Rate limit window (default: 60000) | β |
RATE_LIMIT_MAX_REQUESTS |
Max requests (default: 100) | β |
- Helmet.js - Security headers (XSS, HSTS, etc.)
- Rate Limiting - Protects API endpoints
- Morgan - HTTP request logging
-
Push to GitHub (already done β )
-
Import to Vercel:
- Go to vercel.com/new
- Import your GitHub repository
- Vercel will auto-detect the configuration
-
Add Environment Variables:
MONGODB_URI=your_mongodb_connection_string MONGODB_DB_NAME=pushflow VAPID_PUBLIC_KEY=your_public_key VAPID_PRIVATE_KEY=your_private_key VAPID_SUBJECT=mailto:your-email@example.com -
Deploy - Click "Deploy" and you're live! π
- Netlify / Render - Connect GitHub, add env vars, deploy
- Railway / Fly.io - One-click deploy with MongoDB Atlas
- VPS / Docker - Standard Node.js deployment
pnpm dev # Start with auto-reload
pnpm lint # Check code quality
pnpm format # Format code
pnpm format:check # Check formattingPre-commit hooks (Husky):
- ESLint check
- Prettier format check
- Conventional commits validation
Contributions are welcome! Please read CONTRIBUTING.md for details.
- Fork the repository
- Create a feature branch:
git checkout -b feat/amazing-feature - Commit:
git commit -m "feat: add amazing feature" - Push:
git push origin feat/amazing-feature - Open a Pull Request
MIT License - see the LICENSE file for details.
See SECURITY.md for reporting vulnerabilities.
Marmik Soni
- Email: marmiksoni777@gmail.com
Give a βοΈ if this project helped you!
Questions or feedback? Open an issue on GitHub!
Happy Pushing! π