Skip to content
Skip to content

Import into your app

The self-hosted lane in full. Run the importer when you build, then ship the files. Your running app reads them from disk. With no key the importer brings in the sample, and with your key it brings in what you own.

What you get

Text
movekit/
catalog.json every exercise, with file paths
status.json where they came from: the sample, your account or both
README.md how web and mobile apps serve the files, and how they play
assets/ videos and posters

catalog.json holds names, other names, muscles, equipment, movement pattern, difficulty, duration, description, instructions, common mistakes and each file's path, size and SHA-256.

When to run it

The importer downloads only new or changed files while the folders from its last run are still there: movekit/ and, if you set it, the MOVEKIT_ASSETS_DIR folder (status.json names it as assetsDir). Keep both between builds: commit them to a private repository (a public one publishes every file), or run the importer in a build whose cache keeps both. A build that starts with empty folders, as on Vercel and most serverless hosts, downloads every file again, and each version of a file allows your account 20 downloads a month, so such builds reach each file's limit.

If the files are too heavy to commit and your host keeps no build cache, serve the clips from storage of your own or from MoveKit Hosted.

Serving the files

Your app ships or serves the clips itself. In a web app, put only the clips in its public folder: MOVEKIT_ASSETS_DIR=public/movekit node movekit/import.mjs (or MOVEKIT_ASSETS_DIR=public/movekit python3 movekit/import.py in Python). Later runs keep that folder as long as movekit/catalog.json or movekit/status.json from the last run is there, so the plain command works too; to move the clips, set the variable to the new folder. The importer copies them there and never deletes a file: the old copies stay until you delete them, and status.json lists them under unused. catalog.json, status.json and README.md stay in movekit/, where each file's path then starts with ../public/movekit/, and a clip's URL is /movekit/ followed by its file name. Read the catalog at build time or on your server, never from client code: it lists every file you licensed. Don't link to the clip files as downloads; the terms are in the licence. movekit/README.md covers React Native, iOS, Android and Flutter too.

When the server holds a file back for today, for example after its daily download links are used up, the importer names it, imports the rest and writes the catalog for what arrived. status.json lists the file under missing, with its code and what to do next (next), often: run the importer again after 00:00 UTC. A missing file marked "sample": true is from the sample, and with a key it never fails the run; any other missing file ends the run with a non-zero code. A corrected clip held back keeps its last version in the catalog until the new one arrives, marked "previousInUse": true. If a run stops, status.json gains lastRunFailed (when, why, and which files are from which run). Once the catalog holds exercises from your account, a run with no key, or a key the API refuses, stops and changes nothing.

Getting updates

Run the importer again. It downloads what is new or corrected and skips the rest. A new purchase shows up on the next run, and so does a key you add: the importer reads MOVEKIT_API_KEY from the environment, then from .env.local, then from .env.

Doing it yourself

  1. List what you own with GET /exercises. Each exercise has a video and a poster in assets. With no key, that is the sample.
  2. Ask for up to 50 download links at once with POST /deliveries.
  3. Download each link within 5 minutes, without the API key. A link serves 16 requests, so resume with a Range header.
  4. Check the size and sha256 before you keep a file.