Find a court. Join a game. Play more. Search less.
OpenCourt solves the problem of not being able to easily find open play locations for sports like pickleball, basketball, tennis, volleyball, and more.
- Fully Dockerized Stack
- The entire application (frontend, backend, and database) is containerized with Docker Compose for portability and ease of setup
- Automated Setup Scripts
- Includes scripts for prepping a new VM and for setting up the application locally or on a VM
- Nginx Reverse Proxy
- A web container runs Nginx to serve the static React build and act as a reverse proxy for the backend, eliminating CORS issues.
- MySQL database
- Tables: users, locations, games, and games_users
- Configured for remote Workbench access on port 3307
- Runs in its own Docker container
- Automatically creates tables and seeds data on first launch
- MVC-style API
- Runs in a Node.js container using PM2 for process management.
- Basic CRUD functionality (Create/Read) for users, locations, and games.
- React + Vite frontend application
- Connects to the proxied /api/ endpoints.
- Components for Games, Locations, and Users.
- Simple, responsive UI
- 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.
There is currently an issue where when an event, location, or user is added to the database, it is not immediately reflected on the website. The user has to refresh the page for the newest addition to display. This is not a Docker Issue and so was not addressed during this Sprint.
- Docker Desktop (for Local Development): You must have Docker Desktop installed and running on your local machine to use setup-local.sh
-
Open a terminal on your local machine
-
Log into your VM using your IP Address and Password:
ssh root@{vm-ip-address} -
Run the following command to update your VM and install Git:
sudo apt update && sudo apt install git -y && sudo DEBIAN_FRONTEND=noninteractive apt upgrade -yq
-
Clone the repo:
git clone https://github.com/kellerflint/OpenCourt.git
-
CD into the project and make the scripts executable:
CD OpenCourt/ chmod +x prepare-vm.sh setup.sh
-
Run the VM Setup Script:
- This will install Docker, Compose, Curl, and set the firewall
sudo ./prepare-vm.sh
-
Run the Application Setup Script:
- This will build your containers, handle .env and nginx.conf configuration, and start your application
./setup.sh
-
Follow Prompts: The script will ask you to enter what passwords you want to use for database access
-
Access Your Application:
- Website: http://your-vm-ip
- MySQL Workbench:
- Host: your-vm-ip
- Port: 3307
- Username: app_user
- Password: The app_user password you chose during setup
When you push new code to your repo, run the update.sh script to deploy them.
-
SSH into your VM and CD to OpenCourt/
-
Activate and run the script
chmod +x update.sh ./update.sh
This will pull the latest code and rebuild only the necessary containers. Your database data will be preserved
IMPORTANT - This script does NOT apply database schema changes. To apply changes to tables, you must destroy the database volume and then run docker-compose up -d --build
-
Command to destroy database volume
docker-compose down -v
-
Clone the repo:
git clone https://github.com/kellerflint/OpenCourt.git
-
Ensure Docker Desktop is running
-
Make script executable and run it:
- This will build your containers, handle .env and nginx.conf configuration, and start your application
chmod +x setup-local.sh ./setup-local.sh
-
Follow Prompts: The script will ask you to enter what passwords you want to use for database access
-
Access Your Application:
- Website: http://localhost
- MySQL Workbench:
- Host: localhost
- Port: 3307
- Username: app_user
- Password: The app_user password you set during setup
From the root directory, run the following command:
docker-compose up -d --buildThis will rebuild the images for the code you changed and restart the containers. Your MySQL database data will be preserved.
If you need to apply changes to the database and reset your data, your must destroy the database volume:
# This stops and removes containers AND destroys the database volume
docker-compose down -v
# This rebuilds all images and starts fresh containers
docker-compose up -d --buildIf your application freezes (either on the VM or locally) and there have been no code changes, run the following command to restart Docker:
docker-compose restartOpenCourt includes unit tests for both the front and backend, integration tests and end to end tests.
-
Make sure you followed the steps in Local Setup to ensure you have your environment properly set up.
-
Make script executable and run it:
- This will automatically run all tests and exit any necessary terminals making it fast and easy to quickly run a test.
chmod +x run-tests.sh ./run-tests.sh
A script has been written to help quickly set up a dockerized test environment perfect for end to end testing.
-
Ensure Docker Desktop is running
-
Make script executable and run it:
- This will automatically run and build all docker containers, handle any database configuration and launch the cypress terminal for you to use.
chmod +x ./test-scripts/run-e2e-tests.sh ./test-scripts/run-e2e-tests.sh
- Make sure you are in the proper directory for the front-end.
- Check that the opencourt_test docker container is running.
- Run the following command in your terminal to run just the cypress tests.
npm run cypressdocker-compose -p opencourt_test -f docker-compose.test.yml up -ddocker-compose -p opencourt_test downHere are some common issues you may encounter when running tests:
- Docker not running
- Docker must be installed and running on your machine for any of these tests to work.
- template.env or template.nginx.conf not found
- Make sure these template files exist in the root directory of your project. The E2E and local-setup script depends on it.