ntfy Hosting on Hostim.dev
ntfy is an open-source push notification server. You send a message with a plain HTTP request, for example curl -d "Backup done" https://ntfy.example.com/backups, and every phone or browser that subscribes to the topic backups gets it. There are apps for Android and iOS, and a web app.
ntfy is a single Go binary. It keeps users, access rules and recent messages in a database: SQLite files by default, or PostgreSQL. Attachments are stored as files.
Self-host ntfy with Docker Compose (minimal)
services:
ntfy:
image: binwiederhier/ntfy:v2.38.3
command: serve
restart: unless-stopped
ports:
- "127.0.0.1:8080:80"
volumes:
- ./ntfy/attachments:/var/lib/ntfy/attachments
environment:
NTFY_BASE_URL: https://ntfy.example.com
NTFY_DATABASE_URL: postgres://ntfy:change-me@db:5432/ntfy
NTFY_AUTH_DEFAULT_ACCESS: deny-all
NTFY_ENABLE_LOGIN: "true"
NTFY_BEHIND_PROXY: "true"
NTFY_ATTACHMENT_CACHE_DIR: /var/lib/ntfy/attachments
depends_on:
- db
db:
image: postgres:17
restart: unless-stopped
volumes:
- ./ntfy/db:/var/lib/postgresql/data
environment:
POSTGRES_DB: ntfy
POSTGRES_USER: ntfy
POSTGRES_PASSWORD: change-me
ntfy creates its tables on the first start. With deny-all nobody can read or write a topic until you add a user: docker compose exec ntfy ntfy user add --role=admin admin. For HTTPS you need a reverse proxy with a certificate in front of port 8080. More stacks are in our Docker Compose library.
Deploy ntfy on Hostim.dev (One-Click)
The hosted route: no VPS, no proxy, no certificates. The template runs the official image with a PostgreSQL database, a volume for attachments, a domain and HTTPS. It creates the admin account for you.
Guest project runs for 1 hour. Log in to save and extend to 5 days.
Why Host ntfy on Hostim.dev?
- One-click deployment of the official ntfy image
- Users, access rules and messages in a managed PostgreSQL database
- Admin account with a random password, ready when the app starts
- Anonymous access off: the URL alone does not open any topic
- Automatic HTTPS and domain
What's included
| Resource | Details |
|---|---|
| App | binwiederhier/ntfy:v2.38.3 Docker image |
| Database | PostgreSQL |
| Volume | /var/lib/ntfy (attachments) |
| Domain | Free *.hostim.dev subdomain |
| SSL | Let’s Encrypt (auto-enabled) |
| Port | 80 |
The template sets these environment variables:
| Variable | Value |
|---|---|
NTFY_ADMIN_PASSWORD | Random, generated at deploy. Password of the admin user |
NTFY_BASE_URL | Your app URL with https:// |
NTFY_DATABASE_URL | Connection to the PostgreSQL database |
NTFY_AUTH_DEFAULT_ACCESS | deny-all: anonymous visitors cannot read or write any topic |
NTFY_ENABLE_LOGIN | true: the web app shows a login |
NTFY_REQUIRE_LOGIN | true: the web app asks for a login before anything else |
NTFY_BEHIND_PROXY | true: ntfy reads the real client IP for its rate limits |
NTFY_ATTACHMENT_CACHE_DIR | /var/lib/ntfy/attachments, on the volume |
At every start, the template turns NTFY_ADMIN_PASSWORD into a password hash and passes it to ntfy as a provisioned admin user (NTFY_AUTH_USERS).
How to Deploy
- Go to your Hostim.dev dashboard.
- Click Create Project → Use a Template.
- Select ntfy.
- Choose a resource plan.
- Deploy.
- Open the app's environment variables and copy
NTFY_ADMIN_PASSWORD. - Open the app URL and log in as
adminwith that password. - Send a test message:
curl -u admin:YOUR_PASSWORD -d "Hello from ntfy" https://YOUR_APP_URL/test
- In the ntfy app on your phone, add your server under Settings → Manage users, then subscribe to
teston your server.
FAQ
Where does ntfy store its data?
Users, access rules, access tokens and recent messages are in the
PostgreSQL database. Attachments are files on the /var/lib/ntfy
volume. We published messages and an attachment, then restarted the app
three times. The messages, the users, their access rules and the
attachment were all still there.
How do I change the admin password?
Change NTFY_ADMIN_PASSWORD in the app's environment variables
and redeploy. The new password works after the restart and the old one
stops working. The web app cannot change the admin password, because the
admin is a provisioned user: ntfy answers "cannot change or delete
provisioned user".
How do I add more users?
Open a shell in the app and use the ntfy CLI. It reads the database URL from the environment, so the users go into PostgreSQL:
NTFY_PASSWORD=their-password ntfy user add alice
ntfy access alice alerts rw
ntfy user listThis gives alice read and write access to the topic
alerts and nothing else. Use ro for read-only.
To send from a script without a password, create a token with
ntfy token add alice and send it as
Authorization: Bearer tk_....
How long are messages and attachments kept?
With the defaults, messages are kept for 12 hours, so a phone that was
offline gets them when it comes back. Attachments are deleted after 3 hours.
One attachment can be up to 15 MB, and one user (or one IP address) can keep
up to 100 MB of attachments at a time. Change these with NTFY_CACHE_DURATION,
NTFY_ATTACHMENT_EXPIRY_DURATION,
NTFY_ATTACHMENT_FILE_SIZE_LIMIT and
NTFY_VISITOR_ATTACHMENT_TOTAL_SIZE_LIMIT.
Why did my long message arrive as a file?
A message can be up to 4 KB. ntfy turns a longer one into an attachment
called attachment.txt. We sent 6,000 characters and got
"You received a file: attachment.txt". Raise the limit with
NTFY_MESSAGE_SIZE_LIMIT. Phone push services only take about
4 KB, so long messages may still be cut on the phone.
Do iOS notifications arrive instantly?
Not by default. Apple only delivers instant notifications through its own
push service, and the iOS app gets those through ntfy.sh. Set
NTFY_UPSTREAM_BASE_URL to https://ntfy.sh and
redeploy. Your server then sends ntfy.sh only a poll request with the
message ID, and the phone fetches the message from your server. Without
it, iOS delivery can take minutes or hours. Android does not need this:
the app keeps its own connection to your server.
How do I turn on browser notifications (Web Push)?
Run ntfy webpush keys in a shell in the app. Set the keys it
prints as NTFY_WEB_PUSH_PUBLIC_KEY and
NTFY_WEB_PUSH_PRIVATE_KEY, set
NTFY_WEB_PUSH_EMAIL_ADDRESS to your email address, and
redeploy. The subscriptions are stored in PostgreSQL.
How do I use my own domain?
Add the domain to the app in the Hostim.dev dashboard and point a DNS record
at it. HTTPS is set up for it automatically. Then change
NTFY_BASE_URL to the new address, with https://,
and redeploy. ntfy uses it for attachment links, Web Push and instant iOS
notifications. It must match the address your phones subscribe to.
How do I update ntfy?
Read the release notes, back up the database, change the image tag to a newer release and redeploy. ntfy updates the database tables on start.
Alternatives
- Uptime Kuma — uptime monitoring that can send its alerts to ntfy
- Gotify — self-hosted push server with its own Android app
- Apprise — one API that forwards notifications to many services
Source + Docs
- GitHub: https://github.com/binwiederhier/ntfy
- Docs: https://docs.ntfy.sh/
Looking for something else? Browse all templates →