Skip to content

Vision: Solid Pod on Every Phone #46

Open

Description

@melvincarvalho

The Vision

Every smartphone could be a personal Solid pod - giving billions of people sovereign control over their data without relying on cloud providers.

Proof of Concept

We've successfully demonstrated JSS running on Android via Termux:

What Works Today

Component Status
JSS on Termux ✅ Works (with bcryptjs swap)
PM2 process management ✅ Works
Auto-reconnecting tunnel ✅ Works (autossh)
Survive reboot ✅ Works (Termux:Boot)
Public HTTPS endpoint ✅ Works (via relay + haproxy)

The Gap: From Proof-of-Concept to "One Click Install"

Current Setup (Technical Users)

1. Install Termux + Termux:Boot
2. pkg install nodejs openssh autossh
3. npm install -g pm2
4. git clone JSS, swap bcrypt→bcryptjs
5. Generate SSH keys, configure relay server
6. Setup PM2, configure boot script
7. Configure relay server (haproxy/nginx + certs)

Goal: Anyone Can Do It

1. Install "PhonePod" app from Play Store
2. Tap "Create My Pod"
3. Done - your phone is now a Solid server

Technical Roadmap

Phase 1: Installer Script (Low Effort)

Single bash script for Termux users:

curl -sL https://jss.solid.live/install.sh | bash

The script would:

  • Install dependencies (Node.js, PM2, autossh)
  • Clone and patch JSS
  • Configure PM2 and boot persistence
  • Guide user through relay setup

Effort: 1-2 days
Audience: Technical users comfortable with Termux

Phase 2: Hosted Relay Service (Medium Effort)

Provide a public relay so users don't need their own VPS:

  • Wildcard domain: *.phonepod.app or similar
  • Auto-provisioned subdomains: alice.phonepod.app
  • Let's Encrypt wildcard cert
  • Simple registration (could even be WebID-based)

Architecture:

Phone (JSS) → autossh → relay.phonepod.app → https://alice.phonepod.app

Effort: 1-2 weeks
Audience: Users who can install Termux but don't have a VPS

Phase 3: Native Android App (High Effort)

Full Android app with embedded runtime:

  • Bundle Node.js for ARM64 (or explore alternatives like aspect-build)
  • Native UI for setup and monitoring
  • Handle Android battery optimization properly
  • Background service with proper lifecycle
  • Optional: Integrate with relay service

Effort: 1-3 months
Audience: General public

Phase 4: P2P/Decentralized Relay (Ambitious)

Remove the need for centralized relay infrastructure:

  • WebRTC hole-punching for direct connections
  • DHT for peer discovery
  • Fallback relay network run by community nodes
  • Integration with existing projects (libp2p, IPFS, etc.)

Effort: 3-6 months
Audience: Everyone, fully decentralized

Challenges to Solve

1. Android Battery Optimization

Android aggressively kills background apps. Mitigations:

  • Termux wakelock (termux-wake-lock)
  • Guide users to disable battery optimization
  • Native app could handle this better

2. Native Modules

bcrypt fails to compile on Android. Solutions:

  • ✅ Already solved: Use bcryptjs (pure JS)
  • Consider making this the default or auto-detecting

3. Connectivity

Phones change networks, go offline, etc. Solutions:

  • ✅ autossh handles reconnection
  • Native app could be smarter about network state
  • Consider offline-first with sync when connected

4. Domain/HTTPS for Everyone

Every user needs a URL. Options:

  • Hosted relay with subdomains (Phase 2)
  • DID-based addressing (no DNS needed)
  • Integration with DynDNS-style services
  • .onion addresses (Tor)

5. Discovery

How do others find your pod? Options:

  • WebID profile links
  • DID resolution
  • QR codes for local sharing
  • Integration with Solid ecosystem directories

Why This Matters

  1. Data Sovereignty: Your data lives on hardware you physically control
  2. Zero Cost: No monthly hosting fees, uses existing device
  3. Resilience: No single point of failure, survives provider shutdowns
  4. Accessibility: Billions have smartphones, few have VPS skills
  5. Environmental: Reuse old phones instead of e-waste

Call to Action

We're looking for contributors interested in:

  • Writing the Phase 1 installer script
  • Setting up a public relay service (Phase 2)
  • Exploring native Android app approaches (Phase 3)
  • Research on P2P connectivity (Phase 4)
  • Documentation and user guides
  • Testing on various Android devices

