Skip to Content
Mélodium 0.10.1 is now available!
DocsExamplesOverview

Examples

Hello World

Create a file named hello-world.mel, and write this code:

#!/usr/bin/env melodium #! name = hello_world #! version = 0.1.0 #! require = std:0.10.* use std/engine/util::startup use std/engine/log::logInfoMessage treatment main() { startup() logInfoMessage(message = "Hello World!") startup.trigger -> logInfoMessage.trigger }

Then run it using melodium run hello-world.mel.

$ melodium run hello-world.mel [2012-12-21T01:32:45.678Z] info: info: Hello World!

Hello World (as project)

Create raw project using melodium new hello-world.

$ melodium new hello-world success: program 'hello_world' created in 'hello-world'
hello-world ├── Compo.toml └── lib-root.mel

In lib-root.mel file, put the following code:

use std/engine/util::startup use std/engine/log::logInfoMessage treatment main() { startup() logInfoMessage(message = "Hello World!") startup.trigger -> logInfoMessage.trigger }

In Compo.toml, add the entries:

[entrypoints] main = "hello_world::main"

Run it with melodium run hello-world/Compo.toml:

$ melodium run hello-world/Compo.toml [2012-12-21T01:32:45.678Z] info: info: Hello World!

Download

Create raw project using melodium new download.

$ melodium new download success: program 'download' created in 'download'

In lib-root.mel file, put the following code:

use fs/local::writeLocal use http/client/util::get use std/engine/util::startup use std/engine/log::logError treatment download(url: string, file: string) { startup() get(url=url) writeLocal(path=file) logError() startup.trigger -> get.trigger,data -> writeLocal.data get.error --------> logError.message }

In Compo.toml, add the entries:

[dependencies] std = "^0.10.0" fs = "^0.10.0" http = "^0.10.0" [entrypoints] main = "download::download"

Run it with melodium run download/Compo.toml --url https://melodium.tech/img/voyage.jpeg --file nantes.jpeg

More Examples

The examples below are all found in the examples/ directory of the Mélodium repository. Clone it to run any of them locally:

git clone https://github.com/melodium-tech/melodium.git cd melodium/examples

Each example is a self-contained Mélodium project with a Compo.toml and one or more .mel source files. Run any example with:

melodium run <example-dir>/Compo.toml [entrypoint] [-- --arg value …]

Examples by category

Dataflow & HTTP

ExampleWhat it shows
HTTP + JSON PipelinePure dataflow, no models, HTTP client, JSON parsing
SQL User APIConnection pool model, HTTP server, SQL queries
LLM Chat ServerStreaming HTTP responses, remote LLM model
JavaScript TransformEmbedded JS engine model, per-request JSON transformation
Meeting Summary ServiceTwo-stage STT → LLM pipeline per HTTP request
Vision ChatVision LLM, dual entrypoints (CLI + HTTP server)

Speech & AI

ExampleWhat it shows
Batch TranscriptionOne-shot remote STT, Block/Stream bridging
Speech TranscriptionLocal Whisper model, HuggingFace download, mic or file
Voice Q&A (Local)Local Whisper + Mistral, parallel model loading
Full Voice PipelineSTT → LLM → TTS chaining across three cloud APIs
Realtime Voice AssistantDual entrypoints, streaming tokens to console

Distributed & Cloud

ExampleWhat it shows
Distributed WorkDistantEngine + DistributionEngine, front-end/worker split
Distributed Text ProcessingRemote JS treatment, HTTP front-end, on-demand runner
Cloud Worker PipelineFile in → cloud processing → file out, explicit cleanup
Distributed LLM InferenceLLM on remote runner, const param passing, no ML on front-end
CI PipelineCicdDispatchEngine, parallel stages, service sidecars, fork-join