=====================================================================
 WriteHive Hub - your wireless document drive
 By AgentHive Inc. - writehive.netlify.app
=====================================================================

One PC runs the hub. Every laptop on the same Wi-Fi instantly shares
a live document drive. No network switch, no server rack, no cables,
no cloud account. Your documents never leave your building.


EASIEST START (one click)
-------------------------
Double-click  "Install WriteHive Hub.bat"  in this folder.
It sets up everything for you: installs Node.js if you don't have
it, opens the Windows firewall for the hub, adds a desktop shortcut,
and starts the hub. Windows will ask for permission once - click Yes.
When it finishes, a window prints an address like:

    ->  http://192.168.1.20:8765

Open that address on every other laptop on the same Wi-Fi - the full
WriteHive editor loads straight from this PC. Nothing to install on
those laptops. That's it.

Prefer to do it by hand? Use the manual steps below instead.


MANUAL QUICKSTART (about 2 minutes)
-----------------------------------
1. Install Node.js - once, on the hub PC only.
   Free from https://nodejs.org (pick the LTS version, click Next
   through the installer). Every other laptop needs NOTHING installed.

2. Double-click start-hub.bat in this folder.
   A window opens and prints something like:

       ->  http://192.168.1.20:8765

3. On every laptop on the same Wi-Fi, open that address in any
   browser. That's it - the full WriteHive editor loads straight
   from the hub PC.

4. In WriteHive, click the "Hive" button (top right) and press
   "Save to Hive". The document appears on ALL machines, live.
   When anyone saves, everyone sees the update within a second.

Documents are plain files in the HiveDrive folder next to the hub -
easy to back up, easy to move, always yours.


WHAT IS mirrorDir? (automatic second copy)
------------------------------------------
Open hub-config.json and set "mirrorDir" to any folder path - a USB
stick, an external drive, or a NAS share. Example:

    "mirrorDir": "E:/WriteHiveBackup"

Every time a document is saved to the Hive, the hub instantly writes
a second copy there. If the hub PC ever dies, your whole drive is
sitting on the backup - no cloud subscription required.

The hub also keeps the last 10 versions of every document in
HiveDrive/.versions, so "restore an older version" is built in.


POOLING - MANY MACHINES, ONE DRIVE (Pro)   [RAID 0 / RAID 1]
------------------------------------------------------------
A single hub is limited by one PC's disk. Pooling joins several
hubs into ONE shared drive. Run the hub on 2, 3, or more machines
(on your Wi-Fi, or across the internet) and point them at each
other. Every laptop sees one combined drive no matter which hub it
opened.

Two modes, set with "poolMode" in hub-config.json:

  "stripe"  = RAID 0. Documents are spread across the machines, so
              their disk space and speed ADD UP. Three PCs give you
              one big pooled drive. (No duplication: if one machine
              is switched off, its share is unavailable until it's
              back - like RAID 0, striping trades redundancy for
              capacity. Use mirrorDir or "mirror" mode if you want
              copies.)

  "mirror"  = RAID 1. Every machine keeps a copy of every document.
              Any one machine can die and nothing is lost.

To set up a 3-machine pool, on EACH machine set:

  "poolMode":  "stripe",                       (or "mirror")
  "selfUrl":   "http://192.168.1.20:8765",     (THIS machine's address)
  "peers":     ["http://192.168.1.21:8765",
                "http://192.168.1.22:8765"],    (the OTHERS)
  "poolSecret":"pick-any-shared-password",      (SAME on every machine)
  "licenseKey":"WRHV-PRO-XXXX-XXXXXXXX"         (Pro, on every machine)

Rules that make it "just work":
  * Every machine lists the SAME set of addresses (its own selfUrl
    plus every peer). If all machines agree on the set, they agree
    on where each document lives.
  * poolSecret must match exactly on every machine - it's what stops
    a stranger's hub from joining your pool.
  * Pooling needs a Pro key on every machine. Without it (or without
    a poolSecret) the hub just runs standalone, exactly as before.

OFF-PREM (across the internet): a "peer" is just a URL. Put one hub
behind a port-forward or a tunnel (e.g. a static IP, or a service
that gives your PC a public https address) and list that URL in the
other machines' "peers". On-prem and off-prem machines can share the
same pool - that's the "combination" setup.

The banner prints POOL: STRIPE (RAID-0) - 3 nodes when it's live, and
the app's Hive panel shows every node and whether it's online.


FREE vs PRO
-----------
Free hub: 2 devices at a time. Plenty for you-plus-one.
WriteHive Pro ($44.99, one time, forever): unlimited devices.

Got a Pro key? Open hub-config.json and paste it in:

    "licenseKey": "WRHV-PRO-XXXX-XXXXXXXX"

Save the file, close the hub window, double-click start-hub.bat
again. The banner will say "UNLIMITED (Pro key active)".

Get a key at https://writehive.netlify.app - one payment, every
future update included, 30-day refund promise.


TROUBLESHOOTING
---------------
* Windows Firewall pops up the first time you start the hub.
  Click "Allow access" - otherwise other laptops can't reach it.
  (If you clicked Cancel: Windows Security > Firewall & network
  protection > Allow an app through firewall > find Node.js and
  tick both boxes.)

* Not sure what your PC's address is?
  Press Win+R, type cmd, press Enter, then type:  ipconfig
  Look for "IPv4 Address" - e.g. 192.168.1.20. Your hub is at
  http://THAT-ADDRESS:8765

* Other laptops can't connect?
  - Make sure they're on the SAME Wi-Fi network (not a guest network,
    not mobile hotspot on one of them).
  - Make sure the hub window is still open and running.
  - Try opening the address on the hub PC itself first:
    http://localhost:8765 - if that works, it's a firewall or
    network issue, not the hub.

* "Port 8765 is already in use"?
  Another program (or a second hub) has that port. Change "port" in
  hub-config.json to e.g. 8770 and start again.

* Want the hub on a different drive folder?
  Change "driveDir" in hub-config.json. The folder is created
  automatically.

Questions? coltsinsider@gmail.com reaches a human.
=====================================================================
