GithubHelp home page GithubHelp logo

surgieboi / foundersmash Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 32.72 MB

A voting application that ranks Silicon Valley founders based on a consumers appetite to engage or not engage in sexual activities with them.

Home Page: https://foundersmash.vercel.app/

License: MIT License

JavaScript 93.98% CSS 6.02%
heroicons nextjs supabase tailwindcss vercel

foundersmash's Introduction

FounderSmash

FounderSmash

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.

Getting Started

If you would like to clone or fork this respository, follow thses steps to run the application locally:

  1. Setup Supabase, view instructions
  2. git clone https://github.com/surgieboi/foundersmash
  3. npm install
  4. npm run dev
  5. View the application on localhost:3000

Deploying with Vercel

Deploy with Vercel

Setting up Supabase

This application uses Supabase to store and create views of the following:

Founders

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.

Votes

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.

Voters

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.

Viewing Voting Results by Founder

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 

Updating Environment Variables

Using your Supabase accounts Database URL and ANON Key, update the following:

  1. Update .env.sample to .env
  2. Update each environment variable with their respective values
  3. Save

Enabling Row Level Security

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 expression auth.role() = 'anon'
  • Insert: voters and votes, using the following expression auth.role() = 'anon'

Deploying to Vercel

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.

Additional Dependencies

Contributing

Feel free to fork this repository and submit pull requests, or build an application of your own.

Questions

If you have any questions, feel free to email me at: [email protected].

foundersmash's People

Contributors

surgieboi avatar

Stargazers

Conor Daly avatar

Watchers

 avatar  avatar

Forkers

bunsdev

foundersmash's Issues

Enable RLS or do not expose `SUPABASE_KEY`

@surgieboi

Supabase security measures are not enabled, so I can grab the supabase_key from the headers, connect to your Postgres instance, and execute queries.

For demo, I have added myself to the list (apologies, as this is my way of demonstrating a table mutation).

Screenshot 2022-10-10 at 11 09 38 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.