# colis with MinIO

> Deliver files to your clients from a MinIO bucket with colis: the createBucket() configuration, the CLI starter, and what to know about this provider.

Canonical: https://colis-site.vercel.app/en/providers/minio · Markdown: https://colis-site.vercel.app/en/providers/minio.md · Français: https://colis-site.vercel.app/providers/minio

One Docker command, and the whole delivery flow runs on your laptop.

**createBucket()**
```ts
import { createBucket } from '@colis/core'

const store = createBucket({
  bucket: 'transfers',
  endpoint: 'http://localhost:9000',
  credentials: { accessKeyId: 'minioadmin', secretAccessKey: 'minioadmin' },
})
```

## Why this one
A local MinIO is the cheapest way to try colis for real: the same PutObject with the same conditional headers, no account to create and no network to wait on. The delivery page’s .env.example has a block for it.

## A starter configuration, and what is left to do.
init writes the file with ${VAR} references rather than secrets, so it is meant to be committed; the env file it points at is not.

```sh
colis init --provider minio --bucket transfers
```
**colis.config.json**
```json
{
  "bucket": "transfers",
  "endpoint": "http://localhost:9000",
  "forcePathStyle": true,
  "prefix": "transfers",
  "expiresIn": "1h",
  "credentials": { "accessKeyId": "minioadmin", "secretAccessKey": "minioadmin" }
}
```

### Then
1. docker run -p 9000:9000 -p 9001:9001 -e MINIO_ROOT_USER=minioadmin -e MINIO_ROOT_PASSWORD=minioadmin quay.io/minio/minio server /data --console-address ":9001"
2. Create the bucket from the console on http://localhost:9001.
3. Run `colis verifier`. It performs the operations colis needs and reports what happened.

## Notes on MinIO.
- **Path-style addressing** — Self-hosted gateways require https://endpoint/bucket/key. Setting an endpoint turns it on; the starter configuration writes it explicitly so the intent is visible.
- **Self-hosted in production too** — The same configuration, with real credentials and TLS, runs against a MinIO cluster or any gateway that implements conditional PutObject. colis verifier tells you whether yours does.
- **Expiry cleanup** — The expiry stops a parcel being handed over; only a lifecycle rule deletes the object. Give the prefix a rule that expires objects after a day or two, and colis verifier turns green.

[The full guide](https://colis-docs.vercel.app/docs/stockages)
