### Curl examples for public API routes Source: https://traceapps.github.io/docs/cooktrace/public-api Three curl commands: GET recent cook diary entries, POST to log a cook, and PATCH to mark a pantry item out of stock. All use the bearer token and example domain. ```bash # Recent Cook Diary entries curl -H "Authorization: Bearer ct_pat_..." \ https://cooktrace.example.com/api/v1/cook-diary ``` ```bash # Log a cook curl -X POST -H "Authorization: Bearer ct_pat_..." -H "Content-Type: application/json" \ -d '{"recipe_id": 42, "servings": 4}' \ https://cooktrace.example.com/api/v1/cook-diary ``` ```bash # Mark a pantry item out of stock curl -X PATCH -H "Authorization: Bearer ct_pat_..." -H "Content-Type: application/json" \ -d '{"in_stock": false}' \ https://cooktrace.example.com/api/v1/pantry/17/stock ``` -------------------------------- ### Install Node 20 with nvm Source: https://traceapps.github.io/docs/contribute/dev-setup?q= Use nvm to install and activate Node 20, the required major version for all three apps. Older Node majors are not tested. ```bash nvm install 20 nvm use 20 ``` -------------------------------- ### Install Node 20 with nvm Source: https://traceapps.github.io/docs/contribute/dev-setup Install and use Node 20 via nvm. The Docker base image is node:20-alpine for CookTrace and LiftTrace, node:20-slim for NutriTrace. Older Node majors are not tested. ```bash nvm install 20 nvm use 20 ``` -------------------------------- ### Path B: Single-origin build - build and run commands Source: https://traceapps.github.io/docs/contribute/dev-setup Build the frontend, copy it to server/dist, and start the server. This matches the production Docker image. Re-run all three lines after any frontend change; backend-only changes just need a server restart. ```bash npm run build rm -rf server/dist && cp -r dist server/dist cd server && node index.js ``` -------------------------------- ### Clone and set up LiftTrace Source: https://traceapps.github.io/docs/contribute/dev-setup Clone the LiftTrace repository, check out the dev branch, and install dependencies for the root and server. Everything lands on dev first; main is squash-merged release commits only. ```bash git clone https://github.com/TraceApps/lifttrace cd lifttrace git checkout dev npm install cd server && npm install && cd .. ``` -------------------------------- ### Clone and set up CookTrace Source: https://traceapps.github.io/docs/contribute/dev-setup Clone the CookTrace repository, check out the dev branch, and install dependencies for the root and server. Everything lands on dev first; main is squash-merged release commits only. ```bash git clone https://github.com/TraceApps/cooktrace cd cooktrace git checkout dev npm install cd server && npm install && cd .. ``` -------------------------------- ### Webhook payload example for meal.cooked Source: https://traceapps.github.io/docs/cooktrace/webhooks?q= Example JSON payload sent for the meal.cooked event. The data object contains fields like date, recipe_id, recipe_name, kind, servings, rating, and meal_type. The timestamp is in ISO 8601 format. ```json { "event": "meal.cooked", "timestamp": "2026-09-19T18:30:04.211Z", "data": { "date": "2026-09-19", "recipe_id": 42, "recipe_name": "Weeknight Chili", "kind": "cooked", "servings": 4, "rating": 5, "meal_type": "dinner" } } ``` -------------------------------- ### Clone and set up NutriTrace Source: https://traceapps.github.io/docs/contribute/dev-setup Clone the NutriTrace repository, check out the dev branch, and install dependencies for the root and server. Everything lands on dev first; main is squash-merged release commits only. ```bash git clone https://github.com/TraceApps/nutritrace cd nutritrace git checkout dev npm install cd server && npm install && cd .. ``` -------------------------------- ### Smart Add natural-language parser example input Source: https://traceapps.github.io/docs/lifttrace/diary Example text that Smart Add parses into structured sets. Supports cross-multiplied sets, RPE, rep ranges, AMRAP, timed sets, bodyweight, supersets (A1:, A2:), and aliases. ```plaintext bench 3x5 @ 225 A1: curls 3x12 @ 30 A2: pushdowns 3x12 @ 40 squat 5x5 @ 315 RPE 8 pullups 3xAMRAP @ BW overhead press 4x8 range 6-8 @ 95 ``` -------------------------------- ### Wireless ADB connect and install debug APK Source: https://traceapps.github.io/docs/contribute/dev-setup Pair the phone once via Developer options > Wireless debugging, then run these commands to connect and install the unsigned debug APK at android/app/build/outputs/apk/debug/app-debug.apk. The port shown in the phone's Wireless debugging panel rotates. ```bash adb connect : adb -s : install -r android/app/build/outputs/apk/debug/app-debug.apk ``` -------------------------------- ### Sample prompts for the chat tool set Source: https://traceapps.github.io/docs/lifttrace/trace Example prompts that exercise the tool set, covering workout generation, history comparison, PR queries, logging, program switching, diary updates, weight entries, volume analysis, and deload recommendations. ```text Generate today's workout. How did my push day last Thursday compare to the one before it? What's my bench PR and when did I hit it? Log 3x5 @ 225 bench, 3x8 @ 95 OHP, 3x10 dips to today. Switch me to Push-Pull-Legs. Start Day A on today's diary. Weighed in at 82.4 kg this morning. Is my volume balanced across chest / back / legs this month? Recommend a deload for next week based on my last block. ``` -------------------------------- ### GET /api/v1/foods/:id Source: https://traceapps.github.io/docs/nutritrace/federation-api?q= Retrieve a single food by its numeric ID. ```APIDOC ## GET /api/v1/foods/:id ### Description Single food by numeric ID. Requires `read:foods` scope. Returns the same shape as one array element from the list endpoint, or 404 not_found if the ID is unknown or belongs to a different user. ### Method GET ### Endpoint /api/v1/foods/:id ### Parameters #### Path Parameters - **id** (integer) - Required - Numeric ID of the food. ### Request Example ``` curl -H "Authorization: Bearer $NT_TOKEN" \ https://nutritrace.example.com/api/v1/foods/42 ``` ### Response #### Success Response (200) - **id** (integer) - Food ID. - **name** (string) - Food name. - **brand** (string) - Brand name. - **category** (string) - Category. - **barcode** (string) - Barcode. - **portion** (number) - Portion size. - **unit** (string) - Unit of measurement. - **img_url** (string) - Image URL. - **notes** (string) - Notes. - **nutrition** (object) - Nutritional info. - **created_at** (string) - Creation timestamp. - **updated_at** (string) - Last update timestamp. #### Response Example ``` { "id": 42, "name": "Chickpeas, canned", "brand": "Store brand", "category": "Legumes", "barcode": "0123456789012", "portion": 100, "unit": "g", "img_url": "/uploads/foods/42.jpg", "notes": null, "nutrition": { "kcal": 139, "protein_g": 7.5, "carbs_g": 22, "fat_g": 2.3 }, "created_at": "2026-01-14T09:22:11Z", "updated_at": "2026-03-02T18:04:03Z" } ``` ``` -------------------------------- ### Default OFF mirror download URL Source: https://traceapps.github.io/docs/nutritrace/off Default download source for the OFF mirror when OFF_LOCAL_DB points to a non-existent path. Override with OFF_LOCAL_URL if you host your own snapshot or need a specific mirror. The download is ~7-8 GB; give it time on a first boot. ```text https://huggingface.co/datasets/openfoodfacts/product-database/resolve/main/food.parquet?download=true ```