Docs
Everything you need to send push notifications with edgepush.
1. Install the SDK
pnpm add @edgepush/sdk
# or npm install @edgepush/sdk
# or bun add @edgepush/sdk2. Create an app in the dashboard
Sign up at edgepush.dev, create an app with your package name (for example io.akshit.myapp), and generate an API key. Copy the key immediately - it's shown only once.
3. Upload APNs and FCM credentials
Under your app's Credentials tab, upload your APNs .p8 key (Apple Developer portal -> Keys) and your Firebase service account JSON (Firebase console -> Project settings -> Service accounts -> Generate new private key).
Both are encrypted with AES-GCM before being written to the database. The raw key material is never exposed back to you or to anyone else via the API.
4. Send your first push
import { Edgepush } from "@edgepush/sdk";
const client = new Edgepush({
apiKey: "io.akshit.myapp|abc123...",
});
const ticket = await client.send({
to: deviceToken, // APNs hex token or FCM registration token
title: "Hello",
body: "From edgepush",
data: { url: "myapp://home" },
});
console.log(ticket.id); // save this to poll the receipt later5. Check delivery status
After you send, poll the receipt to see whether APNs or FCM accepted the message:
const receipt = await client.getReceipt(ticket.id);
if (receipt.status === "delivered") {
console.log("sent!");
} else if (receipt.status === "failed") {
console.log("failed:", receipt.error);
if (receipt.tokenInvalid) {
// Remove the token from your database
}
}Batch sends
Send up to 100 messages in a single call. Dispatched through a Cloudflare Queue with automatic retries.
const tickets = await client.sendBatch([
{ to: token1, title: "Hi Alice" },
{ to: token2, title: "Hi Bob" },
]);
const receipts = await client.getReceipts(tickets.map((t) => t.id));REST API
The SDK wraps a simple REST API. You can call it directly from any language. All endpoints require Authorization: Bearer <api_key>.
# Send
curl -X POST https://api.edgepush.dev/v1/send \
-H "Authorization: Bearer io.akshit.myapp|abc..." \
-H "Content-Type: application/json" \
-d '{
"messages": [{
"to": "DEVICE_TOKEN",
"title": "Hello",
"body": "World"
}]
}'
# Get a receipt
curl https://api.edgepush.dev/v1/receipts/TICKET_ID \
-H "Authorization: Bearer io.akshit.myapp|abc..."Self-hosting
edgepush is MIT licensed and runs entirely on Cloudflare. Clone the repo and deploy with Wrangler:
git clone https://github.com/akshitkrnagpal/edgepush.git
cd edgepush
pnpm install
# Create D1 database, KV namespace, Queue
cd apps/api
wrangler d1 create edgepush
wrangler kv namespace create CACHE
wrangler queues create edgepush-dispatch
# Update the IDs in wrangler.jsonc, then:
wrangler d1 migrations apply edgepush --remote
wrangler secret put ENCRYPTION_KEY
wrangler secret put BETTER_AUTH_SECRET
wrangler deploy