MCPSERV.CLUB
ntfy

ntfy

Self-Hosted

Send push notifications via HTTP scripts

Active(100)
26.9kstars
0views
Updated 3 days ago
ntfy screenshot 1
1 / 5

Overview

Discover what makes ntfy powerful

**ntfy** is a lightweight, HTTP‑based publish/subscribe notification service written in Go. From a developer’s standpoint it exposes a RESTful API that accepts `PUT` or `POST` requests and pushes the payload to all active subscribers of a topic. Topics are created on demand; subscribing or publishing creates the namespace automatically, making it trivial to bootstrap a notification channel without any provisioning steps. The service is designed for high concurrency, leveraging Go’s goroutine model and an in‑memory message queue backed by a durable append‑only log on disk. This architecture allows ntfy to handle thousands of simultaneous connections with minimal latency while ensuring that messages are persisted until delivery or TTL expiration.

Language & Runtime

Networking

Data Layer

Pub‑Sub Engine

Overview

ntfy is a lightweight, HTTP‑based publish/subscribe notification service written in Go. From a developer’s standpoint it exposes a RESTful API that accepts PUT or POST requests and pushes the payload to all active subscribers of a topic. Topics are created on demand; subscribing or publishing creates the namespace automatically, making it trivial to bootstrap a notification channel without any provisioning steps. The service is designed for high concurrency, leveraging Go’s goroutine model and an in‑memory message queue backed by a durable append‑only log on disk. This architecture allows ntfy to handle thousands of simultaneous connections with minimal latency while ensuring that messages are persisted until delivery or TTL expiration.

Architecture

  • Language & Runtime: Pure Go (1.20+), compiled to a single static binary that runs on any platform with a compatible OS kernel.
  • Networking: Exposes an HTTPS endpoint (TLS termination optional; can be delegated to a reverse proxy).
  • Data Layer: Uses a lightweight file‑based key/value store (BoltDB/Badger) for topic metadata and message persistence. The log‑structured storage guarantees crash safety and fast sequential writes, which is ideal for push workloads.
  • Pub‑Sub Engine: Internally implements a fan‑out model where each topic maintains a list of active WebSocket or long‑poll connections. Delivery guarantees are at least once with optional acknowledgments for critical workflows.
  • Extensibility: The core is intentionally minimal; hooks are exposed for custom authentication, rate limiting, and message filtering via middleware. The API is documented on pkg.go.dev and a dedicated /docs/ section provides examples in multiple languages (Go, Python, JavaScript, PowerShell).

Core Capabilities

  • REST API: PUT /<topic> or POST /<topic> with optional headers (Content-Type, Priority, Tags, Icon, Attachment) to enrich notifications.
  • WebSocket/HTTP Long‑Poll: Clients subscribe via GET /<topic> which upgrades to WebSocket if supported, otherwise falls back to HTTP streaming.
  • Priorities & Actions: Supports priority levels (low, normal, high, urgent) that map to native notification styles on Android/iOS/desktop. Action buttons can trigger webhook callbacks or custom URLs.
  • Attachments: Binary payloads (images, files) can be uploaded alongside text notifications; the server streams them to clients with proper MIME handling.
  • Topic Lifecycle: Topics expire after a configurable TTL if no activity occurs, freeing resources automatically.
  • Metrics & Health: Exposes Prometheus metrics (ntfy_http_requests_total, ntfy_messages_sent) and a /healthz endpoint for readiness probes.

Deployment & Infrastructure

  • Self‑Hosting: A single binary plus a configuration file (config.yaml) is sufficient. The app can run in Docker, Kubernetes, or directly on a VM/VMware instance.
  • Containerization: Official Docker images are available on Docker Hub (binwiederhier/ntfy). They expose the default port 80 (or 443 for TLS) and are compatible with Helm charts or custom manifests.
  • Scalability: Because each node owns its own topics, horizontal scaling is achieved via a shared storage layer (e.g., NFS or Ceph) and a load balancer that routes to the correct node based on topic hashing. The stateless nature of the HTTP endpoints makes it trivial to add replicas.
  • High Availability: Pair with a reverse proxy (Traefik, Nginx) that handles TLS termination and can perform health checks. The built‑in /healthz endpoint ensures graceful draining during rolling updates.

Integration & Extensibility

  • SDKs: The Go client library (heckel.io/ntfy/v2) mirrors the API and can be embedded in services for tighter integration.
  • Webhooks: Notifications can trigger external HTTP callbacks, enabling automation pipelines (e.g., Slack alerts, PagerDuty incidents).
  • Plugins: The server accepts custom middleware via the --plugins flag, allowing developers to plug in authentication backends (OAuth2, JWT), rate limits, or custom routing logic.
  • Custom Topics: With ntfy Pro you can reserve topic names, preventing accidental namespace collisions in shared environments.
  • CLI & SDKs: The bundled ntfy CLI (available on all major OSes) can be scripted in CI/CD pipelines, and the library supports typed payloads for strongly‑typed languages.

Developer Experience

  • Documentation: The official docs are hosted at https://ntfy.sh/docs/ and cover all aspects from basic usage to advanced configuration.
  • Community: Active Discord, Matrix rooms, and a dedicated GitHub Discussions forum provide quick support.
  • Testing: The repository includes comprehensive unit and integration tests, with CI running on GitHub Actions.
  • Open Source Licensing: Released under Apache‑2.0, allowing commercial use without attribution requirements while preserving contributor rights.

Use Cases

  1. Infrastructure Monitoring – Emit alerts from Prometheus or custom scripts to a mobile device for on‑call engineers.
  2. Home Automation – Push sensor events (motion, door open) to a phone or desktop with actionable buttons (e.g., “Turn on lights”).
  3. **CI/CD

Open SourceReady to get started?

Join the community and start self-hosting ntfy today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
apis-services
License
APACHE-2.0
Stars
26.9k
Technical Specs
Pricing
Open Source
Docker
Dockerfile
Supported OS
LinuxDocker
Author
binwiederhier
binwiederhier
Last Updated
3 days ago