This is the source code for the CubingZA website which can be found at https://cubingza.org.
There are several independent components that need to be set up and run: the database (MongoDB), the API (Express server), and the website (Angular). In addition to these, the production version runs a MySQL database for WCA results, and includes Python scripts which update the MySQL database and load data from MySQL to MongoDB. The MySQL database and Python scripts are not needed for local development.
MongoDB. There are two options.
docker run -p 27017:27017 mongo
. Since the development server wipes and seeds the database from scratch, there is no need to persist a volume.CubingZA API:
server
directory and then run npm install
to install server dependencies.server/config/local.env
with app secrets. For local development, you can simply copy the sample file server/config/local.env.sample
, but you will need to set the Mailgun details to your own. It is recommended to use a sandbox domain. Note that verifications are still charged on a sandbox domain.npm start
while in the server
directory. You can also run the API server from within the client
directory by running npm --prefix ../server start
, or you can run the "Run backend" task from within VS Code with the client
directory open. The API server can be accessed at http://localhost:9000
.CubingZA Website:
client
directory and install dependancies by running npm install
.ng serve
from within the client
directory. Navigate to http://localhost:4200
to view he site. The front end proxies the API, so all API endpoints can be accessed from both http://localhost:9000
and http://localhost:4200
The application will automatically reload if you change any of the source files.Front end components can be generated by running ng generate component component-name
in the client
directory. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
To test the website, run ng test
from within the client
directory to execute the unit tests via Karma.
To test the API, run npm test
from within the server
directory to execute tests via Jest.
server/config/production.env
and set environment variables and secrets. You can start by copying the sample file server/config/local.env.sample
.docker compose up --build
.scripts/getWCAdb.sh
and scripts/RecordUpdator.py
once a day. Ideally the record update should run about 2 hours after the WCA database update.We welcome contributions from everyone! For major changes, please open an issue first to discuss what you would like to change. Here are a few guidelines to help you get started.
git checkout -b your-branch-name
.git commit -am 'Add new feature'
.git push origin your-branch-name
.If you find a bug or have a feature request, please create a new issue on our Github repository. Please include as much detail as possible, including steps to reproduce the issue and any error messages.
This project is licensed under the terms of the MIT license. See LICENSE for more information, or you can visit the official website.