Mainly used as a learning project for me to learn Go and Web Push Notifications. This service only sends the notifications using the existing subscribers. It does not handle the subscription process.
A Go-based notification service that sends web push notifications for World Boss events, occurring every 3.5 hours.
- 🕒 Automated timing system for World Boss events
- 🔔 Web push notifications 5 minutes before each event
- 📊 PostgreSQL database for subscription management
- 🔐 Secure VAPID-based push notifications
- Go 1.23.4 or higher
- PostgreSQL database
- VAPID keys for web push notifications
- Clone the repository:
git clone https://github.com/paulgeorge35/go-crons
cd go-crons
- Install dependencies:
go mod download
- Create a
.env
file based on.env.example
:
cp .env.example .env
- Configure your environment variables in
.env
:
DATABASE_URL=your_postgresql_url
FIRST_EVENT_TIME=initial_event_timestamp
VAPID_PUBLIC_KEY=your_vapid_public_key
VAPID_PRIVATE_KEY=your_vapid_private_key
VAPID_SUBSCRIBER=your_vapid_subscriber
go run cmd/main.go
The service will:
- Connect to the PostgreSQL database
- Calculate the next event time
- Send notifications to all subscribers 5 minutes before each event
- Continue running on a 3.5-hour cycle
The service uses a single table for storing subscriptions:
CREATE TABLE subscriptions (
id TEXT PRIMARY KEY,
subscription JSONB NOT NULL
);
Feel free to open issues and pull requests for any improvements.
This project is licensed under the MIT License - see the LICENSE.md file for details.
Paul George - [email protected]
Project Link: https://github.com/paulgeorge35/go-crons