Weight For Reps is a training journal logging tool to help you keep track of your weight training. Mostly orientated towards Powerlifting/Weightlifting style of training.
I am thrilled to announce 😂 that I am releasing my backend code and frontend code to the community as open source. This has been a long-time goal of mine and I am excited to see the impact it will have.
The server runs in NodeJS / Express and uses GraphQL vía Apollo Server (v3) to connect with the frontend.
- graphql -> http://weightxreps.net/api/graphql
- Schema documentation at GraphQL Explorer That link points to the staging DB but the schema is the same.
- OAuth2 -> http://weightxreps.net/api/auth
-
Read our api/auth documentation if you are an app developer.
-
For the frontend use weightxreps-oauth : React component to obtain a weightxreps OAuth2 access token and user.
-
To setup a development database on your machine use docker. VS Code should detect the .devcontainer
folder automatically. A notification will pop up, asking if you want to "Reopen in Container." Click on that option.
If you don’t see the notification, you can manually start the container by:
- Going to the Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
on macOS). - Typing and selecting "
Dev Containers: Reopen in Container
".
Then the specs needed to run this are:
- Node:
v20.17.0
- Database:
mariadb v10.6.19
with@@sql_mode=""
andmysql_native_password
- Create/Edit
.env
with the DB relevant variables. (use.env.example
as base) - Seed database with fake data
npm run seed-db
- ...know that the server is running on linux in production.
You have 2 options:
npm run seed-db
npm run truncate-db
In VS Code you can go to "Run > run Dev" or "Run > Production" it will only serve to set the NODE_ENV environment variable to development or production
or vía NPM ( you will need to install NodeMon )
npm run dev
GraphQl > Then you can navigate to /graphql
to access the graphql explorer & interact with the server as the front-end would do.
The code lives in the ./server
folder. The code that handles the GraphQL is in ./server/db
If you are developing both backend and front end (or make changes to the schema), clone both repos into a folder and name each folder
client
andserver
. This is required because the server generates code when you make changes in the graphql schema and runnpm run exportschema
and goes one level up and expect a client folder to exist... these files will be dynamically created automatically:
generated---db-introspection.json
generated---db-types-and-hooks.tsx
firebase-adminsdk-credentials.js
you will need to create & place this file inside ofserver
with a firebase account. This is used by the "login with" widget which uses Firebase.
When saving a workout, the resolver will recieve an array of JEditorSaveRow
which is a scalar that can have many diferent interpretations...
This is the data used in the SBD World Rank setion of the site.
To update the SBD rank data run npm run update-sbd-rank
that will download the latest ZIP from openpowerlifting, process it and store the resulting data in server/db/resolvers/sbd-stats.js
after that is done, that's all there is to it... the server should be re-run and the new data will be used.
Note: it will take a while to process...
They are hard-coded in server/utils/ename2type.js
These are the exercises that the site "understands" and adds them to the community stats.
If you would like to contribute, follow these steps:
- Fork the
weightxreps-server
repository. - Create a new branch in your fork to make your changes.
- Commit your changes to your new branch.
- Push your changes to your fork on GitHub.
- Submit a pull request from your branch to the
weightxreps-server
repository.
I will review your pull request and, if everything looks good, merge it into the main codebase.
If you have any questions about contributing, feel free to open an issue in the weightxreps-server
repository and ask.
If you have a weightxreps.net account log in and go to the donations page
If you want to donate directly, my paypal is [email protected]