# Examples

> Run colis on your machine: the delivery page against a local MinIO, the CLI sending to it and following the answer, and the n8n node built and tested. Plus the READMEs and the guides.

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

Everything in the repository runs locally against a MinIO container: nothing to sign up for, and the real code path. Start the delivery page, then send to it from a terminal.

```sh
git clone https://github.com/mamadouwhile/colis.git && cd colis
bun install && bun run build
```

**a bucket on your laptop**
```sh
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"
```

## The delivery page, locally (templates/drop)
The whole template on your machine, against a MinIO: drop a file, open it in another browser, approve it, and watch the receipt change on the sending page.

- The file staged before it goes: preview, lifetime, password, note
- The pickup page: preview, password, then approve or ask for changes
- The sender’s tracking, which updates on its own
- Straight to the bucket in parts above DROP_MAX_SIZE_MB, resumable

Source on GitHub: https://github.com/mamadouwhile/colis/tree/main/templates/drop

```sh
cp templates/drop/.env.example templates/drop/.env.local   # then uncomment its MinIO block
bun install
bun run --filter colis-drop dev                               # http://localhost:3400
```

## The CLI against your page (packages/cli)
Send a file from a terminal to the delivery page running locally, then follow its delivery with colis statut while you answer in the browser.

- verifier against a server: a real round trip, and a non-zero exit when it fails
- The code alone on stdout, everything else on stderr
- statut: the state on the first line, then each step with its time

Source on GitHub: https://github.com/mamadouwhile/colis/tree/main/packages/cli

```sh
bun run build
alias colis="node $PWD/packages/cli/dist/index.js"
colis --remote http://localhost:3400/api/transfers verifier
colis --remote http://localhost:3400/api/transfers envoyer ./maquette.pdf
colis --remote http://localhost:3400/api/transfers statut <code>
```

## The n8n node (packages/n8n-nodes-colis)
Both nodes, Colis Trigger and Colis, built and tested without n8n: the logic lives in plain functions the nodes only wire in.

- The signature check with verifyWebhook, the same code that signs
- An event you did not select answered 200 and starting nothing, so the deployment does not retry it
- Send, Get, Get Status and Delete on a parcel

Source on GitHub: https://github.com/mamadouwhile/colis/tree/main/packages/n8n-nodes-colis

```sh
bun run --filter n8n-nodes-colis build   # dist/, and the icons beside the nodes
bun run --filter n8n-nodes-colis test    # both nodes, against a fake n8n context
```

## Written down, end to end.
The READMEs in the repository and the pages of the documentation.

- [The delivery page: Options, large files, webhooks, variables: the whole template.](https://github.com/mamadouwhile/colis/blob/main/templates/drop/README.md)
- [The n8n node: Install, credentials, two workflows.](https://github.com/mamadouwhile/colis/blob/main/packages/n8n-nodes-colis/README.md)
- [Setting up a server: Routes, authorization, expiry, CORS.](https://colis-docs.vercel.app/docs/protocole#monter-les-routes)
- [The protocol: Four routes, one error format.](https://colis-docs.vercel.app/docs/protocole)
- [The CLI: Every command and every option.](https://colis-docs.vercel.app/docs/cli)
- [Testing: A bucket in memory: no credentials, no network.](https://colis-docs.vercel.app/docs/tests)

## From nothing to an approved parcel.
1. Start MinIO with the command above, create a bucket, and uncomment the MinIO block in the delivery page’s .env.local.
2. Start the delivery page, and check that it answers.
3. Send a file, open its link in another browser, approve it, and read the receipt.

```sh
alias colis="node $PWD/packages/cli/dist/index.js"
bun run --filter colis-drop dev
colis --remote http://localhost:3400/api/transfers verifier
colis --remote http://localhost:3400/api/transfers envoyer ./maquette.pdf
colis --remote http://localhost:3400/api/transfers statut K7QP2M4X
```
