Find a court. Join a game. Play more. Search less.
- Project Description
- The Plan
- Prerequisites
- Building the Application
- Running the Application
- VM Setup
OpenCourt solves the problem of not being able to easily find open play locations for sports like pickleball, basketball, tennis, volleyball, and more.
- End-to-End data
- MySQL database
- Tables: users, locations, games, and games_users
- Configured for workbench access
- Scripts for creating and seeding databases included
- MVC-style API
- Deployed with PM2
- Basic CRUD functionality
- Create: Add a user, location, or game
- Read: View all users, locations, or games
- Basic data validation in the controller
- React + Vite frontend application
- Components: Games, Locations, Users
- Connects to API through fetch calls on button clicks
- Uses state to manage form data, error handling
- Basic data validation
- MySQL database
- Simple frontend for client testing
- React + Vite frontend application
- Simple, responsive UI
- useful frontend errors
- React + Vite frontend application
- Extend CRUD functionality
- Update: Change locations, times, players, size of party
- Delete: Remove events, players
- User profiles, which could include sports they play, rating/level of skill, profile pictures
- Payment links, for court/rental fees, tournament entry fees
Core Entities: Events, Users, Location
Key Relationships: Users can host Events, Events can have multiples Users, Events have one location, Locations can host multiple events
CRUD Operations:
- Users can create events
- Users can join events
- Users can view events and participants
- Hosts can remove users
- Hosts can update event details
- Users can leave events
- Hosts can delete events
User Flows: A user can either host or participate in an event.
- Hosts
- determine the event size, sport, location, and time.
- can remove players or delete events
- Participants
- can browse and join events.
- can leave an event anytime.
Set up VM (Do This First!)
- Open MySQL Workbench
- Go to Database=>Connect to Database
- Fill in the database information you configured in your VM
- Create the tables by pasting and running the contents of create_tables in MySQL Workbench
- Optionally populate the tables using seed_tables
- Duplicate and fill out the frontend env
- Duplicate and fill out the root env
cp template.env .env
nano .env
# Then fill out the env fileFrom root, run the following lines to install all required packages:
cd src/server
npm i
cd ../frontend/opencourt
npm iFor local development, run:
cd src/server
npm run pm2
cd ../frontend/opencourt
npm run devNote: If you need to force pm2 to stop, run npm run pm2-stop. See package.json for more useful server scripts.
To deploy, run from the root of the project:
bash start.sh- Open a terminal on your local machine
- Log into your VM using your IP Address and Password
ssh root@{vm-ip-address}
Update the package index and upgrade exisiting packages
sudo apt update
yes | sudo DEBIAN_FRONTEND=noninteractive apt-get -yqq upgrade- Install Git
sudo apt install git
- Install MySQL
sudo apt install mysql-server
- Install Node.js using NVM
sudo apt-get install curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashexport NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install --lts
- Open the MySQL config file
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
- Change the bind-address value from 127.0.0.1 to 0.0.0.0
- Save and exit (Crtl+O, Enter, Ctrl+X)
- Log into MySQl as root
mysql -u root -p # When prompted, enter root password - Create a new user (replace 'student' and 'yourpassword' with your chosen credentials)
CREATE USER 'student'@'%' IDENTIFIED BY 'yourpassword';
- View your current databases
SHOW DATABASES;
- Pick an existing database or create a new one
CREATE DATABASE opencourt; -- this is the name you will use in the .env
- Grant permissions
GRANT ALL PRIVILEGES ON opencourt.* TO '{your-username}'@'%'; FLUSH PRIVILEGES;
- Verify your permissions
SHOW GRANTS FOR '{your-username}'@'%';
- Exit
EXIT;
sudo ufw allow 3306/tcp
sudo ufw reload# Install PM2 globally
npm install -g pm2
# Keep PM2 alive on reboot
pm2 startup
pm2 save- Clone this repository into a folder in you VM
- Complete the steps in Building the Application in the VM
To deploy, run from the root of the project:
bash start.sh