Skip to main content

Frontend

Full-code apps support React and Svelte frontends. Your code is bundled by Windmill and served as a single-page application. The auto-generated wmill.ts module provides typed functions to call backend runnables.

Framework support​

When scaffolding a new app with wmill app new, you can choose from:

  • React 19 / React 18
  • Svelte 5

The CLI generates a starter project with the selected framework, including package.json, entry point and a sample component.

Styling​

CSS imported from your entry point (import './index.css') is bundled as is.

To use Tailwind CSS v4, add tailwindcss (^4) to the app's package.json and start index.css with:

@import "tailwindcss";

The bundler then compiles that stylesheet, generating the utilities used in your app's files and in the workspace's shared /ui folder, along with @theme, @utility, @apply and @custom-variant. A design system's stylesheet can live in the shared /ui folder and be imported with @import "/ui/theme.css";. There is no tailwind.config.js: configure Tailwind in CSS. @plugin and @config are compiled only by the CLI (wmill app bundle, wmill app push), not by the web editor, and wmill app dev must be restarted to pick up an edit to one of them.

Without the tailwindcss dependency, or with Tailwind v3 installed, Tailwind directives are left uncompiled.

The wmill.ts module​

The wmill.ts module is auto-generated during development (wmill app dev) and provides the bridge between your frontend and Windmill's backend. It exports:

backend - synchronous calls​

Calls a backend runnable and waits for the result:

import { backend } from "./wmill.ts";

// Calls the "get_users" runnable, waits for completion
const users = await backend.get_users({ limit: 10 });

backendAsync - asynchronous calls​

Starts a backend runnable and returns a job ID immediately:

import { backendAsync } from "./wmill.ts";

// Starts the runnable, returns job ID without waiting
const jobId = await backendAsync.long_running_task({ input: data });

Conversations​

backend and backendAsync take an optional { memoryId } second argument that makes the call a turn of that conversation, with a saved agent or a flow in chat mode. For any other flow, it only scopes the memory of its AI agent steps, with no conversation kept. A signed-in viewer's conversations are theirs alone, and an anonymous visitor's are kept apart per app.

waitJob - wait for a job​

Waits for a previously started async job to complete:

import { backendAsync, waitJob } from "./wmill.ts";

const jobId = await backendAsync.process_data({ file: "input.csv" });
// Do other work...
const result = await waitJob(jobId);

getJob - check job status​

Gets the current status and result of a job:

import { getJob } from "./wmill.ts";

const job = await getJob(jobId);

streamJob - stream job output​

Streams results from a running job, calling a callback for each update:

import { backendAsync, streamJob } from "./wmill.ts";

const jobId = await backendAsync.generate_report({ query: "SELECT *" });

const finalResult = await streamJob(jobId, (update) => {
if (update.new_result_stream) {
console.log("Streaming chunk:", update.new_result_stream);
}
});

These functions all call the app's own backend runnables, which execute under the app's execution policy. Calling the wider Windmill API from frontend code is a separate feature: it requires sandbox isolation, and runs as the viewer rather than the publisher. To put a chat over a flow in chat mode, use the @windmill-labs/chat-sdk package. For a saved AI agent, give the app an agent runnable.

Framework examples​

// App.tsx
import { useState, useEffect } from "react";
import { backend } from "./wmill.ts";

export default function App() {
const [users, setUsers] = useState([]);
const [loading, setLoading] = useState(true);

useEffect(() => {
backend.get_users({ limit: 50 })
.then(setUsers)
.finally(() => setLoading(false));
}, []);

if (loading) return <div>Loading...</div>;

return (
<table>
<thead>
<tr><th>Name</th><th>Email</th></tr>
</thead>
<tbody>
{users.map((u) => (
<tr key={u.id}><td>{u.name}</td><td>{u.email}</td></tr>
))}
</tbody>
</table>
);
}

Full-code apps

Page context​

window.ctx holds the context of the page the app is viewed on:

  • ctx: the current user (absent for anonymous visitors of a public app).
  • workspace and path: the app's workspace and path (path is not set under wmill app dev).
  • query: the page URL's query parameters, as an object of strings. A page with no query gives {}.
// Viewed at /apps/get/u/me/app?customer=42
const customerId = window.ctx.query.customer; // '42'

query is read once, when the app loads. Read query parameters from window.ctx.query rather than window.location: a sandboxed app runs in its own frame, so its window.location is the frame's address, not the viewer's page.

Type safety​

During development, wmill app dev generates a wmill.d.ts file with typed signatures for each backend runnable. For example, given backend/get_users.ts:

export async function main(limit: number = 10): Promise<User[]> { ... }

The generated types will be:

export const backend: {
get_users: (v: { limit?: number }) => Promise<User[]>;
};

This gives you autocomplete and type checking when calling runnables from your frontend.