FounderSmash is a voting application that allows users to vote on whether they would pass
or smash
on Silicon Valley's top founders.
What does it mean to pass
or smash
? Find out on Urban Dictionary.
If you would like to clone or fork this respository, follow thses steps to run the application locally:
- Setup Supabase, view instructions
git clone https://github.com/surgieboi/foundersmash
npm install
npm run dev
- View the application on
localhost:3000
This application uses Supabase to store and create views of the following:
Create a founders
table by adding the following attributes:
Column | Type | Primary | Is Nullable |
---|---|---|---|
name | text | false | false |
company | text | false | false |
image | text | false | false |
founder_id | numeric | false | false |
Note, we will use founder_id
to later join this table to the votes
table.
Create a votes
table by adding the following attributes:
Column | Type | Primary | Is Nullable |
---|---|---|---|
vote | text | false | false |
founder | numeric | false | false |
Using the founder
attribute, join this table to the founders
table by using a foreign key relation
.
Note, we are not storing any sensative consumer data in our voters
table; however, using UUID we use this table to track unique voters.
To-do so, create a votes
table by adding the following attributes:
Column | Type | Primary | Is Nullable |
---|---|---|---|
id | text | true | false |
Note, delete the default id
and replace it using the new attribute and key defined above.
In order to visualize voting results by founder, create a VIEW
in Supabase using the following SQL statement:
create view rankings as
select
founders.name,
founders.company,
founders.image,
sum(case when vote = 'smash' then 1 else 0 end) as smashes,
sum(case when vote = 'pass' then 1 else 0 end) as passes
from votes
left join founders on votes.founder = founders.founder_id
group by founders.id
order by smashes desc
Using your Supabase accounts Database URL
and ANON Key
, update the following:
- Update
.env.sample
to.env
- Update each environment variable with their respective values
- Save
To prevent anonymous usage of your Supabase data, enable Row Level Security (ie. RSL) by adding the following Policies to their respective Tables:
- Select:
founders
, using the following expressionauth.role() = 'anon'
- Insert:
voters
andvotes
, using the following expressionauth.role() = 'anon'
By default, this application runs on Vercel and can be deployed via your local machine using Vercel's CLI.
Once installed, run vercel
in terminal and within your applications directory.
Feel free to fork this repository and submit pull requests, or build an application of your own.
If you have any questions, feel free to email me at: [email protected].