Skip to content

gouz/pollux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗳️ Pollux

A simple serverless poll management system built with Bun.

How It Works

Polls are managed using a hash generated by compressing a UUIDv7 and choices with lz-string:

LZString.compressToEncodedURIComponent(Bun.randomUUIDv7() + "|choice1|choice2|choice3")

The hash contains a UUIDv7 (unique poll identifier) and the poll choices separated by | (pipe).

Usage

Create a Poll

Generate a poll URL by creating a hash with the format:

https://yourdomain.com/vote#<LZString-compressed-hash>

For example, to create a poll with choices "Yes", "No", "Maybe":

const hash = LZString.compressToEncodedURIComponent(
  Bun.randomUUIDv7() + "|Yes|No|Maybe"
);
// Result: e.g., "XkxjKx..." (compressed string)
// URL: https://yourdomain.com/#XkxjKx..."

Vote

Visit the poll URL. Each choice appears as a button. Click to vote. Votes are stored in the server's SQLite database.

View Results

Visit the result page at:

https://yourdomain.com/result#<same-hash>

Results show vote counts and percentages, refreshing automatically every second.

Host

docker run -it -d -v "./data":"/usr/src/app/data" -p 1337:3000 gouz/pollux 

Running Locally

bun install
bun run src/index.ts

Then visit http://localhost:3000/vote#<hash> to create and test polls.

About

poll management

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors