---
title: "Blobstore Fileserver (NATS) | Cosmonic"
description: "Serve files from NATS-backed blob storage using a Rust WebAssembly component on Cosmonic Control."
canonical: "https://cosmonic.com/docs/template-catalog/blobstore-fileserver-nats/"
---

# Blobstore Fileserver (NATS)

A blob storage ("blobby") fileserver backed by NATS, implemented as a Wasm component and packaged for Cosmonic Control.

## Deploy with Helm

```shell
helm install blobby --version 0.2.0 oci://ghcr.io/cosmonic-labs/charts/http-trigger -f https://raw.githubusercontent.com/cosmonic-labs/control-demos/refs/heads/main/blobby/values.http-trigger.yaml
```

**Repository**: [`cosmonic-labs/control-demos/blobby`](https://github.com/cosmonic-labs/control-demos/tree/main/blobby) **Languages**: Rust **Interfaces**: `wasi/http`, `wasi/blobstore`

## Running on Kubernetes

You will need a local Kubernetes environment with Cosmonic Control installed according to the [Get Started](https://cosmonic.com/docs/install-cosmonic-control/) guide.

Now you can connect to the component at `http://blobby.localhost.cosmonic.sh`.

Create a file with some content:

```shell
$ echo 'Hello there!' > myfile.txt
```

Upload the file to the fileserver:

```shell
curl -H 'Content-Type: text/plain' -v 'http://blobby.localhost.cosmonic.sh/myfile.txt' --data-binary @myfile.txt
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> POST /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
> Content-Type: text/plain
> Content-Length: 13
>
* upload completely sent off: 13 bytes
< HTTP/1.1 201 Created
< date: Thu, 09 Oct 2025 19:55:00 GMT
< x-envoy-upstream-service-time: 1
< server: envoy
< transfer-encoding: chunked
<
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
Wrote myfile.txt to blobstore successfully
```

Get the file back from the server:

```shell
curl -v 'http://blobby.localhost.cosmonic.sh/myfile.txt'
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> GET /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< date: Thu, 09 Oct 2025 19:57:01 GMT
< x-envoy-upstream-service-time: 2
< server: envoy
< transfer-encoding: chunked
<
Hello there!
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
```

Update the file:

```shell
echo 'General Kenobi!' >> myfile.txt
```

Update the file on the fileserver:

```shell
curl -H 'Content-Type: text/plain' -v 'http://blobby.localhost.cosmonic.sh/myfile.txt' --data-binary @myfile.txt
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> POST /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
> Content-Type: text/plain
> Content-Length: 29
>
* upload completely sent off: 29 bytes
< HTTP/1.1 201 Created
< date: Thu, 09 Oct 2025 20:14:30 GMT
< x-envoy-upstream-service-time: 2
< server: envoy
< transfer-encoding: chunked
<
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
Wrote myfile.txt to blobstore successfully
```

Get the file again to see your updates:

```shell
curl -v 'http://blobby.localhost.cosmonic.sh/myfile.txt'
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> GET /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< date: Thu, 09 Oct 2025 20:15:45 GMT
< x-envoy-upstream-service-time: 0
< server: envoy
< transfer-encoding: chunked
<
Hello there!
General Kenobi!
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
```

Delete the file:

```shell
curl -X DELETE -v 'http://blobby.localhost.cosmonic.sh/myfile.txt'
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> DELETE /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< date: Thu, 09 Oct 2025 20:16:15 GMT
< x-envoy-upstream-service-time: 2
< server: envoy
< transfer-encoding: chunked
<
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
Deleted myfile.txt from blobstore successfully
```

Confirm that the file doesn't exist anymore:

```shell
curl -v 'http://blobby.localhost.cosmonic.sh/myfile.txt'
```

```text
* Host blobby.localhost.cosmonic.sh:80 was resolved.
* IPv6: (none)
* IPv4: 127.0.0.1
*   Trying 127.0.0.1:80...
* Connected to blobby.localhost.cosmonic.sh (127.0.0.1) port 80
> GET /myfile.txt HTTP/1.1
> Host: blobby.localhost.cosmonic.sh
> User-Agent: curl/8.7.1
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 404 Not Found
< date: Thu, 09 Oct 2025 20:17:09 GMT
< x-envoy-upstream-service-time: 0
< server: envoy
< transfer-encoding: chunked
<
* Connection #0 to host blobby.localhost.cosmonic.sh left intact
Object not found
```

## Development

Development requirements:

- [`cargo`](https://www.rust-lang.org/tools/install) 1.82+ for the Rust toolchain
- `wasm32-wasip2` target for Rust: Install with `rustup target add wasm32-wasip2`
- [Wasm Shell (`wash`)](https://github.com/wasmCloud/wasmcloud) **v2.0.4** for component development

Clone the [`wasmcloud/wasmcloud`](https://github.com/wasmcloud/wasmcloud) repository:

```shell
git clone https://github.com/wasmcloud/wasmcloud.git
```

```shell
cd wasmcloud/examples/rust/components/blobby
```

Start the development loop:

```shell
wash dev
```

The component is accessible at localhost:8000. View the code and make changes in `src/lib.rs`.

You can cancel the `wash dev` process with `Ctrl-C`.

### Build the Wasm Binary

Compile the component:

```shell
wash build
```

The `.wasm` binary will output to `/target/wasm32-wasip2/debug`.

## Learn More

- See the wasmCloud Developer Guide for instructions on [pushing your Wasm component to an OCI registry](https://wasmcloud.com/docs/wash/developer-guide/).
- To learn how to extend this example with additional capabilities, see the [Adding Capabilities](https://wasmcloud.com/docs/tour/adding-capabilities?lang=rust) section of the wasmCloud documentation.
- For more on building components in Go, see the [Component Developer Guide](https://wasmcloud.com/docs/developer/languages/go/components/) in the wasmCloud documentation.

Last updated on **Nov 10, 2026** by **Liam Randall**
