Back to articles
AI & Cloud

Building a Push Notification System from Storage with ntfy.sh: Optimized Solution for Businesses and Developers

Detailed guide to building a push notification system from self-hosted storage using ntfy.sh, an efficient, low-cost solution for businesses and developers.

DPTCloud Engineering4 min read
Building a Push Notification System from Storage with ntfy.sh: Optimized Solution for Businesses and Developers

Building a Push Notification System from Storage with ntfy.sh

In software development and business operations, receiving instant notifications from self-hosted systems is essential for performance and rapid response. ntfy.sh is an open-source, lightweight, and easy-to-deploy solution that enables you to send push notifications from any server—whether a VPS or dedicated machine—to mobile devices, computers, or supported applications. This guide walks you through building a push notification system from personal storage using ntfy.sh, offering a cost-effective and secure approach.

Why Choose ntfy.sh?

ntfy.sh is a self-hosted service that runs on any server supporting Docker or Node.js. It allows you to:

  • Send notifications to mobile devices via Android/iOS apps (or browsers).
  • Integrate with automation systems such as CI/CD pipelines, cron scripts, or REST APIs.
  • Operate without third-party accounts or user data collection.
  • Cost nothing when self-hosted on a VPS or dedicated server.

Prerequisites and Initial Setup

To deploy ntfy.sh, you need:

  • A server (VPS or Dedicated Server) running Linux (Ubuntu/Debian recommended).
  • Docker or Node.js installed (your choice).
  • SSH access to the server.
  • A domain name or public IP (preferably a domain for easier management).

Visit the official ntfy.sh website at https://ntfy.sh for full documentation.

Deploying ntfy.sh on a VPS

Below is a Docker deployment guide for ntfy.sh on a VPS:

docker run -d \
  --name ntfy \
  -p 80:80 \
  -p 443:443 \
  -v /path/to/data:/data \
  -e NTFY_HOST=your-domain.com \
  -e NTFY_AUTH_USER=admin \
  -e NTFY_AUTH_PASS=yourpassword \
  ntfy/server:latest

Replace:

  • /path/to/data: Path for data storage (e.g., /home/ntfy/data).
  • your-domain.com: Your VPS domain or public IP.
  • admin and yourpassword: Your login credentials.

Sending Notifications from Storage

Once ntfy.sh is running, send notifications using cURL or REST API. Example:

curl -X POST -d "Hello from your server!" https://your-domain.com/notify

Send with specific headers and content:

curl -X POST \
  -H "Title: System Error" \
  -H "Priority: high" \
  -d "Server down at 14:30" \
  https://your-domain.com/notify

Integration with GitLab CI/CD or Automation Scripts

Use ntfy.sh in CI/CD pipelines to notify of build success or failure:

notify_success:
  script:
    - echo "Build successful"
    - curl -X POST -d "Build completed successfully!" https://your-domain.com/notify

notify_failure:
  script:
    - echo "Build failed"
    - curl -X POST -d "Build failed: $CI_JOB_NAME" https://your-domain.com/notify

Verification and Testing

After deployment, verify by:

  1. Opening a browser and visiting https://your-domain.com.
  2. Sending a test notification via cURL.
  3. Ensuring the ntfy.sh app (Android/iOS) is installed.
  4. Logging in and subscribing to the notify topic.

Optimized Solution for Businesses and Developers

ntfy.sh helps businesses and developers:

  • Reduce costs compared to third-party push notification services like Firebase or OneSignal.
  • Retain full control over data and information.
  • Deploy quickly on VPS or dedicated servers.
  • Seamlessly integrate with other self-hosted systems like GitLab CI/CD, NixOS, or AI code reviewers.

For businesses, self-hosting ntfy.sh reduces dependency on external services and ensures internal data security. With near-zero cost, it’s an ideal solution for small to medium-sized projects.

Troubleshooting

  • Not receiving notifications? Check that ports 80/443 are open and not blocked by a firewall.
  • Can't log in? Verify the NTFY_AUTH_USER and NTFY_AUTH_PASS environment variables.
  • Notifications not showing? Ensure the ntfy.sh app is subscribed to the correct topic (e.g., notify).

References

Related infrastructure & engineering guides: High-RAM Cloud VPS for Self-Hosted LLMs & API Gateways

DPTCloud Tier III Infrastructure

High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02Recommended

VPS-4E

297.000 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe
ECO · vn-02

VPS-5E

614.900 ₫ / mo

10% VAT included

  • CPU: 8 vCPU
  • RAM: 16 GB
  • SSD: 100 GB NVMe
ADVANCED · vn-03Recommended

VPS-4T

548.900 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478