DEV Community

Cover image for Building Namma Push: The Open‑Source, Pure‑Rust Alternative to Firebase Cloud Messaging
Black Lover
Black Lover

Posted on

Building Namma Push: The Open‑Source, Pure‑Rust Alternative to Firebase Cloud Messaging

πŸ“± The Push Notification Problem

Every modern app needs to send push notifications. Whether it’s a ride‑hailing service alerting a driver of a new trip, a fintech app confirming a payment, or a messaging app delivering a chat message β€” notifications are critical.

The industry standard is Firebase Cloud Messaging (FCM) from Google. It’s easy to set up, works across platforms, and is free for moderate usage. But as your app grows, FCM’s limitations become painful:

  • Data privacy β€” Google sees who you’re messaging and when.
  • Cost β€” At scale, FCM can cost $50–100 per million notifications.
  • Latency β€” 200–2000ms is common, especially for cross‑platform messages.
  • Lock‑in β€” Your entire notification infrastructure is tied to Google’s ecosystem.
  • No direct Android connection β€” FCM goes through Google Play Services, which doesn’t work on devices without Google (e.g., in China).

And on iOS, FCM is just a wrapper around Apple’s APNs, adding another hop and more latency.

What if you could have full control over your notification infrastructure? What if you could deploy your own push server, connect directly to devices, and achieve sub‑10ms latency β€” all while keeping your data private and reducing costs by 70%?

That’s exactly what we built with Namma Push.


πŸš€ What Is Namma Push?

Namma Push is an open‑source, self‑hosted push notification platform written entirely in Rust. It replaces FCM and APNs with a unified, high‑performance system that you run on your own infrastructure.

Key capabilities:

  • Direct gRPC/QUIC connections to mobile, web, desktop, and IoT devices β€” no third‑party intermediary.
  • Sub‑50ms P99 latency for active clients (often sub‑10ms).
  • WhatsApp‑style wake‑up β€” optional FCM/APNs messages to wake apps that are killed, while the actual notification content stays private.
  • Horizontal scalability β€” from 10,000 to millions of concurrent connections using Redis Cluster.
  • One Rust core β€” shared code for all client SDKs (iOS, Android, Web, Desktop, IoT).
  • Full observability β€” Prometheus, Grafana, Jaeger, Loki included.
  • Multi‑tenant β€” host many applications on a single cluster with isolated rate limits and API keys.
  • Cost‑efficient β€” self‑hosted, pay only for your own infrastructure (70%+ savings compared to FCM).

πŸ—οΈ Architecture Overview

Namma Push is designed as a cloud‑native, horizontally scalable system. Here’s a high‑level view:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Producer Applications                       β”‚
β”‚          (gRPC / REST with API Key)                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Namma Push Gateway (Rust / tonic)                 β”‚
β”‚   β€’ gRPC server (port 50051)                                β”‚
β”‚   β€’ QUIC/HTTP3 (port 50052)                                 β”‚
β”‚   β€’ REST Admin API (port 9090)                              β”‚
β”‚   β€’ Tenant validation, rate limiting, consistent hashing   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   Redis Cluster (Shared State)              β”‚
β”‚   β€’ Priority streams (CRITICAL / HIGH / NORMAL / LOW)      β”‚
β”‚   β€’ Dead Letter Queue (DLQ)  β€’ Wake‑Up Queue                β”‚
β”‚   β€’ Presence store (active connections)                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Delivery Orchestrator (Rust Workers)          β”‚
β”‚   β€’ Per‑shard readers                                       β”‚
β”‚   β€’ Client presence check                                   β”‚
β”‚   β€’ Platform‑specific delivery (APNs, WebPush, MQTT)       β”‚
β”‚   β€’ Exponential backoff retries                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό                         β–Ό                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”           β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ iOS SDK   β”‚           β”‚ Android   β”‚           β”‚ Web SDK   β”‚
β”‚ (Swift +  β”‚           β”‚ (Kotlin + β”‚           β”‚ (WASM/JS) β”‚
β”‚  Rust)    β”‚           β”‚  Rust)    β”‚           β”‚           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Enter fullscreen mode Exit fullscreen mode

πŸ”Œ The Magic: One Rust Core for All Platforms

The heart of Namma Push is a single Rust library that handles:

  • gRPC/QUIC connections with automatic reconnection
  • Local storage of pending notifications (SQLite on mobile, IndexedDB on web)
  • Message queuing and delivery
  • Heartbeat management

This core is then wrapped for each platform:

  • Android: JNI bindings + Kotlin foreground service
  • iOS / macOS: C‑bridge + Swift (APNs token registration)
  • Web: WebAssembly (wasm-bindgen) + JavaScript service worker
  • Desktop: Native Rust (Tauri) or Electron
  • IoT: no_std Rust with MQTT or CoAP

Benefits of this approach:

  • Code reuse β€” the same networking and logic works everywhere.
  • Performance β€” Rust’s zero‑cost abstractions and memory safety.
  • Portability β€” the core runs on servers, browsers, and microcontrollers.

πŸ“± Android: Google‑Free Forever

One of the most exciting aspects of Namma Push is its Android implementation β€” it works completely without Google Play Services or FCM.

How It Works

  1. The Android SDK contains a foreground service with START_STICKY flag.
  2. This service maintains a persistent gRPC/QUIC connection to your Namma Push server.
  3. When the app is in the background or even swiped away, the service continues running (Android shows a persistent notification, which can be hidden on Android 14+).
  4. An AlarmManager health check restarts the service if it’s killed by aggressive battery optimisations.
  5. Notifications are delivered instantly over the gRPC connection.

No FCM, no Google Play Services required. Works on any Android device, even in China.

If you want an extra layer of reliability, you can optionally enable FCM as a wake‑up helper β€” but it’s not needed for most use cases.


