Getting Started
This guide will help you get up and running with openweight in minutes.
Already tracking workouts?
If you're using Strong, Hevy, or JEFIT, you can convert your entire training history right now — no code required:
bash
npx @openweight/cli convert your-export.csv -o workouts.json --prettySee the migration guides for step-by-step instructions.
Installation
bash
npm install @openweight/sdkbash
pnpm add @openweight/sdkbash
yarn add @openweight/sdkParse a Workout Log
typescript
import { parseWorkoutLog } from '@openweight/sdk'
const json = `{
"date": "2024-01-15T09:30:00Z",
"exercises": [
{
"exercise": { "name": "Squat" },
"sets": [
{ "reps": 5, "weight": 100, "unit": "kg" }
]
}
]
}`
const workout = parseWorkoutLog(json)
console.log(workout.exercises[0].exercise.name) // "Squat"Validate Data
typescript
import { validateWorkoutLog, isValidWorkoutLog } from '@openweight/sdk'
const data = {
date: '2024-01-15T09:30:00Z',
exercises: [
{
exercise: { name: 'Bench Press' },
sets: [{ reps: 8, weight: 60, unit: 'kg' }]
}
]
}
// Type guard
if (isValidWorkoutLog(data)) {
console.log('Valid workout!')
}
// Detailed validation
const result = validateWorkoutLog(data)
if (!result.valid) {
console.log(result.errors)
}Serialize to JSON
typescript
import { serializeWorkoutLog, serializeWorkoutLogPretty } from '@openweight/sdk'
const workout = {
date: '2024-01-15T09:30:00Z',
exercises: [
{
exercise: { name: 'Deadlift' },
sets: [{ reps: 5, weight: 140, unit: 'kg' }]
}
]
}
// Compact JSON (for storage/transmission)
const compact = serializeWorkoutLog(workout)
// Pretty JSON (for display/debugging)
const pretty = serializeWorkoutLogPretty(workout)Kotlin SDK
For Android/JVM projects, add the Maven Central dependency:
kotlin
dependencies {
implementation("io.github.radupana:openweight-sdk:0.4.0")
}See the full Kotlin SDK documentation for parsing, validation, and serialization examples.
Next Steps
- Core Concepts — Understand the data model
- Schema Reference — Full schema specification
- Examples — Browse example workout files