-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,64 @@ | ||
# OpenWeightlifting | ||
This is the monorepo for the OpenWeightlifting.org project. The aim of this project is to build a database of the latest Olympic Weightlifting results from all around the world. This originally started from a scraping tool and quickly grew into what you see here now. All the results within the database were pulled directly from the event results pages from the National Governing Body of that nation. We try to avoid manual data entry so this is all done with our tooling written in Python. | ||
|
||
[![codecov](https://codecov.io/gh/euanwm/OpenWeightlifting/branch/development/graph/badge.svg?token=CX7H10ZNLM)](https://codecov.io/gh/euanwm/OpenWeightlifting) | ||
There's always some questions around certain design decisions in this project so we'll address them now. | ||
|
||
### Why Golang for the backend? | ||
Originally it was Python but the build time was terrible and the response times were slow. Not only that but the memory usage was high. Golang was chosen because it's fast, has a low memory footprint and the build times are quick. It's also a language that's easy to pick up and learn. We migrated from Python to Golang within in a week of picking up the language. | ||
|
||
### Why NextJS for the frontend? | ||
This was a bit of a no brainer. We wanted to use React and NextJS (TS) is a great framework for it. The amount of features around rounting, server side rendering and static site generation is great. While it can also serve as a backend, we've chosen to keep the backend and frontend separate due the performance benefits of having a dedicated backend. | ||
|
||
## Local Testing | ||
We've added a docker-compose file to make it easier to test locally. This will spin up a local instance of the backend and frontend services. In production, these services are deployed separately. | ||
Majority of the contributors on this are FE developers, so we've containerised the front and backend portions of the project. To get going quickly with the project, you'll need to have docker installed. | ||
|
||
### Frontend Development (NextJS) | ||
From the root of the project, run the following commands to spin up a backend container and launch the frontend. | ||
```bash | ||
docker compose up -d backend | ||
cd frontend | ||
npm install | ||
npm run dev | ||
``` | ||
While the backend service is running, you'll also be able to run the FE API call tests against it. | ||
```bash | ||
docker-compose build | ||
docker-compose up | ||
npm run test | ||
``` | ||
When you get bored and want to kill it... | ||
|
||
Once you're done, you can stop the backend container with the following command. | ||
```bash | ||
docker-compose down | ||
docker compose down | ||
``` | ||
|
||
### Backend-only | ||
### Backend Development (Golang) | ||
When launching the backend service you'll need to toggle the CORS flag which is done be adding the 'local' argument when calling the executable. | ||
```bash | ||
go build backend.go | ||
./backend local | ||
``` | ||
|
||
### Frontend-only | ||
We prefer to use npm for the frontend stuff. | ||
## Database Management (Python) | ||
To pull the latest results from the all relevant federations, we've added a Makefile with a few commands to make it easier. You'll need to have pipenv installed to run the commands. | ||
### Pulling the latest results | ||
```bash | ||
npm install | ||
npm run dev | ||
make update_database | ||
``` | ||
|
||
### Staging the latest results | ||
This came about so if you have a messy amount of unstaged changes, you can stage them all and then commit them in one go. | ||
```bash | ||
make stage_csv | ||
``` | ||
|
||
### Updating the database | ||
To pull the latest results from the all relevant federations, you'll need to run the following command from the python_tools directory: | ||
### Checking the database | ||
In order to reduce the amount of checks at runtime, we've added a check to make sure the database is in a good state. This will check for duplicate entries and missing data. | ||
```bash | ||
pipenv install | ||
pipenv run python backend_cli.py --update all | ||
make check_db | ||
``` | ||
|
||
### License | ||
# License | ||
Done this under the BSD-3-Clause license. Simply because it's what the sport80 library is under and i'm hella lazy. | ||
|
||
### Contributing | ||
# Contributing | ||
If you want to contribute, please do! We're always looking for more people to help out. If you're not sure where to start, check out the issues page and join the discord server. | ||
https://discord.gg/kqnBqdktgr |