PILink turns a Raspberry Pi into a local communication hub that people join over Wi-Fi.
Once a phone or laptop connects to the Pi's hotspot, it can open a web app with:
- realtime local chat
- a push-to-talk voice channel
PI, an optional on-device assistant powered by Ollama
PILink is designed for local-first use. It works well for small groups, and the voice channel is intended for one active speaker at a time.
- Local-only web app hosted by a Raspberry Pi
- Accessed from a browser over the Pi's Wi-Fi hotspot
- HTTPS-enabled so mobile browsers allow microphone access
- Privacy-first inside the local Wi-Fi boundary
- Not an internet messaging service
- Not end-to-end encrypted
- Not a mesh radio network
- Not built for large-scale voice rooms
The practical security boundary is the WPA2 hotspot network. Anyone who can join that network can reach the app.
Chattab for live group messagingPItab for local AI responses streamed from Ollama- Push-to-talk voice with floor control so only one person speaks at a time
- Local display-name identity stored in the browser
- Offline local DNS so users can open a friendly URL instead of an IP
- Raspberry Pi deployment via
systemd
The Pi does four jobs:
- Hosts a Wi-Fi hotspot using NetworkManager
- Resolves your chosen local hostname to the Pi's hotspot IP
- Serves the PILink web app over HTTPS
- Optionally runs Ollama locally for the
PIassistant
Clients then:
- Join the hotspot
- Open
https://your-domain - Use chat, voice, and
PIdirectly in the browser
On the Raspberry Pi:
- Rust backend (
axum) - Static frontend served from
dist/ - NetworkManager hotspot profile:
PILink-AP - HTTPS on
:443 - HTTP on
:80 - WebSocket endpoint at
/api/ws - Optional Ollama at
127.0.0.1:11434
On clients:
- Any modern browser with WebSocket and WebRTC support
- Microphone permission for voice
- Connection to the Pi hotspot
src/main.rs- backend server, WebSocket handling, voice signaling, AI routesfrontend/- React frontend sourcedist/- built frontend assets served by the backendsetup_pi.sh- main Raspberry Pi setup scriptgenerate_self_signed_cert.sh- helper for self-signed TLS certificatesforge_network.sh- older prototype setup script kept for reference
Recommended:
- Raspberry Pi 4 or newer
- Raspberry Pi OS or another Linux distro using NetworkManager
- Wi-Fi chipset that supports AP mode on the target interface
- Internet access during initial setup if you need to install Rust, Ollama, or pull an AI model
Expected tools/services on the Pi:
bashnmcli/ NetworkManagersystemctlopensslif using the self-signed certificate flow
Optional but useful:
gitcurliptablessetcapfromlibcap2-bin
If you just want the shortest path on a fresh Pi:
- Clone this repo onto the Pi
- Put TLS certs in
/etc/pilink/certs/ - Run
bash setup_pi.sh - Run
bash setup_pi.sh --activate-ap - Join the
PILinkWi-Fi network from a phone or laptop - Open your configured HTTPS URL in the browser
The rest of this README explains each step in detail.
Clone your copy of the repo onto the Raspberry Pi:
git clone <your-repo-url> ~/PILink
cd ~/PILinkdist/ is committed, so the Pi does not need Node.js just to serve the frontend.
Microphone access in mobile browsers requires HTTPS. PILink supports two setup paths.
This is the best user experience.
Example:
- Public hostname:
pilink.example.com - Hotspot gateway IP:
10.42.0.1 - Local DNS override:
pilink.example.com -> 10.42.0.1
Benefits:
- No certificate warning on client devices
- Best microphone compatibility
- Clean URL for demos and real use
Typical certificate approach:
- Use Let's Encrypt
- Use DNS-01 validation if the Pi is not publicly reachable from the internet
- Install the resulting files here:
/etc/pilink/certs/fullchain.pem/etc/pilink/certs/privkey.pem
Use this if you do not own a domain or want a fully self-contained setup.
Generate the certificate on the Pi:
sudo bash ./generate_self_signed_cert.sh --domain pilink.localThat writes:
/etc/pilink/certs/fullchain.pem/etc/pilink/certs/privkey.pem
Tradeoffs:
- No domain purchase required
- Fully offline-friendly
- Clients may need a manual trust step before the browser accepts the certificate
If you regenerate the cert later, restart the service:
sudo systemctl restart pilinkThe main setup helper is setup_pi.sh.
It is designed to be rerun safely and handles most of the boring system setup for you.
What it configures:
- NetworkManager hotspot profile
PILink-AP - SSID
PILinkby default - WPA2 password
pilinkmeshby default - Hotspot gateway
10.42.0.1/24 - Local DNS override for your configured domain
- Release build of the Rust backend
systemdservice namedpilink- Best-effort Ollama startup and model pull
- Best-effort firewall rules if
iptablesis installed
Run the first command while the Pi still has internet access through normal Wi-Fi or Ethernet.
bash setup_pi.shThat allows the script to:
- install Rust if missing
- build the backend
- install or verify the
pilinkservice - try to start Ollama and pull the configured model
Once that finishes, switch the Pi into hotspot mode:
bash setup_pi.sh --activate-apImportant: activating the hotspot may interrupt your SSH session.
Use a custom domain:
bash setup_pi.sh --domain pilink.example.comUse a different hotspot password:
bash setup_pi.sh --psk "your-strong-password"Use a different Ollama model:
bash setup_pi.sh --ollama-model llama3.2:1bChange the hotspot SSID:
bash setup_pi.sh --ssid "My PILink"Before running setup_pi.sh, make sure:
- The repo is present on the Pi
Cargo.tomlexists in the repo root- TLS files exist in
/etc/pilink/certs/ - NetworkManager manages the Wi-Fi interface you want to use
The script will stop with actionable errors if a required step is missing.
Current defaults:
- SSID:
PILink - Hotspot profile:
PILink-AP - Password:
pilinkmesh - Interface:
wlan0 - Gateway IP:
10.42.0.1/24 - Default AI model:
qwen2:0.5b
The backend also respects:
PILINK_OLLAMA_MODEL
setup_pi.sh writes that environment variable into the installed systemd service.
The setup script installs a service called pilink.
Useful commands:
sudo systemctl status pilink --no-pager
sudo systemctl restart pilink
sudo journalctl -u pilink -n 100 --no-pagerTo manually bring up the hotspot later:
nmcli con up PILink-APTo see active connections:
nmcli con show --activeTo confirm the hotspot IP on wlan0:
ip -4 addr show wlan0PILink is meant to be opened through a hostname, not a raw IP, because the TLS certificate must match the URL.
The setup script writes a local DNS override so your chosen hostname resolves to the Pi hotspot IP.
For the default setup, it writes a line like this:
address=/pilink.astatide.com/10.42.0.1Possible locations:
/etc/NetworkManager/dnsmasq-shared.d/pilink.conf/etc/NetworkManager/dnsmasq.d/pilink.conf
If you use a custom domain, the script writes that instead.
Some phones and browsers use Private DNS or DNS-over-HTTPS, which can bypass the Pi's local DNS.
If the PILink URL does not load while connected to the hotspot:
- disable Private DNS or DoH on the client
- reload the page
- make sure you are using the same hostname that your certificate covers
Avoid telling users to browse to https://10.42.0.1 unless the certificate was explicitly created for that IP, which is not the normal setup.
PI is optional. Chat and voice still work without it.
PILink expects Ollama to be reachable at:
http://127.0.0.1:11434
Default model:
qwen2:0.5b
The setup script will try to:
- enable and start the
ollamaservice - check whether the API responds
- pull the configured model if it is missing
If Ollama is installed but the model is missing, the app reports that clearly through the AI health endpoint instead of failing silently.
Useful checks:
curl http://127.0.0.1:11434/api/tags
ollama list
curl -k https://your-domain/api/ai/healthIf needed, pull the default model manually:
ollama pull qwen2:0.5bRun the Rust backend locally:
cargo runIn local development without the production TLS setup, the backend runs on:
http://127.0.0.1:3000
Run the Vite dev server:
cd frontend
npm install
npm run devBuild production assets:
cd frontend
npm install
npm run buildThose build outputs land in dist/, which is what the Pi serves in production.
After setup, verify the full stack.
On the Pi:
sudo systemctl status pilink --no-pager
curl -k https://your-domain/health
curl -k https://your-domain/api/ai/health
nmcli con show --activeOn a client device connected to the hotspot:
- Open
https://your-domain - Enter a display name
- Send a chat message
- Test push-to-talk voice from two devices
- Open the
PItab and confirm a response streams back
If you previously switched the Pi back to normal Wi-Fi for updates, the hotspot may simply not be active anymore.
Bring it back up:
nmcli con up PILink-APThen re-check:
nmcli con show --active
ip -4 addr show wlan0Check these in order:
- You are connected to the correct SSID
- The Pi hotspot is active
- The hostname matches the certificate
- Private DNS / DoH is disabled on the client if needed
pilinkservice is running
Most often this is a certificate issue.
Check:
- You opened PILink over
https:// - The certificate is trusted by the device
- The hostname in the browser matches the certificate hostname
- The browser has microphone permission
Check:
systemctl status ollama --no-pager
curl http://127.0.0.1:11434/api/tags
ollama list
curl -k https://your-domain/api/ai/healthCommon causes:
- Ollama is not installed
- Ollama is not running
- The configured model was never pulled
- The Pi had no internet during the model download step
Some Pi environments do not have iptables installed.
In that case, setup_pi.sh warns and continues. PILink can still work, but you should make sure your firewall allows inbound traffic on the hotspot interface for:
22/tcp80/tcp443/tcp53/tcp53/udp67-68/udp
PILink expects the service user to be able to read the private key. setup_pi.sh attempts to fix this automatically by using a pilink group and adjusting permissions on /etc/pilink/certs/privkey.pem.
If needed, re-run:
bash setup_pi.shThen check logs:
sudo journalctl -u pilink -n 100 --no-pager- PILink is local-first, not zero-trust
- It does not claim end-to-end encryption
- Anyone with the hotspot password can join the app
- Use a strong WPA2 password if the deployment environment matters
- Protect your private key files and never commit them into git
dist/is intentionally committed so the Pi can serve the app without Node.jssetup_pi.shis the main supported setup pathforge_network.shexists from an earlier approach and is not the primary path for new installs- For best experience, perform the initial install while the Pi still has internet access, then switch to hotspot mode after setup completes
If you are publishing PILink as open source, this README is intended to make self-hosting on a Raspberry Pi straightforward for other users.
If you extend the project, keep the deployment path simple:
- keep
dist/up to date - keep
setup_pi.shidempotent - document any new system dependency clearly