Resources


This started as a "can it run on my phone?" experiment and turned into a working proof of concept in a single session. The technology is ready - we just need to package it.

Activity

  1. melvincarvalho commented on Jan 4, 2026

    @melvincarvalho
    ContributorAuthor

    Phase 1: Installer Script

    Here's the working installer script. Tested and proven on Android via Termux.

    Quick Install

    curl -sL https://raw.githubusercontent.com/JavaScriptSolidServer/JavaScriptSolidServer/gh-pages/install-phone.sh | bash

    The Script

    #!/bin/bash
    #
    # PhonePod Installer
    # Installs a Solid server on your Android phone via Termux
    #
    # Usage: curl -sL https://phonepod.example/install.sh | bash
    #
    
    set -e
    
    # Colors
    RED='\033[0;31m'
    GREEN='\033[0;32m'
    YELLOW='\033[1;33m'
    BLUE='\033[0;34m'
    NC='\033[0m' # No Color
    
    echo -e "${BLUE}"
    echo "╔═══════════════════════════════════════╗"
    echo "║         📱 PhonePod Installer         ║"
    echo "║     Solid Server on Your Phone        ║"
    echo "╚═══════════════════════════════════════╝"
    echo -e "${NC}"
    
    # Check if running in Termux
    if [ ! -d "/data/data/com.termux" ]; then
        echo -e "${RED}Error: This script must be run in Termux on Android${NC}"
        echo "Install Termux from F-Droid: https://f-droid.org/packages/com.termux/"
        exit 1
    fi
    
    echo -e "${GREEN}✓ Running in Termux${NC}"
    
    # Update packages
    echo -e "${YELLOW}→ Updating package list...${NC}"
    pkg update -y
    
    # Install dependencies
    echo -e "${YELLOW}→ Installing Node.js, OpenSSH, autossh...${NC}"
    pkg install -y nodejs openssh autossh git
    
    # Install PM2
    echo -e "${YELLOW}→ Installing PM2...${NC}"
    npm install -g pm2
    
    # Clone JSS
    echo -e "${YELLOW}→ Cloning JavaScript Solid Server...${NC}"
    cd ~
    if [ -d "JavaScriptSolidServer" ]; then
        echo -e "${YELLOW}  (removing existing installation)${NC}"
        rm -rf JavaScriptSolidServer
    fi
    git clone https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git
    cd JavaScriptSolidServer
    
    # Swap bcrypt for bcryptjs (native module doesn't compile on Android)
    echo -e "${YELLOW}→ Patching for Android compatibility...${NC}"
    npm uninstall bcrypt 2>/dev/null || true
    npm install bcryptjs --save
    sed -i "s/from 'bcrypt'/from 'bcryptjs'/" src/idp/accounts.js
    
    # Install dependencies
    echo -e "${YELLOW}→ Installing dependencies...${NC}"
    npm install
    
    # Create data directory with public ACL
    echo -e "${YELLOW}→ Setting up data directory...${NC}"
    mkdir -p data
    cat > data/.acl << 'EOF'
    {
      "@context": {
        "acl": "http://www.w3.org/ns/auth/acl#",
        "foaf": "http://xmlns.com/foaf/0.1/"
      },
      "@graph": [
        {
          "@id": "#owner",
          "@type": "acl:Authorization",
          "acl:agent": { "@id": "#me" },
          "acl:accessTo": { "@id": "./" },
          "acl:default": { "@id": "./" },
          "acl:mode": [
            { "@id": "acl:Read" },
            { "@id": "acl:Write" },
            { "@id": "acl:Control" }
          ]
        },
        {
          "@id": "#public",
          "@type": "acl:Authorization",
          "acl:agentClass": { "@id": "foaf:Agent" },
          "acl:accessTo": { "@id": "./" },
          "acl:default": { "@id": "./" },
          "acl:mode": [
            { "@id": "acl:Read" }
          ]
        }
      ]
    }
    EOF
    
    # Create landing page
    cat > data/index.html << 'EOF'
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>PhonePod - Solid Server</title>
      <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
          font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
          background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
          min-height: 100vh;
          display: flex;
          align-items: center;
          justify-content: center;
          color: #4a5568;
        }
        .container {
          text-align: center;
          padding: 3rem;
          background: white;
          border-radius: 1.5rem;
          box-shadow: 0 10px 40px rgba(0,0,0,0.08);
          max-width: 480px;
          margin: 1rem;
        }
        .icon { font-size: 4rem; margin-bottom: 1.5rem; }
        h1 { font-size: 1.75rem; color: #2d3748; margin-bottom: 0.5rem; font-weight: 600; }
        .subtitle { color: #718096; font-size: 1rem; margin-bottom: 2rem; }
        .badge {
          display: inline-block;
          background: linear-gradient(135deg, #e6fffa 0%, #ebf8ff 100%);
          color: #319795;
          padding: 0.5rem 1rem;
          border-radius: 2rem;
          font-size: 0.875rem;
          font-weight: 500;
          border: 1px solid #b2f5ea;
        }
        .footer { margin-top: 2rem; font-size: 0.75rem; color: #a0aec0; }
      </style>
    </head>
    <body>
      <div class="container">
        <div class="icon">📱</div>
        <h1>PhonePod</h1>
        <p class="subtitle">Personal Solid Server</p>
        <div class="badge">Running on Android</div>
        <div class="footer">Your data, your device, your rules</div>
      </div>
    </body>
    </html>
    EOF
    
    # Start JSS with PM2
    echo -e "${YELLOW}→ Starting Solid server...${NC}"
    pm2 delete jss 2>/dev/null || true
    pm2 start bin/jss.js --name jss -- start
    
    # Generate SSH key if needed
    if [ ! -f ~/.ssh/id_ed25519 ]; then
        echo -e "${YELLOW}→ Generating SSH key...${NC}"
        ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519
    fi
    
    # Setup Termux:Boot
    echo -e "${YELLOW}→ Setting up auto-start on boot...${NC}"
    mkdir -p ~/.termux/boot
    cat > ~/.termux/boot/start-phonepod.sh << 'EOF'
    #!/data/data/com.termux/files/usr/bin/bash
    termux-wake-lock
    pm2 resurrect
    EOF
    chmod +x ~/.termux/boot/start-phonepod.sh
    
    # Save PM2 state
    pm2 save
    
    # Acquire wakelock
    echo -e "${YELLOW}→ Acquiring wakelock...${NC}"
    termux-wake-lock 2>/dev/null || true
    
    # Done!
    echo ""
    echo -e "${GREEN}╔═══════════════════════════════════════╗"
    echo "║         ✓ Installation Complete!       ║"
    echo "╚═══════════════════════════════════════╝${NC}"
    echo ""
    echo -e "Your Solid server is running at: ${BLUE}http://localhost:3000/${NC}"
    echo ""
    echo -e "${YELLOW}To access from the internet, you need a relay.${NC}"
    echo ""
    echo "Your SSH public key (add this to your relay server):"
    echo -e "${BLUE}"
    cat ~/.ssh/id_ed25519.pub
    echo -e "${NC}"
    echo ""
    echo "Then create a tunnel script:"
    echo ""
    echo -e "${YELLOW}  cat > ~/tunnel.sh << 'TUNNEL'"
    echo "  #!/data/data/com.termux/files/usr/bin/bash"
    echo "  exec autossh -M 0 -o ServerAliveInterval=30 -o ServerAliveCountMax=3 \\"
    echo "    -N -R YOUR_PORT:localhost:3000 YOUR_USER@YOUR_RELAY_SERVER"
    echo "  TUNNEL"
    echo "  chmod +x ~/tunnel.sh"
    echo "  pm2 start ~/tunnel.sh --name tunnel"
    echo "  pm2 save${NC}"
    echo ""
    echo -e "Docs: ${BLUE}https://github.com/JavaScriptSolidServer/JavaScriptSolidServer${NC}"
    echo ""

    What it does

    1. ✅ Checks for Termux environment
    2. ✅ Installs Node.js, OpenSSH, autossh, PM2
    3. ✅ Clones and patches JSS (bcrypt → bcryptjs)
    4. ✅ Creates public-read ACL and landing page
    5. ✅ Starts JSS via PM2
    6. ✅ Generates SSH key for relay connection
    7. ✅ Configures Termux:Boot for persistence
    8. ✅ Acquires wakelock

    Next step: Hosted relay

    The script gets users to a working local server. The manual step remaining is connecting to a relay.

    For Phase 2, we should provide a hosted relay service so users can just:

    phonepod register myname
    # → Your pod is now live at https://myname.phonepod.app

    That's the next piece to build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions