···11+# Fitbod → Hevy Import
22+33+Scripts to migrate workout history from a Fitbod CSV export into Hevy via its API.
44+55+## Prerequisites
66+77+- [Deno](https://deno.com) installed
88+- A Fitbod CSV export (`WorkoutExport.csv`) in this directory
99+- A [Hevy API key](https://hevy.com/settings?tab=developer)
1010+1111+## Setup
1212+1313+Add your Hevy API key to [config.tsm](config.tsm):
1414+1515+```ts
1616+export const HEVY_API_KEY = 'your-key-here';
1717+```
1818+1919+## Workflow
2020+2121+### Step 1 — Generate the exercise map template
2222+2323+Reads your CSV and outputs a `exercise-map.tsm` file listing every unique exercise name:
2424+2525+```sh
2626+deno run --allow-read generate-map.tsm
2727+```
2828+2929+### Step 2 — Get your Hevy exercise template IDs
3030+3131+Fetches all exercise templates from your Hevy account and prints them as mappable key/value pairs:
3232+3333+```sh
3434+deno run --allow-net get-templates.tsm
3535+```
3636+3737+### Step 3 — Fill in the exercise map
3838+3939+Open `exercise-map.tsm` and paste in the Hevy template ID for each exercise. Any exercise left as an empty string will be skipped during import.
4040+4141+```ts
4242+export const EXERCISE_MAP: Record<string, string> = {
4343+ "Running": "abc123",
4444+ "Dumbbell Row": "def456",
4545+ // ...
4646+};
4747+```
4848+4949+### Step 4 — Run the import
5050+5151+```sh
5252+deno run --allow-read --allow-net import.tsm
5353+```
5454+5555+Workouts are sent one day at a time with a 1.5-second delay between requests to respect Hevy's rate limits. Exercises not found in the map are skipped with a warning.
5656+5757+## Files
5858+5959+| File | Purpose |
6060+|------|---------|
6161+| `config.tsm` | API key, CSV path, API base URL |
6262+| `generate-map.tsm` | Generates `exercise-map.tsm` from the CSV |
6363+| `get-templates.tsm` | Lists Hevy exercise templates and their IDs |
6464+| `exercise-map.tsm` | Maps Fitbod exercise names → Hevy template IDs |
6565+| `import.tsm` | Main import script |
6666+| `WorkoutExport.csv` | Your Fitbod data export |