Skip to content

the-harry-higgins/tourneydraft

Repository files navigation

TourneyDraft

ABOUT

A game I played with family and friends that I turned into an app.

TLDR:

  • Get a group of 8
  • Live draft 8 teams each from the field of 64 NCAA March Madness Tournament teams
  • Receive points for wins dependent on seed number and round number
  • Whoever receives most points wins a portion of money
  • Whoever picked overall tournament winner receives portion of money

The basic functionality is that you can create a league and add your friends to it. The league can then hold events corresponding to sports tournaments in the real world. For simplicity's sake I will only have it work for the NCAA March Madness tournament.

Once the field of 64 is determined for the tournament, your league is able to conduct a draft of the teams. Typically this is done in modified snake fashion with 8 players where the first round is inverted for the second round and the players are reordered for the next grouping of two rounds until all 8 rounds are complete and all 64 teams have been drafted (Round ).

You then receive points for your drafted teams winning the actual games. You receive the number value of the seed of your team plus the number value of the round of the tournament. For example: #16 seed UMBC upsets #1 seed UVA in the first round and you receive 16 + 1 = 17 points. This point system places a lot of value on upsets and cinderella teams, which we have anecdotally found makes the tournament even more fun to watch.

TECHNOLOGIES USED

FRONTEND

  • react
  • socket.io
  • material-ui

BACKEND

  • python
  • flask
  • flask-login
  • socket.io
  • flask-sqlalchemy
  • flask-migrate
  • alembic
  • postgresql

FEATURES

Data Visualizations

Data Visualizations

A large feature of this application is to have good data visualizations of the current state of the tournament via the Bracket Page. Additionally, the LeaderBoard Page displays the state of the game with respect to the other players.

Live Drafting

Live Draft

When the league admin sets up a draft, the rest of the players are able to login and draft with eachother in real-time.

DEV STUFF

Helpful Links

Getting started

  1. Clone this repository (only this branch)

    git clone https://github.com/the-harry-higgins/tourneydraft.git
  2. Install dependencies

    pipenv install --dev -r dev-requirements.txt && pipenv install -r requirements.txt
  3. Create a .env file based on the example with proper settings for your development environment

  4. Setup your PostgreSQL user, password and database and make sure it matches your .env file

  5. Get into your pipenv, migrate your database, seed your database, and run your flask app

    pipenv shell
    flask db upgrade
    flask seed all
    flask run
  6. To run the React App in development, checkout the README inside the react-app directory.


IMPORTANT! If you add any python dependencies to your pipfiles, you'll need to regenerate your requirements.txt before deployment. You can do this by running:

pipenv lock -r > requirements.txt

ALSO IMPORTANT! psycopg2-binary MUST remain a dev dependency because you can't install it on apline-linux. There is a layer in the Dockerfile that will install psycopg2 (not binary) for us.


Deploy to Heroku

  1. Create a new project on Heroku

  2. Under Resources click "Find more add-ons" and add the add on called "Heroku Postgres"

  3. Install the Heroku CLI

  4. Run

    heroku login
  5. Login to the heroku container registry

    heroku container:login
  6. Update the REACT_APP_BASE_URL variable in the Dockerfile. This should be the full URL of your Heroku app: i.e. "https://flask-react-aa.herokuapp.com"

  7. Push your docker container to heroku from the root directory of your project. This will build the dockerfile and push the image to your heroku container registry

    heroku container:push web -a {NAME_OF_HEROKU_APP}
  8. Release your docker container to heroku

    heroku container:release web -a {NAME_OF_HEROKU_APP}
  9. set up your database:

    heroku run -a {NAME_OF_HEROKU_APP} flask db upgrade
    heroku run -a {NAME_OF_HEROKU_APP} flask seed all
  10. Under Settings find "Config Vars" and add any additional/secret .env variables.

  11. profit

About

A game I played with family and friends that I turned into an app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published