Welcome to the First DEV LOG!
Welcome to my first Dev Log of my full stack application called EasyPollVote (EasyPV)!
What is EasyPollVote (EasyPV)?
It is an application where the ultimate goal is having the convenience to create your own poll and share it for others to vote on your custom poll!
For example, a user can create their own poll. Their poll can be something like "Do you like Cats or Dogs?" following the two options users can vote on "Cats" or "Dogs". Then, they will be able to send the private link to anyone and the voters can vote on it without the need to create an account!
That is the whole goal. Do note that this goal may change as time goes on!
The current goal is to learn about the use of Supabase!
The Current Stack
This application is built using the Next.js + Supabase Template to start off!
Current Progress
Right now, it is bare bone and hard-coded. The main functionality is integrating the GET and POST requests from Supabase. Currently, there is only one table that takes the following:
- Name (String)
- Email (String)
- Vote (String)
With that said, on the submission form, you only need to enter your name, email, and chose either Pikachu or Blastoise. This is currently hard coded to test out Supabase.
Note: Currently, there is no validation on whether you voted more than once. Therefore, you are able to vote more than once if you like!
When you submit the Form, it checks to see if you vote a specific Pokemon. If you did not select either, it will give you an error message that you need to Vote. Otherwise, it will perform a POST request.
if (formData.vote == "") { // All values need to be submitted
setMessage("Error: Please select a Pokémon to vote for.");
} else { // Upload the data to the database via POST request
const res = await fetch("/vote", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(formData),
});
if (!res.ok) {
setMessage("Error: Form submission failed. Please try again.");
} else { // Form has been submitted and reset the form
setMessage("Form submitted successfully! Thank you for voting.");
setFormData({ name: "", email: "", vote: "" });
}
}
When displaying the votes, it preforms a GET request where it gets the total votes and then display the votes in the appropriate category.
useEffect(() => {
async function fetchVotes() {
const res = await fetch('/vote'); // your GET route
const data = await res.json();
// Count votes
let pika = 0;
let blast = 0;
let totalVotes = 0
data.TotalVotes.forEach((row: { Vote: string; }) => {
if (row.Vote === 'Pikachu') pika++;
if (row.Vote === 'Blastoise') blast++;
});
totalVotes = pika + blast;
// Set the scores after calculation
setTotalVotes(totalVotes);
setPikachuVotes(pika);
setBlastoiseVotes(blast);
setLoading(false);
}
fetchVotes();
}, []);
All the requests to the database are located in the "Vote" folder, which contains the route.ts!
Official Website
If you would love to see the project yourself, feel free to check out the link here: https://easypollvote.vercel.app
I recommend to put a fake email and a fake name if you are using the app. Everything works as intended! Check it out and feedback is greatly appreciated!
Note: This post is monitored by the University and therefore the repository is currently private until the early Summer!

Top comments (19)
I'll always vote for Umbreon 😁
@gramli @francistrdev the battle will be hard 😂
⚔️ yep ⚔️🤣🤣
lol
Pikachu 4ever! 🤣
I could make that the third option lol. Probably not now :)
Blastoise ftw
I don't play Pokemon, so I voted for that one too. I just picked the one that was winning lol
That's fair lol. Thanks for stopping by!
If any feedback, I would love to hear it even though it just started :D
It is currently winning right now! Thanks for stopping by :D
Why Blastoise is winning? Why there is no option for Charizard or Sceptile!😑
That's a good question lol. I am working on the feature where you can have more than 2 options. Right now, it's just 2 and those 2 pokemons unfortunately. Stay tuned this week! :D
Alright, but you might want to prevent people from voting more than once as there will be bots and the bots are gonna spam their favorite Pokemon so yea..
Yea fair enough! It will be implemented on future updates since this is in the early phase. I appreciate the feedback :D
Solid project man!!
Thanks Yacham!
Great work!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.