This is a modern polling application built with React, TypeScript, Redux Toolkit, React Router DOM, and Firebase. It supports authentication, protected routing, poll creation, voting, and a polished dashboard experience.
The app uses a visually rich glassmorphism theme with responsive layouts and animated UI accents.
- React.js
- TypeScript
- Redux Toolkit
- React Router DOM
- Firebase Authentication
- Firebase Firestore
- Vite
- Tailwind CSS
- Email/password Login
- User Signup and registration
- Secure Logout
- Protected routing for authenticated pages
- Redux state management for auth and polls
- Dashboard showing active polls and summary metrics
- Create Poll page for new poll creation
- Poll Details page with voting
- Delete poll only for creator
- Real-time Firestore updates for polls
- Responsive design across mobile and desktop
- Login
- Signup
- Logout
- Routing
- Redux
- Ant Design (intended UI library; current styling uses Tailwind CSS and custom theme)
- TypeScript
- React.js
- Firebase
cd polling-app
npm installCreate a Firebase project and enable Email/Password authentication.
Create a Firestore database and set up your config values.
Open src/firebase/config.ts and update the configuration:
const firebaseConfig = {
apiKey: 'YOUR_API_KEY',
authDomain: 'YOUR_PROJECT_ID.firebaseapp.com',
projectId: 'YOUR_PROJECT_ID',
storageBucket: 'YOUR_PROJECT_ID.appspot.com',
messagingSenderId: 'YOUR_MESSAGING_SENDER_ID',
appId: 'YOUR_APP_ID',
};npm run devOpen the local URL shown by Vite.
Enable these Firebase features:
- Firebase Authentication: Email/Password
- Firestore Database
Recommended Firestore rules:
- authenticated users can read/write their own profile
- authenticated users can create polls
- poll deletion only by creator
- one vote per user per poll
/- Login page/signup- Signup page/polls- Dashboard (protected)/create- Create Poll (protected)/poll/:id- Poll Details (protected)
Manages:
- current user state
- authentication loading state
- login/signup/logout actions
Manages:
- polls list
- poll loading state
- poll error state
Each poll includes:
- question
- options
- creator ID
- creator name
- created timestamp
Example Firestore document:
{
id: string,
question: string,
options: string[],
createdBy: string,
createdByName: string,
createdAt: Timestamp,
}- Users can vote once per poll
- Votes are stored in Firestore
- Vote totals and percentages update live
- Poll creator can delete their poll
npm run buildThe app should compile successfully and produce a production build.
This README captures the project requirements and main implementation details. If you want, I can also add a dedicated section for deployment and Firebase security rules.
- Create Poll
- Delete Poll
Manage:
- Votes
- Percentages
- User Vote
/
Login
/signup
Signup
/polls
Poll Dashboard
/create
Create Poll
/poll/:id
Poll Details
Protect authenticated routes.
Unauthenticated users should be redirected to Login.
- Password
- Login Button
- Link to Signup
- Name
- Password
- Signup Button
Display:
- Create Poll Button
- List of Polls
Inputs:
- Question
- Option 1
- Option 2
- Option 3
- Option 4
- Correct Answer (Dropdown)
Create Button
Display:
- Question
- Four options
After voting:
- Green correct answer
- Red incorrect answers
- Vote percentages
users
polls
votes
Users:
- Can read all users.
- Can only edit their own profile.
Polls:
- Any authenticated user can create.
- Only creator can delete.
Votes:
- One vote per user per poll.
- Users cannot modify another user's vote.
src/
│
├── app/
│ └── store.ts
│
├── components/
│
├── pages/
│ ├── Login
│ ├── Signup
│ ├── Dashboard
│ ├── CreatePoll
│ └── PollDetails
│
├── redux/
│ ├── authSlice.ts
│ ├── pollsSlice.ts
│ └── votesSlice.ts
│
├── firebase/
│ └── config.ts
│
├── hooks/
│
├── services/
│
├── types/
│
├── utils/
│
└── App.tsx
- Use TypeScript throughout the project.
- Follow clean code principles.
- Build reusable React components.
- Use Redux Toolkit for global state management.
- Handle loading and error states gracefully.
- Ensure the application is responsive across desktop, tablet, and mobile devices.
- Use Firestore real-time listeners instead of manual polling.
- Maintain consistent code formatting and project structure.
The generated project should include:
- Complete React application
- TypeScript support
- Firebase Authentication
- Firestore integration
- Redux Toolkit implementation
- Protected routes
- Responsive UI
- Real-time poll updates
- Clean folder structure
- Reusable components
- Well-commented, maintainable code
- Ready-to-run project with clear setup instructions