Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 PickOne

Create a poll. Share it. See what people pick.

A fast, beautiful social voting platform where you create quick polls and share them with anyone. No registration required.

Version React TypeScript FastAPI Tailwind CSS PostgreSQL Docker License: MIT


PickOne β€” Social Voting Platform

✨ Features

Feature Description
⚑ Instant Polls Create a poll in seconds β€” no sign-up needed
πŸ”— Shareable Links Every poll gets a unique URL you can share anywhere
πŸ“Š Live Results Watch votes come in real-time via WebSocket
πŸ›‘οΈ Duplicate Protection SHA-256 fingerprint prevents double-voting
πŸ–ΌοΈ Image Options Add images to poll choices (auto-resized & converted to WebP)
🎨 Dark Mode Beautiful dark/light theme with system preference detection
πŸ“± Responsive Looks great on phones, tablets, and desktops
πŸ“€ Social Sharing Share to Telegram, WhatsApp, X, or copy link / QR code
πŸ” Creator Controls Edit, close, or delete your polls with a secure token
πŸ“ˆ Statistics Poll creators can view detailed voting analytics

πŸ“Έ Screenshots

Create Poll

Create a Poll

Poll Results

Live Results


πŸ› οΈ Tech Stack

Frontend

  • React 19 + TypeScript β€” Type-safe UI components
  • Vite β€” Lightning-fast build tool
  • Tailwind CSS v4 β€” Utility-first styling
  • TanStack Query v5 β€” Server state management
  • React Router v7 β€” Client-side routing
  • Framer Motion β€” Smooth animations
  • Lucide React β€” Beautiful icons
  • Recharts β€” Data visualization
  • qrcode.react β€” QR code generation

Backend

  • Python 3.12+ with FastAPI β€” High-performance async API
  • SQLAlchemy 2.0 β€” Async ORM with proper type support
  • Pydantic v2 β€” Data validation
  • Alembic β€” Database migrations
  • Pillow β€” Image processing
  • WebSockets β€” Real-time updates

Infrastructure

  • PostgreSQL 16 β€” Production database
  • SQLite β€” Local development (zero setup)
  • Docker & Docker Compose β€” Containerized deployment
  • Nginx β€” Reverse proxy with gzip & security headers

πŸš€ Quick Start

Local Development (Recommended)

1. Clone the repository:

git clone https://github.com/rezvvent/pickone.git
cd pickone

2. Start the backend:

cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000

3. Start the frontend (new terminal):

cd frontend
npm install
npm run dev

4. Open http://localhost:5173

πŸ’‘ The backend uses SQLite by default for local development β€” no database setup needed!


Docker (Production)

# Copy environment variables
cp .env.example .env

# Start all services
docker compose up --build

Open http://localhost β€” done!


πŸ“‘ API Reference

Polls

Method Endpoint Description
POST /api/v1/polls Create a new poll
GET /api/v1/polls/{slug} Get poll details
PATCH /api/v1/polls/{slug} Update poll (creator only)
DELETE /api/v1/polls/{slug} Delete poll (creator only)
POST /api/v1/polls/{slug}/vote Cast a vote
POST /api/v1/polls/{slug}/close Close voting (creator only)
GET /api/v1/polls/{slug}/statistics View analytics (creator only)

Discovery

Method Endpoint Description
GET /api/v1/polls/popular Trending polls
GET /api/v1/polls/recent Latest polls
GET /api/v1/polls/category/{name} Browse by category

Real-Time

Protocol Endpoint Description
WS /api/v1/ws/polls/{slug} Live vote updates

Interactive API docs available at /api/docs when the server is running.


πŸ“ Project Structure

pickone/
β”œβ”€β”€ frontend/                # React + TypeScript + Vite
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/             # Axios client & API functions
β”‚   β”‚   β”œβ”€β”€ components/      # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ hooks/           # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ layouts/         # Page layouts
β”‚   β”‚   β”œβ”€β”€ pages/           # Route pages (6 pages)
β”‚   β”‚   β”œβ”€β”€ types/           # TypeScript interfaces
β”‚   β”‚   └── utils/           # Helper functions
β”‚   └── package.json
β”‚
β”œβ”€β”€ backend/                 # FastAPI + SQLAlchemy
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/             # Route handlers & WebSocket
β”‚   β”‚   β”œβ”€β”€ core/            # Config, security, exceptions
β”‚   β”‚   β”œβ”€β”€ models/          # Database models
β”‚   β”‚   β”œβ”€β”€ repositories/    # Data access layer
β”‚   β”‚   β”œβ”€β”€ schemas/         # Pydantic schemas
β”‚   β”‚   └── services/        # Business logic
β”‚   β”œβ”€β”€ alembic/             # Database migrations
β”‚   β”œβ”€β”€ tests/               # Pytest test suite
β”‚   └── requirements.txt
β”‚
β”œβ”€β”€ nginx/                   # Reverse proxy config
β”œβ”€β”€ docker-compose.yml
└── README.md

πŸ”’ Security

  • No raw IPs stored β€” IPs are SHA-256 hashed before storage
  • Creator tokens β€” Generated with secrets.token_urlsafe(32), stored as SHA-256 hashes
  • Vote fingerprinting β€” SHA-256(poll_id + browser_id + hashed_ip + user_agent + salt)
  • Input validation β€” Pydantic v2 with strict type checking
  • SQL injection protection β€” SQLAlchemy ORM parameterized queries
  • CORS β€” Configurable per environment
  • Rate limiting β€” SlowAPI on all endpoints
  • Image validation β€” MIME type, file size, and extension checks
  • Security headers β€” HSTS, X-Frame-Options, X-Content-Type-Options via Nginx

Found a vulnerability? Please read our Security Policy for responsible disclosure.


πŸ§ͺ Testing

# Backend tests
cd backend && source venv/bin/activate
pytest -v

# Frontend type check & build
cd frontend
npx tsc -b --noEmit
npm run build

πŸ“‹ Environment Variables

Variable Default Description
DATABASE_URL sqlite+aiosqlite:///./pickone.db Database connection string
APP_SECRET supersecretkey... Secret for hashing (change in prod!)
CORS_ORIGINS ["http://localhost:5173"] Allowed CORS origins
UPLOAD_DIR uploads Image upload directory
MAX_UPLOAD_SIZE 5242880 Max upload size in bytes (5MB)

See .env.example for a complete reference.


🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Setting up your development environment
  • Our commit message conventions
  • The pull request process

πŸ“„ License

This project is licensed under the MIT License.


Built with ❀️ using React, FastAPI, and too much coffee.

Report Bug Β· Request Feature Β· Contributing

About

No description, website, or topics provided.

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages