FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
cricks_unmixed4u
cricks_unmixed4ullm-tips
Public
Like
1
llm-tips
Home
Code
7
.vscode
1
articles
1
tips
4
.cursorrules
knowledge-voting-addition.md
H
main.tsx
template.html
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
knowledge-voting-addition.md
Code
/
knowledge-voting-addition.md
Search
6/24/2025
Viewing readonly version of main branch: v308
View latest version
knowledge-voting-addition.md

Kuadratic Voting Component

Kuadratic is a Val Town voting widget that exports embeddable HTML components backed by SQLite, with configurable limits for fair participation.

Features

  • Multiple Options: Support for multi-choice polls
  • Persistent Storage: Votes saved in Val Town's SQLite DB
  • Vote Limits: Configurable per-user and global caps
  • Embeddable: Self-contained HTML with CSS/JS
  • Live Feedback: UI updates after voting, with validations

Basic Usage

Create val
import { createVotingWidget, initializeOptions } from "./index.ts"; const config = { pollId: "my-poll-2024", maxTotalVotes: 1000, maxVotesPerUser: 3, options: [ { id: "option1", title: "Option 1", description: "First choice" }, { id: "option2", title: "Option 2", description: "Second choice" }, { id: "option3", title: "Option 3" } ] }; await initializeOptions(config); const widgetHTML = createVotingWidget(config); ## API * POST /api/vote: Submit vote * GET /api/results/:pollId: Retrieve current results ### Payload example { "pollId": "my-poll-2024", "optionId": "option1", "voterId": "unique-voter-id", "maxTotalVotes": 1000, "maxVotesPerUser": 3 } ## Vote Limiting Global Limit: maxTotalVotes restricts total submissions per poll Per-User Limit: maxVotesPerUser enforced via voterId ## Integration Embed the generated HTML on any webpage Automatically loads current vote counts and handles updates Enforces all vote limits with appropriate messaging Kuadratic ensures secure, easy-to-integrate voting with real-time behavior and robust guardrails for fair use.
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.