Build OneSignal
KINDAreplaces $19/mosaves $228/yrback to the verdict
Web push notifications you own: VAPID keys, a service worker, permission asked only after a click, a subscriptions table, a send function that prunes dead endpoints, an admin to compose and schedule, simple segments by tag, and mobile adapters only if you have a native app.
Before step 1
Everything below is assumed from the first step. Tick each one when you actually have it, not when you plan to.
- installfree
Why Everything in this build runs on it: the server, the scripts, the tests.
Get it Download the LTS installer from nodejs.org, or install with your package manager (brew install node, or nvm install 22). Restart the terminal afterwards. open ↗
Verify
node --version prints v22 or higher - installfree
Why Every step below is a command you type or a file you edit.
Get it VS Code (code.visualstudio.com), Cursor or Zed. Open a folder for the project and use the editor's built-in terminal. open ↗
Verify
You can open a folder and run a command in its terminal - installfree
Why History for your code, and the way most hosts deploy.
Get it Install from git-scm.com or with your package manager, then run git init in the project folder once it exists. open ↗
Verify
git --version prints a version - have readyfree
Why Push requires HTTPS and a service worker on the site's origin.
Get it Your site, or a local HTTPS dev setup with mkcert.
- decidefree
Why Changing them invalidates every subscription.
Get it npx web-push generate-vapid-keys, into .env.
- installfree
Why Push on mobile behaves differently.
Get it Android Chrome, or iOS Safari with the site installed to the home screen.
- API keyfree with the developer accounts
Why Only for a native app in Phase 5.
Get it Firebase console service account; Apple Developer APNs key.
- accountabout $5 a month
Why This needs one process running all the time with a public address.
Get it Hetzner Cloud (from about 4 EUR), DigitalOcean or Fly.io. Ubuntu 24.04, the smallest size. You need SSH access and a public IP. Only needed for the deploy phase; develop locally first. open ↗
- accountroughly $10 a year, or free on an existing domain
Why A public address you own, so links you share never break when a provider changes.
Get it Register at Cloudflare Registrar, Porkbun or Namecheap, or use a subdomain of one you already own. You add one DNS record in the deploy phase. open ↗
- installfree
Why Automatic HTTPS in front of the Node process. Without TLS the browser features this relies on (and your visitors' trust) do not work.
Get it On the VPS: follow the install steps at caddyserver.com/docs/install for Ubuntu. One Caddyfile with your domain and a reverse_proxy line is the whole config. open ↗
Verify
caddy version prints a version on the server
Data model
Create these before the first phase that stores anything. Changing a table later is the expensive kind of change.
- subscriptions: id, endpoint (unique), keys_p256dh, keys_auth, user_id (nullable), created_at, last_seen_at, failed_count - sends: id, title, body, url, created_at, targeted, delivered, failed
Environment variables
These go in a .env file the app reads at startup. The pack's .env.example is this table as a file · copy it, never commit the filled-in version.
| Variable | Needed | Example | Where the value comes from |
|---|---|---|---|
PORT | required | 3000 | Any free port. |
DATABASE_PATH | required | ./data/push.db | SQLite file. |
VAPID_PUBLIC_KEY | required | B... | From web-push generate-vapid-keys; also shipped to the browser. |
VAPID_PRIVATE_KEYsecret | required | ... | Server only. |
VAPID_SUBJECT | required | mailto:you@yourdomain.com | Contact for push services. |
ADMIN_USER | required | admin | Any username for the basic-auth admin pages. |
ADMIN_PASSsecret | required | change-me-to-a-long-random-string | Generate one: openssl rand -base64 24. Never reuse a real password. |
The build, in order
Keys and subscribe
Permission after a click, one row per subscription, unsubscribe works.
Files
public/sw.jsterminalmkdir push && cd push && git init && npm init -y && npm pkg set type=module && npm install web-push@3 mkdir -p data && cp .env.example .env npx web-push generate-vapid-keys
done when · tick each as it passesSend
Admin
Scheduling and segments
Mobile, only if needed
Operate it like a productproduct builder
Only for the product-builder path: know when the push server is down, never lose the database, and keep the server patched.
Answer 200 with the build id and a quick database read. Point a free uptime monitor (or your own, from the Healthchecks entry on this site) at it so an outage is noticed before a user notices.
One JSON line per request: method, path, status, duration, no raw IPs. Rotate weekly with logrotate, keep eight.
SQLite's .backup command makes a consistent copy while the app runs. Copy it to object storage or a second machine; then, once, restore it into a fresh checkout and confirm the app reads it.
terminalsqlite3 data/app.db ".backup '/tmp/app-$(date +%F).db'" rclone copy /tmp/app-$(date +%F).db remote:backups/
Firewall allowing only 22, 80 and 443; unattended security updates on; the app running as an unprivileged user under systemd with Restart=on-failure.
done when · tick each as it passes
That is the whole plan for OneSignal. What it deliberately does not cover is below · check the gaps before you call it a replacement.
- Journeys, A/B tests, cross-channel analytics, email and SMS.
- segmentation, journeys and A/B testing
- delivery analytics across channels
- SDKs for every platform maintained for you
- email and SMS in the same tool
- A quiet-hours rule per subscriber timezone
- Per-topic subscriptions
Need the files? The project pack on the verdict page hands your agent the whole brief · more dev tools.