Recipe: call a server function

generated Luau client · trusted JavaScript handler · about 25 minutes

Declare one public query, generate its typed Luau client, run its trusted handler locally, and correlate the asynchronous result before showing it.

You will send a name from Luau to greeting.message.v1. The local backend validates it, returns a greeting, and the generated decoder admits the result before UI state changes.

The declaration is the shared contract. Luastra uses it to validate the trusted handler boundary and generate client functions; the handler itself is never bundled into client Luau.

A Server function is not a remote Luau function call. It is an asynchronous request to trusted JavaScript code through a declared, validated, versioned contract.

Detail pages

1. Create the project2. Replace luastra.json3. Create backend/functions.json4. Create backend/handlers.mjs5. Generate the typed Luau client6. Replace src/main.luau7. Replace tests/smoke.luau8. Check and run9. Follow one request10. Keep the production boundary honest