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.melIn 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/examplesEach 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
| Example | What it shows |
|---|---|
| HTTP + JSON Pipeline | Pure dataflow, no models, HTTP client, JSON parsing |
| SQL User API | Connection pool model, HTTP server, SQL queries |
| LLM Chat Server | Streaming HTTP responses, remote LLM model |
| JavaScript Transform | Embedded JS engine model, per-request JSON transformation |
| Meeting Summary Service | Two-stage STT → LLM pipeline per HTTP request |
| Vision Chat | Vision LLM, dual entrypoints (CLI + HTTP server) |
Speech & AI
| Example | What it shows |
|---|---|
| Batch Transcription | One-shot remote STT, Block/Stream bridging |
| Speech Transcription | Local Whisper model, HuggingFace download, mic or file |
| Voice Q&A (Local) | Local Whisper + Mistral, parallel model loading |
| Full Voice Pipeline | STT → LLM → TTS chaining across three cloud APIs |
| Realtime Voice Assistant | Dual entrypoints, streaming tokens to console |
Distributed & Cloud
| Example | What it shows |
|---|---|
| Distributed Work | DistantEngine + DistributionEngine, front-end/worker split |
| Distributed Text Processing | Remote JS treatment, HTTP front-end, on-demand runner |
| Cloud Worker Pipeline | File in → cloud processing → file out, explicit cleanup |
| Distributed LLM Inference | LLM on remote runner, const param passing, no ML on front-end |
| CI Pipeline | CicdDispatchEngine, parallel stages, service sidecars, fork-join |