Rust is incredibly fast but has a steep learning curve with lifetimes.
TypeScript is the king of DX but hits a performance ceiling and has "dependency hell."
Go is a concurrency beast but sometimes feels too restrictive with its type system.
Welcome to Duck
Duck is a statically typed, compiled programming language designed to be the one and only tool for full-stack development. We’ve taken the safety of Rust, the flexibility of TypeScript, and the raw efficiency of Go (duck is based on golangs runtime and has one way interoperability) and fused them into one familiar syntax.
Why Duck?
We didn't want to build just another language; we wanted to build a better workflow. Here is how Duck compares to the current "Big Three":
Improving on Rust
Rust is powerful, but for many web applications, it's overkill. Duck simplifies the "boring" parts of networking:
Garbage Collection: No more fighting the borrow checker for standard web APIs.
No Lifetimes: Focus on your logic, not memory management.
Built-in Concurrency: A native runtime designed specifically for high-throughput web servers.
Outperforming Node/TypeScript
If you're tired of node_modules weighing more than a black hole, Duck is for you:
100x Faster: In real-world scenarios, Duck outscales Next.js by up to 100x in requests per second.
Single Binary: Duck compiles to a statically linked native executable. Drop it on a server and it just works.
Modern Tooling: No more npm vs yarn vs pnpm. Duck uses duckup (version manager) and dargo (build tool).
Evolving Go
We love Go’s speed, but we missed the expressiveness of modern type systems:
Advanced Types: Support for Union Types and Duck Typing (pun intended).
SSR & JSX: Duck features a JSX-like syntax out of the box, with support for Preact components.
Better Errors: No more if err != nil. We use union-type-based error handling for cleaner flows.
Native Tailwind: A Rust-based reimplementation of Tailwind CSS is baked directly into the language.
A Quick Look at the Syntax
Duck feels instantly familiar. Here's a quick look on how you might create a simple HTTP Server serving a server-side renderered site to the client containing a interactive client-side rendered preact component.
fn give_me_a_value() -> Int {
13
}
component Counter(props: { initial_value: Int }) jsx {
// Write this component using jsx and preact
const [value, setValue] = useState(props.initial_value);
return (
<>
<div>
<div>Current value: {value}</div>
<button onClick={() => setValue((v) => v + 1)}>Increment</button>
</div>
</>
);
}
template SSRWithParam(props: { color: String, text: String }) duckx {
<div style="color: {props.color}">{props.text}</div>
}
template FullPage(props: { values: Int[] }) duckx {
<>
<!DOCTYPE html>
<html lang="en">
<head>
<title>My page written in Duck SSR</title>
<meta charset="utf-8"/>
</head>
<body>
<Counter initial_value={54}/>
<SSRWithParam color={"green"} text={"green text"}/>
{
const z = give_me_a_value();
<p>I am a computed html. z: {z}</p>
}
<ul>
{*props.values.iter().map(fn(e: &Int) -> Html { <li>{*e}</li> }).into_list().as_ref()}
</ul>
</body>
</html>
</>
}
fn main() {
std::web::HttpServer::new(.verbose)
.serve_template("/", FullPage({values: [10, 123, 45]}))
.listen(":8080");
}
Performance at a Glance
In our benchmarks (https://github.com/duck-compiler/duckc/tree/main/benchmarks), a single Duck deployment massively outscales traditional JS-based architectures, significantly reducing infrastructure costs for high-traffic applications.
Get Involved
Duck is currently in Alpha and we're open for discussions and issues submitted to our github. Come and help us shape the future of webdev
GitHub: https://github.com/duck-compiler/duckc
Website: https://duck-lang.dev
A Tour of Duck: https://duck-lang.dev/docs/category/tour-of-duck
Blog: https://blog.duck-lang.dev
Discord: https://discord.gg/J6Q7qyeESM
What do you think? Could a compiled, GC-language with JSX-syntax replace your current stack in the future? Let’s discuss in the comments!
We will continue actively working on the language and everything related to that. And we will keep you up to date.
Top comments (0)