Backend
luastra.json · schema v2backend{}Trusted operations and generated clients.
When to use it
Read this page when you need to apply Backend, verify its exact contract, and adapt the example without bypassing validation or host boundaries.
- Optional object. declaration (.json), handler (.mjs), generatedClient (.luau) and generatedModule are required; file paths must stay inside the project.
- generatedModule must appear in modules with source matching generatedClient and dependencies including luastra/server. Importers must declare that dependency. Use luastra backend generate to generate or refresh the client.
- authentication: development (default) or session. database: omitted for memory, or { "provider": "sqlite", "path": "data/app.sqlite" } for a safe relative persistent .sqlite path.
- identity: optional { "provider": "local-password" } (requires SQLite), or { "provider": "supabase" } (requires session authentication). Keep provider credentials out of the public manifest.
- records: optional named local or Supabase collections. Local collections require an explicit public, authenticated or immutable-owner authorization mode. Supabase collections require Supabase identity and database grants/RLS; URLs, keys and session tokens never belong in the manifest.
- content: optional array of at most 64 entries, each with id, source under content/ and an admitted image/audio mediaType. Server content is distinct from client assets; fonts are not admitted here.
- uploads: optional array of at most 32 reusable upload purposes. Each local or Supabase declaration narrows PNG/JPEG media types, byte size, dimensions, and provider location; application handlers create and commit opaque intents through context.content.
- A backend declaration does not deploy a production service. See the server recipes and host configuration.
Focused example
"backend": {
"declaration": "backend/functions.json",
"handler": "backend/handlers.mjs",
"generatedClient": "src/generated/server-functions.luau",
"generatedModule": "app/server-functions",
"records": {
"notes": {
"provider": "local",
"authorization": { "mode": "owner", "field": "ownerId" },
"mutableFields": ["title"],
"insertFields": ["id", "ownerId", "title"]
}
}
}