← Back to Home

Run a Nostr Relay on Your Phone

Complete beginner's guide for Android users

📱 What You'll Need

An Android phone with at least 1GB of free storage. This guide works on any Android phone from the last 5+ years. No root required!

1

Install Termux

Termux is a terminal emulator for Android. It lets you run Linux commands on your phone - like having a mini computer in your pocket!

How to install:

  • Open the F-Droid app store on your phone
  • Don't have F-Droid? Download it from f-droid.org
  • Search for "Termux" in F-Droid
  • Tap "Install"
⚠️ Important: Use F-Droid, NOT Google Play Store

The Google Play Store version of Termux is outdated and won't work. Always use the F-Droid version.

2

Open Termux

Tap the Termux app to open it. You'll see a black screen with white text - this is your terminal!

You'll see a prompt that looks like this:

$

This $ symbol means Termux is ready for your commands.

3

Update Termux Packages

Before installing anything, let's make sure Termux is up to date. Type this command and press Enter:

pkg update && pkg upgrade

When asked "Do you want to continue? [Y/n]", type y and press Enter.

💡 What does this do?

This updates the list of available software and upgrades any outdated packages. Think of it like updating apps on your phone.

⏱️ This might take 1-2 minutes depending on your internet connection.

4

Install Node.js

Node.js is the software that runs fonstr. Install it with this command:

pkg install nodejs-lts

Press y when asked to confirm.

⏱️ This will take 2-3 minutes to download and install.

✅ How to know it worked: After installation, type node --version and you should see something like v20.11.0

5

Run Your Nostr Relay!

Now for the fun part! Run your relay with just one command:

npx fonstr

The first time you run this, it will:

  • Download fonstr (takes about 70 seconds)
  • Set up everything automatically
  • Start your Nostr relay!

✅ Success! When you see "Server listening at http://0.0.0.0:4444", your relay is running!

Your Nostr relay is now live at:

  • Relay URL: ws://localhost:4444/relay
  • Web interface: http://localhost:4444
6

Connect to Your Relay

You can now use your relay with any Nostr client! Here's how:

On the same phone:

  • Open your favorite Nostr app (Amethyst, Damus, etc.)
  • Go to Settings → Relays
  • Add relay: ws://localhost:4444/relay

From other devices on your WiFi:

  • Find your phone's IP address (Settings → About Phone → Status → IP Address)
  • Use: ws://YOUR-PHONE-IP:4444/relay
  • Example: ws://192.168.1.100:4444/relay
7

Stopping and Restarting

To stop your relay:

Press Ctrl + C in Termux (or use the special keys in Termux's keyboard)

To start it again:

Just run the same command:

npx fonstr

💡 The second time is instant - no downloading needed!

8

Running in the Background

Want to keep your relay running while using other apps?

Option 1: Use Termux's session feature

Swipe from the left edge of Termux to see sessions. You can create a new session and switch between them.

Option 2: Run in background

nohup npx fonstr &

This runs fonstr in the background. To stop it, you'll need to use pkill -f fonstr

🔋 Battery Note

Running a relay will use battery. Consider plugging in your phone or running the relay only when needed.

Common Questions & Troubleshooting

Q: Why do I need F-Droid instead of Google Play Store?

A: The Termux version on Google Play Store is outdated and no longer maintained. F-Droid has the latest version that works properly.

Q: How much storage does this use?

A: The initial installation uses about 300MB (Node.js + fonstr). The relay itself uses very little space unless you store many events.

Q: Can I use this as my main relay?

A: Yes! But keep in mind your phone needs to stay on and connected to WiFi. For 24/7 operation, consider a Raspberry Pi or cloud server.

Q: What if I see "command not found"?

A: Make sure you completed Step 4 (installing Node.js). Try running pkg install nodejs-lts again.

Q: Can other people use my relay?

A: Only if they're on the same WiFi network, or if you set up port forwarding on your router (advanced). By default, it's just for you and your local network.

Q: How do I update fonstr?

A: Just run npx fonstr@latest and it will use the newest version.

Q: My phone gets hot. Is this normal?

A: Some warmth is normal when first downloading/installing. If it stays hot, your relay might be under heavy load. Try stopping it and restarting.

Q: Can I run this on iPhone?

A: Unfortunately no. iOS doesn't allow apps like Termux. You would need an Android phone, tablet, or use a computer instead.

Q: Help! Something went wrong!

A: Try these steps in order:

  1. Stop fonstr (Ctrl+C)
  2. Update packages: pkg update && pkg upgrade
  3. Restart Termux completely
  4. Try running npx fonstr again
  5. Still stuck? Ask for help on GitHub Issues

🎉 You Did It!

You're now running your own Nostr relay on your phone!

← Back to Home ⭐ Star on GitHub