Skip to content

rayrunzewang/poll-web

Repository files navigation

Polling App Frontend

This is the frontend of a modern polling application, built with React 18, Vite, and Tailwind CSS. It provides a clean, responsive user interface for poll creation, voting, and real-time result visualization.

Features

  • Authentication: Only authenticated users can create polls.
  • Poll Creation: Authenticated users can create polls with 2-5 options.
  • Voting: Any user (including public/unauthenticated) can vote once per poll.
  • Live Results: Users see up-to-date poll results immediately after voting.
  • Protected Routes: Poll creation is protected; voting and viewing are public.
  • Modern UI/UX: Built with Tailwind CSS and Lucide icons for a professional look.

Tech Stack

  • React 18
  • Vite
  • React Router v6
  • Tailwind CSS
  • Axios

Project Structure

  • src/components/ – Reusable UI components
  • src/pages/ – Page-level components (Home, Poll, Create, Login)
  • src/contexts/ – React Context for authentication
  • src/services/ – API abstraction layer

Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm

Installation

npm install

Running the Frontend

npm run dev
  • The app will be available at http://localhost:5173
  • The frontend expects the backend API to be running at http://localhost:3000

Build for Production

npm run build

Lint

npm run lint

Key Design Highlights

  • Separation of Concerns: All business logic is abstracted into services and contexts.
  • State Management: Authentication state is managed globally via React Context.
  • API Integration: All API calls are centralized and automatically include authentication tokens when available.
  • User Experience: The interface is responsive, accessible, and provides clear feedback for all actions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published