Start here
Needs Node 20.19+ (node -v).
1. Run the starter
Section titled “1. Run the starter”npx degit AndersCan/ekrooh/examples/vote my-app && cd my-app && npm install && npm run devThe terminal prints vote ready: http://localhost:5173 .... Open
http://localhost:5173: three buttons, Tea (0), Coffee (0) and Water (0), the
status line “No other device yet”, and an invite code with a Join box (you use
these in step 3). Click Tea and it shows Tea (1).
2. Make it your poll
Section titled “2. Make it your poll”const options = [ { id: 'pizza', label: 'Pizza' }, { id: 'tacos', label: 'Tacos' },];Replace the options at the top of src/render.ts and save: the browser
reloads with Pizza (0) and Tacos (0). id is what devices share (a-z, 0-9,
-, up to 32 characters), and label is what you see.
3. Vote from a second device
Section titled “3. Vote from a second device”Keep npm run dev running and pick one.
A second browser (fastest)
Section titled “A second browser (fastest)”npm run dev:secondRun it in a second terminal in my-app, then open http://localhost:5174. Copy
the invite code from http://localhost:5173, paste it in the 5174 page’s
“Paste a code here” box and press Join. The status says “Joined. Looking for
the other device…”, then “1 other device connected”. Vote on either page: the
count goes up on both.
Android emulator
Section titled “Android emulator”Needs Android Studio. Stop
npm run dev (Ctrl+C), then:
npm run sync && npm run dev- In Android Studio, open the
android/folder and wait for Gradle sync to finish. - Device Manager > Create Device > any Pixel with API 35. Press Run.
- The emulator shows your poll. Copy the invite code from http://localhost:5173, then in the emulator long-press the “Paste a code here” box, choose Paste and press Join.
- When it says “1 other device connected”, vote on either: the count goes up on both.
The first Gradle sync and emulator download take several minutes.
iOS Simulator (Mac only)
Section titled “iOS Simulator (Mac only)”Needs Xcode from the App Store. Stop npm run dev (Ctrl+C), then:
npm run sync && npm run dev- Open
ios/Vote.xcodeprojin Xcode. The first open downloads packages, which takes a few minutes. - Pick a Simulator and press Run. No Apple account is needed.
- Copy the invite code from http://localhost:5173, paste it in the Simulator’s “Paste a code here” box and press Join.
- When it says “1 other device connected”, vote on either: the count goes up on both.
The first connection goes over the public network and can take a minute. If the status says “Still looking for the other device”, wait a little, then restart both (votes start from zero after a restart).
- What each file does, a USB phone, a real iPhone: the starter README.