Replace your stack. Duso is a complete language and runtime with server, database, tooling, docs, and integrations in one 12MB binary.
One 12MB binary. Everything inside. No npm, pip, or cargo needed.
Hot-reloaded scripts with caching. No compile step, just edit and test.
New script language features simple syntax made for AI and Humans.
Templates, routing, JSON, SSL, JWT, CORS, RSA, websockets. Fully featured and built-in.
Let your AI code faster in a language made for it. Connect your app to popular AI agents.
Maybe the only data solution you'll need for caching, coordination, and long term storage with ACID, encryption, and replication.
Duso has built-in support for Postgres, MySQL, MariaDB, TiDB, and CockroachDB. All drivers included, nothing extra to install.
Simple API backed by Go's efficient goroutines. Run thousands of parallel operations.
Upload, crop, scale, and convert between PNG, GIF, and JPEG. Save, load, and transform images.
Sandbox mode restricts file access and uses virtual filesystem for safety.
Use Duso to build config, setup, diagnostics, and other command line tools.
App code, full runtime, all dependencies in a single, tiny executable.
Supports Linux, macOS, and Windows. One build, every platform.
Hot reload, instant feedback, intuitive syntax. Development feels effortless and enjoyable.
Duso runs great on the cheapest virtual servers with a resting memory use of ~5MB.
No callbacks either. Enjoy the simple coding freedom of a real concurrency model.
Every request is isolated and thread safe. Coordinate safely through datastores.
Math, strings, regex, crypto, file I/O, date/time, and system functions.
Objects, arrays, functions, boolean, binary, error, code, and regex are all first-class values.
Community modules bundled in the binary like Claude, OpenAI, Ollama, Discord, and Stripe.
You're not forced into multiple servers. Scale up simply by adding more cores to your server.
Duso was written in Go, a battle-tested systems language made by Google.
Breakpoints, stack traces, and code interaction. Even concurrent errors, one at a time.
120+ functions and library modules with integrated examples and guides.
Look up reference for any function, keyword, type, or module right from the command line.
Warns about parsing errors and more subtle code issues that might break at runtime.
LSP server, syntax highlighting, autocomplete, hints, and diagnostics for VS Code, Zed, NeoVim etc.
Apache 2.0 licensed. Community-driven and fully transparent.
Duso was designed to be quickly learned by most AI coding assistants. All Duso documentation and examples are included in its binary.
# start here!
duso read
# look up a specific function or lib
duso doc claude
Start with a simple sample project. Several are included to help you get started. Plus there are dozens of examples you can extract as well. Or jump into the interactive REPL to test code directly.
# pick from 5 starter projects
duso init myproject
# extract examples to local directory
duso extract examples /tmp
# interactive REPL to test code
duso repl
One-shot Q&A style prompts are easy.
ai = require("ollama")
print(ai.prompt("sup?"))
You can add system prompt and tools, but this will get you started. Displays a cute “busy” spinner while waiting for a response.
ai = require("openai")
chat = ai.session()
while true do
prompt = input("\n\nYou: ")
if lower(prompt) == "exit" then break end
write("\n\nOpenAI: ")
busy("thinking...")
write(chat.prompt(prompt))
end
Prompts experts in parallel, gathers their responses, then runs them through a summary prompt. Builtins like parallel() and spawn() are backed by simple and efficient goroutines. Multi-line strings and versatile string templates are built into Duso, making it easy to compose prompts, SQL, and other long strings.
ai = require("claude")
prompt = input("Ask the panel: ")
busy("asking...")
// build an array of functions to prompt
// each expert, then run them all in parallel
experts = ["Astronomer", "Astrologer", "Biologist", "Accountant"]
responses = parallel(map(experts, function(expert)
return function()
return ai.prompt(prompt, {
system = """
You are an expert {{expert}}. Always reason and
interact from this mindset. Limit your field of
knowledge to this expertise.
""",
max_tokens = 500
})
end
end))
// prepend the expert type into their response
for i = 0, 3 do
responses[i] = """
{{experts[i]}} says:
{{replace(responses[i], "---", "")}}
"""
end
busy("summarizing...")
summary = ai.prompt("""
Summarize these responses:
{{join(responses, "\n\n---\n\n")}}
List 3 the things they have in common.
Then list the 3 things that are the most different.
""")
// format the markdown response for the terminal
print(markdown_ansi(summary))
You can run a web server from the command line.
# http://localhost:8080
duso eval 'http_server().start()'
Spawn multiple worker scripts that process items from a datastore queue. Workers block on pop_wait() until tasks arrive, coordinate via shared datastore, and record results. Demonstrates concurrent processing with simple synchronization.
// queue-main.du
queue = datastore("tasks")
queue.set("done", 0)
// Spawn 3 workers
for i = 1, 3 do
spawn("queue-worker.du", {id = i})
end
// Queue 5 tasks
for i = 1, 5 do
queue.push("jobs", {name = "Task {{i}}"})
end
// Wait for all to complete
queue.wait("done", 5)
// Show results
work = queue.get("results")
for job in work do
print("✓ {{job.name}} by worker {{job.id}}")
end
// queue-worker.du
ctx = context()
id = ctx.id
queue = datastore("tasks")
while true do
job = queue.pop_wait("jobs", timeout = 5)
if not job then break end
sleep(random() * 2)
queue.push("results", {id = id, name = job.name})
queue.increment("done")
end
Build an HTTP API with routing and JSON responses.
Best practice is one handler script per route to make
each more manageable and efficient at runtime. Each time
a route is triggered, http_server spawns a goroutine that runs a cached,
pre-parsed instance of that script to handle it. It’s a simple pattern
that’s also hyper efficient.
// server.du
port = 3000
server = http_server({port = port})
server.route("GET", "/api/user/:id", "user-get.du")
server.route("POST", "/api/user", "user-post.du")
// make users datastore use acid-compliant persistence
users = datastore("users", {
persist = "/tmp/users.gob",
wal = "/tmp/users.wal",
wal_sync_interval = 900
})
print("Server running at http://localhost:{{port}}")
server.start()
// ...script blocks while server is running...
print("Server stopped.")
// user-get.du
ctx = context()
req = ctx.request()
res = ctx.response()
user = datastore("users").get(req.params.id)
if not user then res.error(404) end
res.json({
success = true,
data = user
}, 200)
// user-post.du
ctx = context()
req = ctx.request()
res = ctx.response()
id = uuid()
user = parse_json(req.body)
datastore("users").set(id, user)
res.json({
id = id,
name = user.name
}, 201)
Duso is intentionally simple and predictable. No magic. No multiple ways to do the same thing. Every pattern is consistent so AI can reason about code reliably and write better scripts faster.
Duso is a joy to use. Everything including the runtime, libs, and docs is bundled in a single 12MB binary. No package management. No version conflicts. No stack building. Duso makes coding fun again.