๐ Run Slangroom Your Way โ
From terminals to browsersโpowerful, portable, and privacy-preserving execution
Slangroom adapts to your environment with multiple deployment options:
- โจ๏ธ CLI
- ๐ง Slangroom-exec: Execute Slangroom contracts read from
STDIN
- ๐ฏ Twinroom: turn Slangroom contracts into CLI commands
- ๐ง Slangroom-exec: Execute Slangroom contracts read from
- ๐ WEB
- ๐ Online playgorund: Test slangroom contracts instantly on web
- ๐งฉ Web component: Make your HTML a Dyner place
- ๐ HTML: Direclty use slangroom in your html page
- ๐ก REST
- ๐ช Noหcodeหroom: No code REST API server based on Slangroom
- ๐ Twinroom in daemon mode: Turn Slangroom contracts into API
- ๐ฏ JS/TS
- ๐ Library: Integrates slangroom in your JS/TS project
โจ๏ธ CLI โ
Terminal whisperer? ๐ฆ Slangroom speaks your language!
๐ง Slangroom-exec โ
Slangroom-exec is a simple utility that reads from STDIN
the following content
- conf
- slangroom-contract
- data
- keys
- extra
- context
Each is separated by a newline and encoded in base64 (sounds tricky, but slexfe is here to help) and outputs the slangroom execution to STDOUT
.
A simple example using mise to install slangroom-exec and slexfe is the following
# โฌ๏ธ install slangroom-exec (this also install slexfe)
mise use aqua:dyne/slangroom-exec
# โกrun it
cat <<EOF | slexfe | slangroom-exec
Prepare 'timestamp': fetch the local timestamp in seconds
Given I have a 'time' named 'timestamp'
Then print the string '๐ Welcome to the Slangroom World ๐'
Then print the 'timestamp'
EOF
๐ Full documentation | ๐ Back to top
๐ฏ Twinroom โ
Twinroom builds on slangroom-exec, letting you turn Slangroom contracts into CLI commands (and even more!). Not enough? It let you also:
- run external slangroom contracts dynamically ๐งจ
- Expose commands as HTTP API endpoints: daemon mode ๐
Some twinroom examples:
# โฌ๏ธ download the binary
wget https://github.com/forkbombeu/twinroom/releases/latest/download/twinroom -O ~/.local/bin/twinroom && chmod +x ~/.local/bin/twinroom
# ๐ list embedded contracts (that now are commands!)
twinroom test --help
# โก run an embedded contracts
twinroom test hello
# ๐งจ run an external contracts
cat << EOF > welcome.slang
Prepare 'timestamp': fetch the local timestamp in seconds
Given I have a 'time' named 'timestamp'
Then print the string '๐ Welcome to the Slangroom World ๐'
Then print the 'timestamp'
EOF
twinroom $(pwd) welcome
๐ Full documentation | ๐ Back to top
๐ Web โ
Like Bash, but cuter ๐ And serverless.
๐ Online playgorund โ
Test slangroom contracts instantly on the web playgorund
๐งฉ Web component โ
Dyne Components is a UI component library designed for Dyne.org hackers to easily implement web pages that adhere to Dyne.org's design principles. It offers a set of reusable, customizable web components, such as buttons and inputs, built with modern web standards. The library is optimized for seamless integration into web projects, promoting consistency and efficiency in web development.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@dyne/components/dist/dyne-components/dyne-components.css" />
<script type="module" src="https://cdn.jsdelivr.net/npm/@dyne/components/dist/dyne-components/dyne-components.esm.js"></script>
</head>
<body>
<dyne-button emphasis="high">I'm useless but I love you ๐ฅฐ</dyne-button>
</body>
</html>
๐ Full documentation | ๐ Back to top
๐ Simple integration in html file โ
Slangroom can also be directly used in the browser thorugh the plugin @slangroom/browser. This plugin at the moment contains only a subsets of plugin that are:
- @slangroom/fs
- @slangroom/git
- @slangroom/helpers
- @slangroom/http
- @slangroom/json-schema
- @slangroom/location
- @slangroom/pocketbase
- @slangroom/qrcode
- @slangroom/timestamp
A minimal example is:
<html>
<head>
<script type="module" id="slangroom-loader" src="https://cdn.jsdelivr.net/npm/@slangroom/browser"></script>
</head>
<body>
<div id="res"></div>
<script>
document.getElementById('slangroom-loader').addEventListener('load', () => {
const script = `
Prepare 'timestamp': fetch the local timestamp in seconds
Given I have a 'time' named 'timestamp'
Then print the string '๐ Welcome to the Slangroom World in the Web ๐'
Then print the 'timestamp'
`;
const res = document.getElementById('res');
slangroom.execute(script)
.then((r) => {
res.innerText = JSON.stringify(r.result);
});
});
</script>
</body>
</html>
๐ก REST โ
Your contracts, now RESTing comfortably in an endpoint near you. ๐
๐ช Noหcodeหroom โ
Noหcodeหroom lets you execute Slangroom smart contracts via RESTful API calls, turning natural language logic into live endpointsโno traditional code needed. Its strength lies in flexible configuration: you can set it up using command-line options or environment variables, and control the behavior of each API endpoint through a simple metadata file.
First steps with ncr:
# download the binary (only for linux at the moment)
wget https://github.com/forkbombeu/ncr/releases/latest/download/ncr -O ~/.local/bin/ncr && chmod +x ~/.local/bin/ncr
# checkout this repo
git clone https://github.com/forkbombeu/ncr
# run the server on port 3000 with the example folders
ncr -p 3000 -z ./ncr/tests/fixtures --public-directory ./ncr/public
๐ Full documentation | ๐ Back to top
๐ Twinroom in daemon mode โ
Twinroom builds on slangroom-exec, letting you turn Slangroom contracts into CLI commands or HTTP API endpoints.
# โฌ๏ธ download the binary
wget https://github.com/forkbombeu/twinroom/releases/latest/download/twinroom -O ~/.local/bin/twinroom && chmod +x ~/.local/bin/twinroom
# ๐ start the daemon mode
twinroom --daemon
# visit http://localhost:3000/slang for the swagger documentation ot just test it
curl -X GET http://localhost:3000/test/hello
๐ Full documentation | ๐ Back to top
๐ฏ JS/TS โ
Write your will in words, and watch JavaScript make it real. โ
๐ Library โ
import { Slangroom } from '@slangroom/core';
import { db } from '@slangroom/db';
import { ethereum } from '@slangroom/ethereum';
import { fs } from '@slangroom/fs';
import { git } from '@slangroom/git';
import { helpers } from '@slangroom/helpers';
import { http } from '@slangroom/http';
import { JSONSchema } from '@slangroom/json-schema';
import { oauth } from '@slangroom/oauth';
import { pocketbase } from '@slangroom/pocketbase';
import { qrcode } from '@slangroom/qrcode';
import { rdf } from '@slangroom/rdf';
import { redis } from '@slangroom/redis';
import { shell } from '@slangroom/shell';
import { timestamp } from '@slangroom/timestamp';
import { wallet } from '@slangroom/wallet';
import { zencode } from '@slangroom/zencode';
const SLANGROOM_PLUGINS = [
db,
ethereum,
fs,
git,
helpers,
http,
JSONSchema,
oauth,
pocketbase,
qrcode,
rdf,
redis,
shell,
timestamp,
wallet,
zencode
];
const slang = new Slangroom(SLANGROOM_PLUGINS);
// slangroom contract that you want to run
// here we simply take the timestamp in seconds
const script = `Rule unknown ignore
Given I fetch the local timestamp in seconds and output into 'timestamp'
Given I have a 'time' named 'timestamp'
Then print the 'timestamp'
`;
const data = {};
const keys = {};
const res = await slangroom.execute(script, { data, keys })