Tech log
What LoudPoll runs on: the servers, each piece of the stack and what it does here, and what changed lately.
Server setup
Where each part of LoudPoll runs.
- WebsiteRailwayOne Node.js server: every page, the widget's script and fonts, the polls API and the admin. Railway checks /api/health before each new version goes live and restarts it after a crash.
- DatabaseRailwayPostgres 16, beside the website: polls, options and ballots. The website brings it up to date with its migrations each time it starts.
No accounts for voters, no cookies for voters, no analytics, no advertising, no AI and no sockets. Results are read every few seconds while a poll is showing, not pushed.
The stack, piece by piece
Each piece is listed under the part it serves.
The site and the admin
loudpoll.com: the polls' pages, the docs, and where staff make polls and read results.
- Next.js
- The website itself: the home page, a page for each poll, the docs, the staff admin and the report, this page, and the addresses programs call: the polls API, the report's downloads and the health check.
- React
- What the site's pages and the admin are built from. The poll widget doesn't use it, so it stays small.
- TypeScript
- The language the site, the API and the widget are written in.
- Tailwind CSS
- How the site's pages are styled. The widget carries its own styles.
- shadcn and Base UI
- The buttons, fields, tables, tabs and dialogs the site and the admin are built from, the same parts LoudClips and LoudStages use.
- Lucide icons
- The small icons in the admin and on the site.
- Inter and Space Grotesk
- The fonts, the same ones LoudClips uses. They're served from this site, to its pages and to the widget on other sites, rather than fetched from Google.
- Node.js
- Runs the website, the database scripts and the script that builds the widget.
- Clipboard
- The admin's Copy button puts a poll's embed code on the clipboard.
- Drag and drop
- Options are reordered in the admin by dragging them (or with the arrow keys).
The widget
One script that works on any website.
- esbuild
- Turns the widget's code into one small script (under 40 KB) that any website loads with one line.
- Shadow DOM
- The widget lives in its own sealed-off part of the page, so the host site's styles can't change how it looks and its styles can't leak into the site.
- Browser storage
- The widget keeps a random voter number, a poll's pass and the name a voter typed in their own browser, on the site they're on, so they can come back and change their vote. Nothing else.
Votes and results
What the widget sends to us, and how it's kept.
- Postgres
- The database: polls, their sections and options, and every ballot. Results are counted from the ballots each time (kept for two seconds), never stored as totals.
- Drizzle ORM
- How the code talks to the database, and how each change to its tables is written down as a migration that runs before the site starts.
- postgres.js
- The connection from the website to the database.
- zod
- Checks everything sent to the API and the admin, with the same rules in both, and says in a plain sentence what's wrong.
- Passcodes and passes
- A poll's passcode is stored only as a scrypt hash. A voter who types it gets a signed pass for that poll instead, so the passcode itself is never kept in a browser.
- Rate limits
- How many reads, votes and passcode tries each internet address may make a minute, kept in the server's memory for about a minute and never saved.
- tsx
- Runs the database scripts (migrations and the seed polls) straight from TypeScript.
Hosting
Where it runs, and how a change gets there.
- Railway
- Where the website and its database run. Railway checks the site answers before switching to a new version, and restarts it if it crashes.
- Railway settings as code
- The site's Railway settings written down in the code (.railway/railway.ts): how it's built and started, the health check, the restarts and the addresses.
- Cloudflare DNS
- Points loudpoll.com at Railway, which holds the certificate.
Building it
The tools that check and assemble the code.
- pnpm
- Installs the code's building blocks.
- ESLint
- Checks the code for mistakes before it goes live.
- Vitest
- Runs the tests of the rules and the API against a real database: counting, replacing a ballot, the budget of votes, passcodes, results settings, and the report's numbers.
- Playwright
- Runs the tests in a real Chrome: the widget on a page with clashing styles and beside LoudWidgets' widgets, the admin, the editor and the report, and that this log is complete.
Latest improvements
Newest first.
- More ways to ask, on the home page: live polls about the Loud network's products and merch (LoudCaptions' styles, LoudCoasters, 29 of the network's merch brands, its video brands, fan club perks, and LoudWidgets on the edge), each with its own method and color.
- The LOUDPOLL.com logo, in the Loud family's style: one fine tally stroke cut across the two Ls. It's on every page and under every poll.
- The report: votes by option, by section and by voter, a grid of who gave what, the comments, the sites polls were voted on, and three downloads.
- The editor: settings, Paste a list for long lists in sections, drag or arrow-key reordering, hide, remove with undo, and the real widget as a live preview.
- Staff sign in with their name and the shared password to make and run polls.
- The widget slides out of the window's edge beside LoudWidgets' widgets, their handles stacked, never overlapping.
- The first version of the widget: single choice, several choices, or a budget of votes to spread and stack, built for lists of 150 options in sections.