Formulate is a form-builder for hackers. Rather than using a fiddly drag-and-drop UI to define form layout, connections, and conditional logic, Formulate lets you use code instead. Here's a simple signup form for a newsletter:
export default async function() {
let name = await form.short("First off, what's your name?", {banner: true})
await form.statement(`It's lovely to meet you, ${name} 👋!`)
await form.short("Please enter your email address", {
description: "We won't spam you or share your email with anyone",
email: true,
});
await form.statement("We'll send you an email to confirm. Thanks!");
}
Which generates this form:
There are typically two ways to build forms/surveys/etc. Use a no-code tool like Tally or Google Forms, or build the entire thing yourself, from scratch. These are both reasonable choices, but we believe there's a middle ground that's grossly underserved by the tools available today:
There aren't many tools that work this way, and there isn't an established nomenclature for this kind of tool. We've seen it described as Just Code, which really resonates with us. You get to use the power of a real programming language to build out the logic for your form, without having to worry about UI, persistence, or availability.
You write Javascript code describing your form's content and conditional logic. We take this code and execute it in a secure browser sandbox, and use it to generate the form UI that the respondent sees.
The code you write has full access to Javascript-the-language, but isn't allowed access to Web APIs or the DOM. All external access happens through the form
global object that we provide (also aliased to formulate
and f
), which lets you:
While these building blocks are sufficient to let you build any form that you'd be able to build in a traditional form-builder, you can go much, much further with them…
Loops, conditionals, and variables can be powerful in this context. Coupled with the ability to fetch data over the wire at runtime, you're able to build forms and experiences that are difficult-to-impossible to create in traditional form builders. Here are a few examples:
Math.random()
to group respondents into segments. fetch
to load the data, and generate a payment page in response.Head over to the gallery for more inspiration, or create your first form.