UNPKG

@softr/sdk

Version:

The SDK for building Softr apps on TanStack Start. It lets an app interact with Softr: auth, datasources, workflows and integrations.

127 lines (126 loc) • 5 kB
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "softr.json", "type": "object", "properties": { "auth": { "type": "object", "description": "Authentication. Written in this repo and read by the app's build.", "properties": { "routes": { "type": "object", "description": "Where the app's sign-in pages live.", "properties": { "login": { "type": "object", "description": "The sign-in page.", "properties": { "path": { "$ref": "#/$defs/appPath" }, "redirectParam": { "type": "string", "description": "The search param that carries where to go after signing in. Every unauthenticated redirect sets it." } }, "required": ["path", "redirectParam"], "additionalProperties": false }, "resetPassword": { "$ref": "#/$defs/tokenRoute", "description": "The page a password reset email links to." }, "acceptInvitation": { "$ref": "#/$defs/tokenRoute", "description": "The page an invitation email links to." }, "magicLink": { "$ref": "#/$defs/tokenRoute", "description": "The page a magic link email links to." }, "sso": { "type": "object", "description": "The page single sign-on comes back to when it needs an authenticator code or failed. Defaults to /sso-authentication.", "properties": { "path": { "$ref": "#/$defs/appPath" } }, "required": ["path"], "additionalProperties": false } }, "required": ["login", "resetPassword", "acceptInvitation", "magicLink"], "additionalProperties": false }, "guard": { "type": "object", "description": "What a route guard does when it denies a visitor. A route's own overrides win over these.", "properties": { "unauthenticated": { "$ref": "#/$defs/accessBehaviour", "description": "The route needs a signed-in visitor and there is none. Defaults to a redirect to /login." }, "alreadyAuthenticated": { "$ref": "#/$defs/accessBehaviour", "description": "The route is for signed-out visitors only. Defaults to a redirect to /." }, "forbidden": { "$ref": "#/$defs/accessBehaviour", "description": "Signed in, but in none of the groups the route names. Defaults to throwing, for the route's errorComponent to render." } }, "required": ["unauthenticated", "alreadyAuthenticated", "forbidden"], "additionalProperties": false } }, "required": ["routes", "guard"], "additionalProperties": false }, "user": { "type": "object", "description": "The signed-in user.", "properties": { "properties": { "type": "object", "description": "Fields of the users table the app reads as user.properties, keyed by the name the app uses. Each value is a field id. No other field leaves the server.", "additionalProperties": { "type": "string" } } }, "required": ["properties"], "additionalProperties": false }, "allowEmbedding": { "type": "array", "description": "Sites that may show the published app in an iframe, signed-in pages included, as https origins like \"https://partner.com\", or \"*\" for any site. Any other site is still blocked. With at least one, session cookies use SameSite=None, which drops the browser's CSRF protection. Empty by default.", "items": { "type": "string", "pattern": "^(\\*|https://[^/\\\\?#@\\s;,]+)$" } } }, "required": ["auth"], "$defs": { "appPath": { "type": "string", "pattern": "^/[^?#]*$", "description": "A path on this app, with no search or hash." }, "tokenRoute": { "type": "object", "properties": { "path": { "$ref": "#/$defs/appPath" }, "tokenParam": { "type": "string", "description": "The search param that carries the link's token." } }, "required": ["path", "tokenParam"], "additionalProperties": false }, "accessBehaviour": { "oneOf": [ { "type": "string", "description": "A path to redirect to." }, { "type": "object", "properties": { "strategy": { "const": "redirect" }, "to": { "type": "string" } }, "required": ["strategy", "to"], "additionalProperties": false }, { "type": "object", "properties": { "strategy": { "const": "throw" } }, "required": ["strategy"], "additionalProperties": false } ] } } }