---
title: "Turbo cache"
description: "How the Turborepo remote cache works in CI, how to use it locally and what it saved."
url: https://pr-194-docs.preview-lehoetel.findmalek.engineer/docs/turbo-cache
markdown: https://pr-194-docs.preview-lehoetel.findmalek.engineer/docs/turbo-cache.md
---

# Turbo cache

The cache server runs on The Keep as the Dokploy application `turbo-cache` ([decision](https://pr-194-docs.preview-lehoetel.findmalek.engineer/docs/decisions/turbo-remote-cache.md)). It listens on `https://turbo-lehoetel.findmalek.engineer`, artifacts live in the volume `lehoetel-turbo-cache-data`.

## CI

`ci.yml` reads the repo variables `TURBO_API` and `TURBO_TEAM` and the secret `TURBO_TOKEN`. When the token is set turbo uses the server. When it is empty (forks, a missing secret) the job restores `.turbo/cache` and `.next/cache` with the GitHub Actions cache instead.

## Locally

```bash
export TURBO_API=https://turbo-lehoetel.findmalek.engineer TURBO_TEAM=le-hoetel TURBO_TOKEN=<ask Malek>
pnpm build
```

Without the variables nothing changes, turbo only uses its local cache.

## Operate

- Health: `curl -H "Authorization: Bearer $TURBO_TOKEN" $TURBO_API/v8/artifacts/status` returns `{"status":"enabled"}`.
- Rotate the token: change `TURBO_TOKEN` in the Dokploy application environment, redeploy, update the GitHub secret.
- Clear the cache: delete the files in the volume, it refills on the next run.

## Measured CI time

Wall time of the `ci` job. The before row is full runs on main, the other rows are a pull request with `--affected`, so only the warm against cold rows compare directly. Install, lint and the migration check are not cached by turbo and are the floor.

| Setup | Runs | Wall time |
|---|---|---|
| GitHub Actions cache only (main, before) | 8 recent runs | 2m21s to 3m07s, about 2m50s |
| Remote cache, first run on PR 185 (cold, fills it, `--affected`) | 1 run | 1m21s |
| Remote cache, rerun of the same commit (warm) | 1 run | 59s |
