← Recipe: call a server function

5. Generate the typed Luau client

generated Luau client · trusted JavaScript handler · about 25 minutes
declaration → src/generated/server-functions.luau

Generation creates the only client call and decoder names used by application code.

When to use it

Run after creating or changing backend/functions.json. Commit the generated module, but never edit it by hand.

  • greet(input, options) starts the request and returns a numeric RequestId, not the greeting.
  • decodeGreet(payload) returns the declared result or nil for malformed, missing, or extra fields.
  • luastra check rejects a missing or stale generated client.

Focused example

luastra generate
# Expect result: PASS and module: app/server-functions

Complete inventory

View all pages in Recipe: call a server function
← Previous: 4. Create backend/handlers.mjsNext: 6. Replace src/main.luau →