πŸ“± iOS: Leveraging APNs Without Sacrificing Privacy

iOS is more restrictive: Apple does not allow long‑running background services. To wake an app that is killed, you must use APNs. But we use APNs only as a wake‑up channel β€” not to deliver the actual notification.

  1. The iOS SDK registers for remote notifications and sends the device token to your Namma Push server.
  2. When your server detects that the client is offline, it sends a silent APNs push (content-available: 1) with no user‑visible payload.
  3. The device receives this push, wakes the app (if allowed), and the app reconnects via gRPC to fetch pending notifications.
  4. All notification content stays on your server β€” Apple never sees the title, body, or data.

This gives you the reliability of APNs for wake‑up while keeping your data private.


🌐 Web Push: Native, No FCM Required

For web browsers, Namma Push uses the W3C Web Push Protocol with VAPID authentication β€” the same technology used by Chrome, Firefox, Edge, and Safari. No FCM, no external service.

  • The server generates its own VAPID keys.
  • The Web SDK (Rust compiled to WebAssembly) subscribes to push using those keys.
  • Notifications are sent directly from your server to the browser’s push service.

This is fully self‑contained and respects user privacy.


🧠 Smart Delivery & Offline Handling

Namma Push is not just a dumb relay β€” it’s intelligent about delivery.

  • Priority queues β€” CRITICAL, HIGH, NORMAL, LOW. Critical notifications bypass queues for immediate delivery.
  • Dead Letter Queue (DLQ) β€” Failed deliveries are stored with exponential backoff retries (1s, 2s, 4s, …). After 5 failures, they stay in the DLQ for manual inspection.
  • Wake‑up queues β€” Offline clients get a pending notification queue that is replayed as soon as they reconnect.
  • Local caching β€” SDKs store notifications locally (SQLite on mobile, IndexedDB on web) so they survive disconnections.

This ensures at‑least‑once delivery with minimal data loss.


πŸ“Š Performance & Scale

We built Namma Push to handle millions of devices. Here are the numbers from our benchmarks:

Metric Single Node Cluster (3 gateways + 6 Redis shards)
Concurrent connections 10,000 500,000+
Throughput (TPS) 1,000 50,000+
P99 latency (online client) <50ms <50ms
P99 latency (wake‑up via FCM/APNs) – <2s
Availability – 99.99% (multi‑AZ)

Horizontal scaling is trivial β€” just add more gateways and Redis shards.


πŸ› οΈ Observability Out of the Box

We believe in β€œyou build it, you run it”. Namma Push includes a full observability stack:

  • Prometheus metrics: active connections, delivery latency, queue sizes, error rates, per‑tenant usage.
  • Grafana dashboards pre‑built for operations and business metrics.
  • OpenTelemetry + Jaeger for distributed tracing.
  • Loki for log aggregation.

All components are open source and run alongside your Namma Push deployment.


πŸ”’ Security & Compliance

Because you host it yourself, you control the security:

  • TLS 1.3 for all external endpoints.
  • mTLS for internal service communication.
  • API keys (JWT) for backend authentication.
  • RBAC for admin UI (viewer, operator, admin).
  • Audit logs of all admin actions.
  • Designed to support GDPR (right to erasure), HIPAA (audit trails), and PCI‑DSS (segmentation).

No third party sees your notification metadata unless you explicitly choose to use FCM/APNs as optional fallbacks.


πŸ’Έ Cost Comparison

Let’s run some numbers. Suppose you send 100 million notifications per month:

  • FCM (or similar managed service): $5,000–10,000 per month (or β€œfree” but with quotas and limited analytics).
  • Namma Push self‑hosted on AWS (3 gateways + 6 Redis shards): ~$4,800 per month including all infrastructure.
  • Savings: $200–5,200 per month, or $2,400–62,400 per year.

And that’s without counting the value of having your own data, lower latency, and no lock‑in.


πŸš€ Roadmap & Getting Involved

Namma Push is currently in active development, following a 16‑week roadmap to a stable v1.0 release:

  • Phase 1 (Weeks 1‑5): Core engine β€” gRPC, Redis streams, basic delivery.
  • Phase 2 (Weeks 6‑10): Production features β€” FCM/APNs fallback, DLQ, Redis cluster, QUIC.
  • Phase 3 (Weeks 11‑14): Observability β€” Grafana, Jaeger, load testing, security hardening.
  • Phase 4 (Weeks 15‑16): UI & documentation β€” Vue.js admin UI, deployment guides, SDK examples.

We’re building this in the open. The code is on GitHub (coming soon), and we welcome contributions. Whether you’re a Rust developer, a mobile engineer, or just curious, there’s a place for you.


🎯 Why Namma Push Matters

Push notifications are the lifeblood of modern apps, yet we’ve been dependent on a handful of proprietary services. Namma Push changes that. It gives you:

  • Full control β€” your infrastructure, your data.
  • Superior performance β€” sub‑50ms latency, no third‑party hops.
  • Lower costs β€” self‑hosted, pay only for what you use.
  • Privacy by design β€” no one sees your users’ data.
  • Open source β€” inspect, modify, and contribute.

We believe every organisation deserves a notification platform that respects its sovereignty. Namma Push is our answer.


πŸ“š Try It Yourself

You can run Namma Push today (pre‑release) with Docker:

docker run -d -p 50051:50051 -p 9090:9090 nammayatri/namma-push:latest
Enter fullscreen mode Exit fullscreen mode

Then visit http://localhost:9090 to create your first tenant and get an API key. Integrate our SDKs (coming soon) and start sending notifications.

Together, we can make Namma Push the go‑to choice for developers who value control, privacy, and performance.

Namma Push β€” open source, self‑hosted, and ready for the world. πŸš€

Top comments (0)