Flawless Logo, a beautiful woman with freckles head illustration. flawless.dev

Flawless is an execution engine for durable computation. It will run your code until completion even in the presence of hardware or software failure.

We aspire to allow builders to create amazing experiences for others. And the best user experiences require complex UIs holding complex state, but trying to model all the state inside your database can be challenging. At the same time, you don't want the user to lose progress by accidentally refreshing the page, making continuous persistence a requirement for modern applications.

Flawless allows you to model this persistent state with just code and local variables, raising the bar when it comes to expressing complex behaviors inside applications.

How does it work?

Workflows in flawless are written in Rust, in fact they are just regular Rust functions. This means that they can contain arbitrary logic. But instead of native code, the functions are compiled to WebAssembly and executed in a completely deterministic environment. The only nondeterminism is introduced when interacting with the "real world", like performing HTTP requests or generating random numbers. WebAssembly requires us to explicitly handle the non-deterministic execution.

We use that knowledge to persist a log of non-deterministic side effects. This means that if the execution of a workflow is ever interrupted, we can just re-run it and catch up to the same state without the need to perform the side effects again.

workflow.rs ×
restarting ...
side effect log
>
63
64
let user = "Adele Goldberg";
deterministic
65
let comic_id: u32 = flawless::random();
side effect
66
let url = format!("https://xkcd.com/{comic_id}/");
deterministic
67
let content = flawless::http::get(url);
side effect
68
let quote = parse_comic(content);
deterministic
69
let greeting = format!("Hi {user}! // '{quote}'")
deterministic
70
Error: Execution Interrupted!
Machine unexpectedly rebooted.
Execution Completed!
...
recv msg {...}
HTTP request
send msg {...}
get clock time
_
_
_
>
▓———————————————————————————————————————————————————————————————————————————█

This makes the amount of data we need to persist minimal, and the rest is just re-calculated on-demand in case of failure. A nice side effect of this model is that the whole system is observable. We can take any finished or still running workflow and analyze the exact execution path it took to get into the current state. With a completely deterministic execution environment, impossible to reproduce bugs become a problem of the past.

Notice how flawless takes away the burden of persisting the state. You just write business logic and can be assured that all the actions are going to run until completion, even if you need to occasionally restart the server because of maintenance. Once you start the flawless engine back up, the workflows are going to seamlessly continue executing from where they stopped.

Want to try it out?

If you would like to be one of the first developers to get access to flawless as part of our private alpha. Join our waitlist.

If you are a company and would like to work closely with me to shape flawless specifically for your needs, email [email protected].

~ Bernard

Essays