Linux

Welcome to the YourFamilyHub Installation Guide! Here you will find all commands nessary for starting front & backend.

Prerequisites

  • Linux server with nginx installed

  • Node.js 18+ installed

  • Git installed

Installation

  1. Download and extract GoldFamily:

# Create directory for the application
sudo mkdir -p /var/www/YourFamilyHub
cd /var/www/YourFamilyHub

# Download the latest release
curl -L https://github.com/maxigoldy/YourFamilyHubHub/releases/latest/download/YourFamilyHubHub-dist.tar.gz | sudo tar -xz

# Set proper permissions
sudo chown -R www-data:www-data /var/www/YourFamilyHub
sudo chmod +x /var/www/YourFamilyHub/start.sh
  1. Install dependencies:

cd /var/www/YourFamilyHub
sudo npm install --production
  1. Configure Nginx:

# Create nginx configuration
sudo tee /etc/nginx/sites-available/YourFamilyHub << 'EOF'
server {
    listen 80;
    server_name YourFamilyHub.local;  # Change to your preferred domain
    
    # Serve static files
    location / {
        root /var/www/YourFamilyHub/dist;
        try_files $uri $uri/ /index.html;
        
        # Security headers
        add_header X-Frame-Options DENY;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
    }
    
    # Proxy API requests to Node.js server
    location /api/ {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }
    
    # Gzip compression
    gzip on;
    gzip_vary on;
    gzip_min_length 1024;
    gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
}
EOF

# Enable the site
sudo ln -sf /etc/nginx/sites-available/YourFamilyHub /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
  1. Create systemd service:

sudo tee /etc/systemd/system/YourFamilyHub.service << 'EOF'
[Unit]
Description=YourFamilyHub Self-Hosted Family Hub
After=network.target

[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/YourFamilyHub
ExecStart=/usr/bin/node server/server.js
Restart=always
RestartSec=10
Environment=NODE_ENV=production
Environment=PORT=3000

# Security settings
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/www/YourFamilyHub

[Install]
WantedBy=multi-user.target
EOF

# Enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable YourFamilyHub
sudo systemctl start YourFamilyHub
  1. Verify installation:

# Check service status
sudo systemctl status YourFamilyHub

# Check nginx status
sudo systemctl status nginx

# View logs if needed
sudo journalctl -u YourFamilyHub -f
  1. Access your application:

    • Open your browser and navigate to http://YourFamilyHub.local (or your server's IP)

    • Complete the initial setup by creating an admin account

    • Configure your family code and app name

Local Network Access

To access YourFamilyHub from other devices on your network:

  1. Find your server's IP address:

ip addr show | grep inet
  1. Update nginx configuration:

sudo nano /etc/nginx/sites-available/YourFamilyHub
# Change server_name to: server_name goldfamily.local YOUR_SERVER_IP;
sudo systemctl reload nginx
  1. Access from other devices:

    • Use http://YOUR_SERVER_IP in any browser on your local network

Optional: Custom Domain

To use a custom local domain (e.g., family.home):

  1. Add to your router's DNS or each device's hosts file:

# On each device, edit /etc/hosts (Linux/Mac) or C:\Windows\System32\drivers\etc\hosts (Windows)
YOUR_SERVER_IP    family.home
  1. Update nginx configuration:

sudo nano /etc/nginx/sites-available/YourFamilyHub
# Change server_name to: server_name family.home;
sudo systemctl reload nginx

Manual Setup (Alternative)

If you prefer to set up manually:

  1. Clone and build:

git clone https://github.com/maxigoldy/YourFamilyHub.git
cd YourFamilyHub
npm install
npm run build
  1. Start the server:

node server/server.js
  1. Configure nginx to serve the dist folder and proxy /api to your Node.js server

Backup

To backup your data:

# Copy the database file
cp /var/www/YourFamilyHub/data.json /path/to/backup/YourFamilyHub-backup-$(date +%Y%m%d).db

To restore:

# Stop the service
sudo systemctl stop YourFamilyHub

# Replace the database
sudo cp /path/to/backup/YourFamilyHub-backup-YYYYMMDD.db /var/www/YourFamilyHub/data.json
sudo chown www-data:www-data /var/www/YourFamilyHub/data.json

# Start the service
sudo systemctl start YourFamilyHub

Troubleshooting

Service won't start

# Check logs
sudo journalctl -u YourFamilyHub -n 50

# Check if port 3000 is available
sudo netstat -tlnp | grep :3000

Database issues

# Check database file permissions
ls -la /var/www/YourFamilyHub/data.json

# Reset database (WARNING: This deletes all data)
sudo rm /var/www/YourFamilyHub/data.json
sudo systemctl restart YourFamilyHub

Nginx issues

# Test nginx configuration
sudo nginx -t

# Check nginx logs
sudo tail -f /var/log/nginx/error.log

Development

To run in development mode:

# Install dependencies
npm install

# Start development server (frontend)
npm run dev

# Start backend server (in another terminal)
node server/server.js

Last updated