(Oct. 3rd 2024) Flawless is now in Public Beta. Try it out!
  Flawless Logo, a beautiful woman with freckles head illustration. flawless.dev docs discord

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.

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::rand::random();
side effect
66
let url = format!("https://xkcd.com/{comic_id}/");
deterministic
67
let content = flawless_http::get(url).send();
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. This execution model also makes the whole system 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?

Check out the docs to get started!

Newsletter

Join our newsletter to stay updated on future releases!

Discord

If you need help or have questions, join or discord!

Design partnership

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

Essays