Skip to main content

Crate ordinary_config

Crate ordinary_config 

Source
Expand description

§Ordinary Config

crates.io docs.rs dependency status License: BSD-3-Clause

Config for Ordinary.

§License

Copyright 2026 The Ordinary Authors

Licensed under BSD-3-Clause

§ordinary.json Reference

§OrdinaryConfig

Config definition for an Ordinary Application

§lifecycle

(any of) TopLevelLifecycle | null

§domain

string

Domain name for the application to be run from the deployment environment.

§version

string

Version of the site build.

§cnames

array | null

additional domains with an ALIAS record pointing at the primary OrdinaryConfig::domain.

add a TXT record in the following format: ordinary=your.config.domain

§canonical

string | null

specify which of the domain or cnames is the “canonical” location.

this is useful for indexing and situations where you want to display the primary URL as text on the page itself (i.e. pick one of example.some.host, example.com, and www.example.com).

defaults to domain if cnames is empty. defaults to first cname in list if cnames are not empty.

§http

(any of) HttpConfig | null

§contacts

array | null

list of email addresses that can be used to contact the application owner or administrators.

§hide_contacts

boolean | null

whether contacts should be hidden (defaults to true)

§storage_size

integer | null

Storage size in bytes (rounded up to nearest OS page size).

§runtime

(any of) RuntimeMode | null

Specifies runtime mode for application on the host.

If none is specified, defaults to Shared (or host default).

§hide_schema

boolean | null

When set to true, {{ domain }}/.ordinary/schema is not addressable.

Note: this can break applications which depend on flags, and function/template query descriptors.

§client_events

boolean | null

Include E2EE handler code in the client WASM.

§port

integer | null

Port to be used for standalone “run” instances.

§redirect_port

integer | null

port used for redirecting from http when standalone is running in secure mode.

§logging

(any of) LoggingConfig | null

§error

(any of) ErrorConfig | null

Configures error handling.

Note: If not included just the error message will be sent back as text.

§auth

(any of) AuthConfig | null

Auth config for the Ordinary application.

§globals

object | null

Global constants that can be accessed from functions

§secrets

array<Secret> | null

Secrets that can be used by functions.

§database

(any of) DatabaseConfig | null

Definitions for the models that will be stored in the Ordinary database.

§functions

array<FunctionConfig> | null

IO, access and language configuration for functions that are compiled to and executed as WebAssembly modules.

§assets

(any of) AssetsConfig | null

Specifies the asset directory and per-path configuration details for assets that require preprocessing (TypeScript, SCSS, JavaScript minification, etc.)

§TopLevelLifecycle

§before_all

array | null

run before every lifecycle operation

§build

(any of) LifecycleBeforeAfterScripts | null

configure build lifecycle hooks

§LifecycleBeforeAfterScripts

§before

array | null

§after

array | null

§HttpConfig

§routes

array<HttpRoute> | null

routes for request handling

§redirects

(any of) Redirects | null

configuration of internal redirects

§proxies

array<ProxyConfig> | null

configuration of proxied services

§middlewares

array<MiddlewareConfig> | null

list of middleware configurations that can be applied to templates, assets, functions and proxies

§default_route_config

(any of) HttpRouteConfig | null

default route config that all can extend from

§HttpRoute

§function

string

Name of the function that will handle incoming requests.

§path

string

Path for the HTTP route (must start with leading “/”).

§method

HttpMethod

HTTP method for this route.

§config

(any of) HttpRouteConfig | null

§middlewares

array | null

§HttpMethod

(one of)

(enum) PUT | POST | PATCH | QUERY | GET | DELETE

object

§Other

string

§HttpRouteConfig

§csp

(any of) HttpCsp | null

HTTP Content Security Policy configuration.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CSP

“Base” defaults to default-src 'self'; and tacks on SHA-256 integrity hashes for all inlined scripts and styles (generated at build time) to script-src 'self' sha256-b64 and style-src 'self' sha256-b64, respectively.

https: is used when not running in --insecure mode.

§cors

(any of) HttpCors | null

§cache

(any of) HttpCache | null

§timeout

integer | null

Default request timeout.

Unit (seconds).

§HttpCsp

§default_src

string | null

defaults to 'self' (default-src does not need to be included)

§script_src

string | null

defaults to unset unless inline hashes are included, in which case the directive will start with 'self' (script-src does not need to be included).

§style_src

string | null

defaults to unset unless inline hashes are included, in which case the directive will start with 'self' (style-src does not need to be included).

§font_src

string | null

defaults to unset.

(font-src does not need to be included).

§img_src

string | null

defaults to unset.

(img-src does not need to be included).

§frame_src

string | null

defaults to unset.

(frame-src does not need to be included).

§include_inline_hashes

boolean | null

defaults to true.

§HttpCors

§allow_credentials

boolean | null

§allow_headers

(any of) HttpCorsAllowHeaders | null

§max_age

integer | null

unit: Seconds

§allow_methods

(any of) HttpCorsAllowMethods | null

§allow_origin

(any of) HttpCorsAllowOrigin | null

§expose_headers

(any of) HttpCorsExposeHeaders | null

§allow_private_network

boolean | null

§HttpCorsAllowHeaders

(one of)

(enum) Any

object

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers

§Headers

array

§HttpCorsAllowMethods

(one of)

(enum) Any

object

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods

§Methods

array

§HttpCorsAllowOrigin

(one of)

(enum) Any

object

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin

§Origins

array

§HttpCorsExposeHeaders

(one of)

(enum) Any

object

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

§Headers

array

§HttpCache

§cache_control

(any of) HttpCacheControl | null

§expires

integer | null

Corresponds to the HTTP Expires header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expires

Unit: seconds.

§stored

(any of) StoredCache | null

§etag

(any of) HttpEtag | null

§HttpCacheControl

HTTP Cache-Control. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control

§max_age

integer | null

§s_maxage

integer | null

§no_cache

boolean | null

§no_store

boolean | null

§no_transform

boolean | null

§must_revalidate

boolean | null

§proxy_revalidate

boolean | null

§private

boolean | null

§public

boolean | null

§immutable

boolean | null

§stale_while_revalidate

integer | null

§stale_if_error

integer | null

§StoredCache

Render caching policy.

IMPORTANT: Very experimental, may not work as described. policy: Permanent is currently the most likely to behave correctly.

§policy

StoredCachePolicy

§compression

(any of) CompressionAlgorithms | null

Which compression results should be stored.

if empty or not provided, only Uncompressed is cached.

§content_types

array | null

Which data formats should be stored

If none is supplied, defaults are text/html and application/json

§key_on

(any of) KeyOn | null

§max_size

integer | null

Upper limit on the cumulative size of all cached responses for a given resource.

Unit: bytes

§max_count

integer | null

Upper limit on the number of cached responses stored at a given time, for a given resource.

§evict_on_dependency_change

boolean | null

Whether a cached item should also track the of models and content which it depends on, and evict when they are modified.

§StoredCachePolicy

(one of)

No eviction on clean or write. Constrained only by overall storage limit or max_size (if set). Will only be evicted if dependencies change and evict_on_dependency_change is set.

Permanent (string)

uses the quick_cache library

QuickCache (string)

§CompressionAlgorithms

array<CompressionAlgorithm>

§CompressionAlgorithm

(one of)

(enum) Uncompressed | Gzip | Brotli | Deflate | All

object

§Zstd

object

§level

integer

Compression algorithms

§KeyOn

§path_params

array | null

which params from the path to key on.

i.e /some/path/{key_on_me} OR /some/path/{*key_on_me} would use { "path_params": ["key_on_me"] }

§query_keys

array | null

which keys from the query to key on.

i.e ?some=123 { "query_keys": ["some"] }

§body_hash

boolean | null

whether to key on a hash of the incoming request body.

§etag

boolean | null

whether to check/store the ETag before everything else.

defaults to true if not passed.

§HttpEtag

HTTP Cache-Control. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control

§alg

(any of) HttpEtagAlgorithm | null

§HttpEtagAlgorithm

(one of)

(enum) AHash | Rustc | Blake3 | Foldhash

object

§XXH3

XXH3Variation

Hashing algorithm options for generating etags.

AHash is the default if none is selected.

§XXH3Variation

string

(enum) Bit64 | Bit128

§Redirects

§host

array<HostRedirect> | null

host redirects

§route

array<RouteRedirect> | null

route redirects

§HostRedirect

§from

string

from host name

§to

string

to host name

§method

RedirectMethod

redirect method

§RedirectMethod

(one of)

307 https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307

Temporary (string)

308 https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308

Permanent (string)

§RouteRedirect

§condition

string

axum route pattern

§rule

array

translation regexes map to Regex::replace_all where rule.0 is body of Regex::new() and rule.1 is second param of re.replace_all().

§method

RedirectMethod

redirect method

§ProxyConfig

proxy configuration.

Note: path should not be set at the same time as either domain or port. path takes precedence and the other sources will be ignored.

if the path, domain and port are all unset, validation will fail.

§path

string | null

an axum route with a *path wildcard that will be appended to the target.

i.e. "/some/path/{*path}"

Note: MUST end in a trailing /{*path}

§domain

string | null

custom domain with an ALIAS/CNAME pointing at the primary OrdinaryConfig::domain and a TXT record indicating ownership (i.e. ordinary-proxy=your.config.domain).

i.e example.com

Note: if a path is specified, the domain will be ignored

§port

integer | null

preferred port that the proxy will listen on in a --dedicated-ports configured multi-tenant server OR a standalone app instance.

i.e 8081

Note: if a path is specified, the port will be ignored, and port will not be tried without domain being present.

§target

string

url for resource to proxy.

i.e. https://example.com

§middlewares

array | null

list of names of middleware to include for this proxy

§MiddlewareConfig

configuration structure for HTTP middleware

§name

string

name by which this middleware will be referenced on other resources

§operation

MiddlewareOperation

the operation the middleware will perform

§mechanism

MiddlewareMechanism

how the middleware operation will be performed

§MiddlewareOperation

(one of)

object

§Validate

object

§rule

MiddlewareValidationRule

§components

array<MiddlewareValidationComponent>

§MiddlewareValidationRule

(one of)

object

if any of the rules included pass it is valid.

§Any

array<MiddlewareValidationRule>

object

only if all the rules pass is it valid.

§All

array<MiddlewareValidationRule>

object

if the rule is not true then it is valid.

§Not

MiddlewareValidationRule

object

status code that will allow the request to proceed.

§StatusCode

integer

§MiddlewareValidationComponent

(one of)

pass headers through to the validator

Headers (string)

append the path to the endpoint’s path

Path (string)

append query string params from the request

Query (string)

§MiddlewareMechanism

(one of)

object

§Request

object

§endpoint

string

§RuntimeMode

(one of)

Application will run on the shared multithreaded tokio runtime.

Shared (string)

Application will run on a separate thread with its own single-threaded tokio runtime.

SingleThreaded (string)

Application will run on a separate thread with its own multithreaded tokio runtime.

MultiThreaded (string)

§LoggingConfig

§client

(any of) ClientLoggingConfig | null

§server

(any of) ServerLoggingConfig | null

§ClientLoggingConfig

§min_delay

integer | null

bottom end of the delayed delivery range (seconds)

§max_delay

integer | null

top end of delayed delivery range (seconds)

§max_buffer

integer | null

max number of events to be buffered on the client prior to flush.

§max_batch

integer | null

sets the max number of events in a given request.

§ServerLoggingConfig

§ips

boolean | null

§headers

boolean | null

§credentials

(any of) RedactedHashAlg | null

§timing

boolean | null

§sizes

boolean | null

§RedactedHashAlg

string

(enum) Blake2 | Blake3

§ErrorConfig

§asset

string | null

Refers to the asset by path.

Returns as the fallback when a route is missing.

§AuthConfig

Auth configuration.

§password

PasswordConfig

Configuration for passwords.

§mfa

MfaConfig

MFA configuration for auth.

§refresh_token

RefreshTokenConfig

Configuration for refresh tokens.

§access_token

AccessTokenConfig

Configuration for access tokens.

§cookies_enabled

boolean

Determines whether cookies should be used for browser based template navigation, and form submissions

Note: when set to false, protected templates, and functions triggered by form submission will fail. Form based registration and login will necessarily be disabled, also.

!! Important: when set to true, tokens retrieved for js and noscript flavors !! do not support client signatures, because http-only cookies cannot be signed by !! the client.

§client_hash

ClientPasswordHash

what algorithm is used to hash passwords and MFA codes

§registration

(any of) RegistrationConfig | null

§invite

(any of) InviteConfig | null

invite config

§PasswordConfig

Configuration for passwords.

§protocol

PasswordProtocol

§PasswordProtocol

(one of)

When WASM is enabled, this will run the client portions browser-side. When JavaScript-only, passwords will be hashed and then sent to the server where the client portion will be done on behalf of the user. In noscript mode, the password is sent only protected by TLS, hashed and then the client operations are done server side.

If a user later decides to enable JavaScript or WASM, they’ll be able to opt in to the no-plain-password-sent modes without interruption.

Opaque (string)

Configuration for password protocol.

§MfaConfig

§totp

TotpConfig

§TotpConfig

§template

string | null

Used for response after registration form is submitted. Will just return a QR code SVG if not set.

§algorithm

TotpAlgorithm

§TotpAlgorithm

(one of)

only allowing SHA1 for now because many of the major MFA authenticator apps don’t support SHA256 or SHA512, and fail silently.

Sha1 (string)

§RefreshTokenConfig

Configuration for refresh tokens.

§algorithm

TokenAlgorithm

Algorithm used for verifying the token.

§lifetime

integer

How long a token should be valid for (seconds).

§rotation

integer

how frequently the key should be rotated

§TokenAlgorithm

string

(enum) HmacBlake2b256

§AccessTokenConfig

Configuration for access tokens.

§algorithm

TokenAlgorithm

Algorithm used for verifying the token.

§lifetime

integer

How long a token should be valid for (seconds).

§rotation

integer

how frequently the key should be rotated

§claims

array<Field>

Token claims structuring.

Note: idx starts at 1 to create space for system claims (id, domain, and account).

§Field

Fields are used to describe properties on a model, IO for functions/integrations and content definitions.

§idx

integer

The index used for compact, vector based serialization. The index is preserved even if the property name changes. Each field must be assigned an index value from 0-255, with no gaps (i.e. cannot go from 2 to 4 without also having a field with an index of 3).

§name

string

this is the name that is used when accessing a property in a template and will be the name that is used in the JSON serialized format.

§kind

Kind

the “kind” represents the type of the value that will be stored or sent.

§indexed

boolean | null

Used for models and content definitions. Determines whether you can access an object/item by this property. All items have are automatically stored ID that can be used for look up if no properties are indexed.

Note: indexed fields also have a uniqueness constraint.

!! Important: only String, Uuid and Url kinds can be indexed

§queryable

boolean | null

Specifies whether field can be queried via Gte/Gt, Lte/Lt, Eq and BeginsWith.

!! Important: only Bool, String, Url, Uuid, Timestamp, U8/16/32/64, I8/16/32/64, !! and F32/64 kinds can be made queryable.

§mapping

string | null

Used for integrations, so that a property on the external resource’s response can be renamed.

§doc

string | null

Optional message to hint to the user in an editor.

§compressed

boolean | null

Compresses the value of the field using the Zstd compression algorithm (level 4).

Note: at some point in the future, compression levels and compression algorithm selection will be configurable.

§encrypted

boolean | null

Encrypts the field using XChaCha20Poly1305.

Note: The storage encryption key is stored on the same server as the data it’s encrypting; anyone with full access to the server. This is mostly useful for protecting sensitive data in backups (assuming the key isn’t stored with the backup), and can potentially limit exposure in partial-access context stemming from a misconfiguration or a mistake in a multi-tenant scenario (i.e. for whatever reason tenant A’s database contents is moved to tenant B’s directory, without the keys also being shifted over).

!! Important: this is not currently intended for storing any meaningfully !! sensitive data (e.g. SSNs, credit card numbers, passwords, encryption keys, etc.) !! use (or don’t) at your own risk.

§Kind

(one of)

object

In the case of one-to-many the deletion of the parent reference causes a cascading delete (i.e if you have a user, chat, message relationship structure, deletion of the user or the chat automatically deletes messages owned by either).

References must always be bidirectionally defined.

§Ref

object

§model

string

name of model you’re referencing.

§field

string

name of the field on the model.

§many

boolean | null

whether you have many of the referenced model.

null/void/undefined/None

Void (string)

boolean/true/false

Bool (string)

integers between

I8 (string)

integers between

U8 (string)

integers between

I16 (string)

integers between

U16 (string)

integers between

I32 (string)

integers between

U32 (string)

integers between

I64 (string)

integers between

U64 (string)

floats between

F32 (string)

floats between

F64 (string)

universal unique identifiers. 16 bytes or 36 characters.

Uuid (string)

must be a valid URL

Url (string)

object

unix timestamp

§Timestamp

object

§unit

TimeUnit

§fmt

string | null

array of bytes.

Blob (string)

text/string/characters.

String (string)

JSON formatted string.

Json (string)

Markdown formatted string

Markdown (string)

object

array of values.

§List

object

§kind

Kind

the type for the values stored in the list.

object

Select from a list of options. Stored as its u8 index value.

§Enum

object

§name

string

§opts

array<EnumOpt>

object

complex kind with its own name and subfields.

§Object

object

§name

string

the object definition’s name.

§fields

array<Field>

nested subfields.

Defines the types recognized by this framework.

§TimeUnit

string

(enum) Seconds

§EnumOpt

§idx

integer

§name

string

§ClientPasswordHash

(one of)

Limited by what browsers can support, SHA-256 is a good option for a client-side hash to enable slightly better password protection when in javascript-only mode, without the WASM for Opaque.

Sha256 (string)

Configuration for client password hashing.

When JavaScript or WASM modes are enabled, passwords are hashed with the application name, and account, before transit (or in the case of WASM prior to the Opaque client operations if Opaque is selected for the PasswordProtocol).

§RegistrationConfig

§function

string | null

function used to handle registration side effects like application user creation or setting of claims.

the render() method of the selected function is called and its result is returned for the form registration.

functions must accept:

{
    "input": {
        "Object": {
            "name": "input",
            "fields": [
                {
                    "name": "account",
                    "idx": 0,
                    "kind": "String"
                },
                {
                    "name": "qr_code",
                    "idx": 1,
                    "kind": "String"
                },
                {
                    "name": "recovery_codes",
                    "idx": 2,
                    "kind": { "List": { "kind": "String" } }
                },
            ]
        }
    }
}

§InviteConfig

§mode

InviteMode

§lifetime

integer

How long a token is valid for.

Defaults to 7 days.

§clean_interval

array

On what interval to clean up expired token ids.

Defaults to 30 - 90 seconds.

§claims

array<Field> | null

Values that can be used internally in the API server to set default permissions for new accounts.

TODO: in the future, these can also be set in order to pre-validate TODO: or constrain app account registrations. This will require the TODO: use of an InviteCreate function trigger (for validating and setting TODO: the invite token claims), and a pre-registration InviteValidate, TODO: as well as passing the invite token claims to the Registration trigger TODO: (allowing for the validated invite claims to be used in the account TODO: claims setting operation).

Note: idx starts at 1 to create space for default account string claim at 0.

§InviteMode

(one of)

only the root user can invite

Root (string)

only a site admin can invite

Admin (string)

anyone who has been invited can invite anyone else

Viral (string)

§Secret

Mechanism for leveraging secrets.

§name

string

Name of the secret.

§source

SecretSource

Where to retrieve the secret from.

§visibility

SecretVisibility

Where the secret is to be used.

§SecretSource

(one of)

Name of the host provided environment variable/secret.

Env secrets are available to every tenant for a given API server (when running in “multi” mode).

This is useful in scenarios where a provider running the API server would like to expose convenient integrations with 3rd parties, for which it only wants to maintain a single set of credentials.

Env secrets are also useful when you’re running a standalone application and do not need a more complicated secrets management paradigm.

Env (string)

Name of a stored secret.

Stored secrets are application scoped, and can be set through an API server on which the application runs.

Stored secrets live in their own database and are only accessible to components with permissions.

Stored (string)

Where Ordinary will look for the secret.

§SecretVisibility

string

(enum) Extensions

Where the secret is accessible from.

§DatabaseConfig

§models

array<DatabaseModelConfig>

model definitions for the app database

§seeds_path

string | null

path to JSON formatted seeds file

§DatabaseModelConfig

Defines a model in the Ordinary Database.

§idx

integer

Index of the model. Used for its kind for storage keys. There can be no gaps in index values.

Note: the first (0) index is always skipped as it is reserved for the item UUID.

§name

string

Name of the model.

§fields

array<Field>

Fields on the model.

§uuid

(any of) UuidVersion | null

Every model is generated with a UUID key. If this value is blank, it will default to V4. If you’d like records to be ordered by time, V7 is recommended.

§UuidVersion

string

(enum) V4 | V7

§FunctionConfig

Configuration parameters for Ordinary Functions.

§ffi

(any of) FunctionFfi | null

Foreign function interface config

§ref

string | null

Refers to the template config in another location

§name

string | null

Function name. Must be unique.

§readonly

boolean | null

§bindgen

(any of) Bindgen | null

which language the input binding WebAssembly Component should be compiled from.

Note: because the bindings are compiled to a WebAssembly Component, with a companion WIT file, the resulting bindings can be used by any language that has WIT support.

i.e. bindings compiled from Rust can be plugged into a Golang WebAssembly component.

Important: if your FFI serialization format is JSON, or you are comfortable writing your own FlexBuffer vector accessors it is not necessary to generate the bindings (other than for reference in the FlexBuffer vector accessing case).

§toolchain

(any of) FunctionToolchain | null

language for which the function builds

§build

array | null

build scripts for ensuring the WebAssembly components are composed properly at build time.

§bin

string | null

path to the WASM component binary

§protected

boolean | null

What to check the token fields against. If unset function is public.

§access

array<FunctionAccessPermission> | null

Which Ordinary Application resources and host extensions this function has access to.

§input

(any of) Kind | null

Input definition for the action.

§output

(any of) Kind | null

Output definition for the action.

§cache

(any of) StoredCache | null

Persistent result cache configuration for readonly functions.

§variables

array | null

List of build time environment variables.

format in template: {{ YOUR_VAR }}

§timeout

integer | null

Max duration for the action.

Unit: seconds

§FunctionFfi

§version

FunctionFfiVersion

§serialization

FunctionFfiSerialization

§FunctionFfiVersion

string

(enum) V1

§FunctionFfiSerialization

string

(enum) FlexBufferVector | Json

Input/output serialization for module and host functions.

§Bindgen

string

(enum) v1-rust

§FunctionToolchain

(one of)

Function is written in the Rust programming language.

Templates using Askama.

rust (string)

Function is written in the C programming language.

c (string)

Function is written in JavaScript.

js (string)

Function is written in TypeScript.

ts (string)

Function is written in the Go programming language.

Templates using Go templates.

go (string)

The language toolchain the function is built with.

§FunctionAccessPermission

(one of)

object

Provides the function access to a given model.

§Database

object

§model

string

Name of the model.

§ops

array<FunctionAccessDatabaseOps>

List of allowed operations that the function can take on the model.

object

Provides the function access to Ordinary Auth.

§Auth

object

§ops

array<FunctionAccessAuthOps>

Which operations the function is allowed to take.

object

provides functions access to Ordinary Extensions that its parent app has access to.

§Extension

object

§name

string

name of the extension the function has access to

§ops

array

names of the ops that the function has access to

Defines access permissions that an Ordinary Function can configure.

§FunctionAccessDatabaseOps

(one of)

Can create an item for this model.

Insert (string)

Can get an item for this model by UUID or Index.

Get (string)

Can query an item for this model by queryable field.

Query (string)

Can update an item for this model.

Update (string)

Can delete an item for this model.

Delete (string)

Model operations that an function is allowed to make.

§FunctionAccessAuthOps

(one of)

Allows the function the ability to set a user’s access token fields/claims.

SetClaims (string)

Auth operations that a function can make.

§AssetsConfig

§dir_path

string | null

Relative path to assets directory.

§base_route

string

Note: must start with a / and cannot end with a / unless / is the entire route.

§append_index_html

boolean | null

whether to add index.html to the base route and the end of routes having a trailing slash or missing an extension.

i.e. https://example.com/static, https://example.com/static/, https://example.com/static/{*path}/ and https://example.com/static/{*path} (with no extension) would return the contents of /static/index.html or /static/{*path}/index.html.

primarily useful when serving a generated static site.

Note: cannot be used with append_index_ext

§skip_base_route_index_html

boolean | null

whether the {base_route} and {base_route}/ routes should skip returning the index.html at the root of the static dir.

useful when the static dir base_route is set to / but you’d like to have a template use the / route.

§append_html_ext

boolean | null

whether to append .html to routes that do not include an extension.

i.e. https://example.com/static/about would return the contents of /static/about.html.

primarily useful when serving a generated static site.

Note: cannot be used with append_index_html

§preserve_exif

boolean | null

will not strip the exif data from images.

Important: only use if you want all metadata (including location data) on your photos.

§html_csp

(any of) HttpCsp | null

content security policy for HTML assets

§http

(any of) HttpCache | null

HTTP cache configuration.

TODO: provide a way to pattern match files for which to apply TODO: specific cache controls.

§precompression

(any of) CompressionAlgorithms | null

Which encodings to use when precompressing assets.

Serving priority is dictated by specified order.

§minify_css

boolean | null

Determines whether CSS files should be minified, prior to write.

§minify_js

boolean | null

Determines whether JS files should be minified, prior to write.

§minify_html

boolean | null

Determines whether HTML files should be minified, prior to write.

§middlewares

array | null

list of names of middleware to include for the assets


This document was generated automatically for structs defined in the ordinary-config crate.

§ordinaryd.json Reference

§OrdinaryHostConfig

Config definition for an Ordinary API Instance

§domain

string

§contacts

array

§public_dns_ip

array | null

§env_name

string

§limits

OrdinaryHostLimits

§proxied_metrics

array<ProxiedMetric>

§console

boolean

whether to serve the web console

string

link to the location where you are able to obtain an invite token

§extensions

array<OrdinaryHostExtensionConfig>

configuration for extensions

§OrdinaryHostLimits

§app_domains

array

§privileged_domains

array

§proxy

ProxyLimits

§middleware

MiddlewareLimits

§function

FunctionLimits

§auth

AuthLimits

§monitor

MonitorLimits

§storage

StorageLimits

§ProxyLimits

§count

integer

max number of proxies per application.

§disallowed_targets

array

a list of any internal or external target regexes that should be disallowed.

§MiddlewareLimits

§count

integer

max number of proxies per application.

§disallowed_endpoints

array

a list of any internal or external target regexes that should be disallowed.

§FunctionLimits

§count

integer

Max number of functions per app.

§max_timeout

integer

Function request timeout.

Unit: seconds.

§AuthLimits

object

§MonitorLimits

object

§StorageLimits

§max_storage

integer

Maximum total storage for all apps and api.

Unit: bytes.

Default: 10 GB

§max_app_storage

integer

Maximum per-app storage.

Unit: bytes.

Default: 50 MB

§assets

AssetsLimits

§artifact

ArtifactLimits

§cache

CacheLimits

§database

DatabaseLimits

§secrets

SecretsLimits

§AssetsLimits

§allowed_extensions

array

Allowed extensions corresponding to MIME types.

(More to be supported in the future)

Supported:

  • “txt”
  • “xml”
  • “html”
  • “css”
  • “css.map”
  • “csv”
  • “js”
  • “png”
  • “apng”
  • “gif”
  • “svg”
  • “jpg”
  • “jpeg”
  • “bmp”
  • “tif”
  • “tiff”
  • “webp”
  • “avif”
  • “ico”
  • “pdf”
  • “json”
  • “wasm”

Special:

  • “none” (for no extension; uses “application/octet-stream”)
  • “any” (for unsupported extensions; also uses “application/octet-stream”)

§max_store_size

integer

Limit on total storage for all assets within an app (bytes).

§max_asset_size

integer

Limit on individual asset size (bytes).

§ArtifactLimits

§max_store_size

integer

§max_artifact_size

integer

§CacheLimits

§max_size_range

array

§max_count_range

array

§DatabaseLimits

§max_model_definitions

integer

§max_model_fields

integer

§max_item_size

integer

§max_field_size

integer

§SecretsLimits

§max_count

integer

§max_size

integer

§ProxiedMetric

§name

string

§endpoint

string

§OrdinaryHostExtensionConfig

§name

string

§operations

object

§ExtensionOperationConfig

§idx

integer

§input

Kind

§output

Kind

§Kind

(one of)

object

In the case of one-to-many the deletion of the parent reference causes a cascading delete (i.e if you have a user, chat, message relationship structure, deletion of the user or the chat automatically deletes messages owned by either).

References must always be bidirectionally defined.

§Ref

object

§model

string

name of model you’re referencing.

§field

string

name of the field on the model.

§many

boolean | null

whether you have many of the referenced model.

null/void/undefined/None

Void (string)

boolean/true/false

Bool (string)

integers between

I8 (string)

integers between

U8 (string)

integers between

I16 (string)

integers between

U16 (string)

integers between

I32 (string)

integers between

U32 (string)

integers between

I64 (string)

integers between

U64 (string)

floats between

F32 (string)

floats between

F64 (string)

universal unique identifiers. 16 bytes or 36 characters.

Uuid (string)

must be a valid URL

Url (string)

object

unix timestamp

§Timestamp

object

§unit

TimeUnit

§fmt

string | null

array of bytes.

Blob (string)

text/string/characters.

String (string)

JSON formatted string.

Json (string)

Markdown formatted string

Markdown (string)

object

array of values.

§List

object

§kind

Kind

the type for the values stored in the list.

object

Select from a list of options. Stored as its u8 index value.

§Enum

object

§name

string

§opts

array<EnumOpt>

object

complex kind with its own name and subfields.

§Object

object

§name

string

the object definition’s name.

§fields

array<Field>

nested subfields.

Defines the types recognized by this framework.

§TimeUnit

string

(enum) Seconds

§EnumOpt

§idx

integer

§name

string

§Field

Fields are used to describe properties on a model, IO for functions/integrations and content definitions.

§idx

integer

The index used for compact, vector based serialization. The index is preserved even if the property name changes. Each field must be assigned an index value from 0-255, with no gaps (i.e. cannot go from 2 to 4 without also having a field with an index of 3).

§name

string

this is the name that is used when accessing a property in a template and will be the name that is used in the JSON serialized format.

§kind

Kind

the “kind” represents the type of the value that will be stored or sent.

§indexed

boolean | null

Used for models and content definitions. Determines whether you can access an object/item by this property. All items have are automatically stored ID that can be used for look up if no properties are indexed.

Note: indexed fields also have a uniqueness constraint.

!! Important: only String, Uuid and Url kinds can be indexed

§queryable

boolean | null

Specifies whether field can be queried via Gte/Gt, Lte/Lt, Eq and BeginsWith.

!! Important: only Bool, String, Url, Uuid, Timestamp, U8/16/32/64, I8/16/32/64, !! and F32/64 kinds can be made queryable.

§mapping

string | null

Used for integrations, so that a property on the external resource’s response can be renamed.

§doc

string | null

Optional message to hint to the user in an editor.

§compressed

boolean | null

Compresses the value of the field using the Zstd compression algorithm (level 4).

Note: at some point in the future, compression levels and compression algorithm selection will be configurable.

§encrypted

boolean | null

Encrypts the field using XChaCha20Poly1305.

Note: The storage encryption key is stored on the same server as the data it’s encrypting; anyone with full access to the server. This is mostly useful for protecting sensitive data in backups (assuming the key isn’t stored with the backup), and can potentially limit exposure in partial-access context stemming from a misconfiguration or a mistake in a multi-tenant scenario (i.e. for whatever reason tenant A’s database contents is moved to tenant B’s directory, without the keys also being shifted over).

!! Important: this is not currently intended for storing any meaningfully !! sensitive data (e.g. SSNs, credit card numbers, passwords, encryption keys, etc.) !! use (or don’t) at your own risk.


This document was generated automatically for structs defined in the ordinary-config crate.

Re-exports§

pub use schemars;docs
pub use auth::*;
pub use crate::host::*;

Modules§

artifact
assets
auth
cache
extensions
function
jsonschemadocs
limits
middleware
model
monitor
proxy
secrets
storage

Structs§

ArtifactLimits
AssetsConfig
AssetsLimits
AuthLimits
CacheLimits
ClientLoggingConfig
CompressionAlgorithms
DatabaseConfig
DatabaseLimits
DatabaseModelConfig
Defines a model in the Ordinary Database.
ErrorConfig
FunctionConfig
Configuration parameters for Ordinary Functions.
FunctionFfi
FunctionLimits
HostRedirect
HttpCache
HttpCacheControl
HTTP Cache-Control. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control
HttpConfig
HttpCors
HttpCsp
HttpEtag
HTTP Cache-Control. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Cache-Control
HttpRoute
HttpRouteConfig
KeyOn
LifecycleBeforeAfterScripts
LoggingConfig
MiddlewareConfig
configuration structure for HTTP middleware
MiddlewareLimits
MonitorLimits
OrdinaryConfig
Config definition for an Ordinary Application
OrdinaryHostConfig
Config definition for an Ordinary API Instance
OrdinaryHostExtensionConfig
OrdinaryHostLimits
ProxiedMetric
ProxyConfig
proxy configuration.
ProxyLimits
Redirects
RouteRedirect
Secret
Mechanism for leveraging secrets.
SecretsLimits
ServerLoggingConfig
StorageLimits
StoredCache
Render caching policy.
TopLevelLifecycle

Enums§

Bindgen
CompressionAlgorithm
Compression algorithms
FunctionAccessAuthOps
Auth operations that a function can make.
FunctionAccessDatabaseOps
Model operations that an function is allowed to make.
FunctionAccessPermission
Defines access permissions that an Ordinary Function can configure.
FunctionFfiSerialization
Input/output serialization for module and host functions.
FunctionFfiVersion
FunctionToolchain
The language toolchain the function is built with.
HttpCorsAllowHeaders
HttpCorsAllowMethods
HttpCorsAllowOrigin
HttpCorsExposeHeaders
HttpEtagAlgorithm
Hashing algorithm options for generating etags.
HttpMethod
MiddlewareMechanism
MiddlewareOperation
MiddlewareValidationComponent
MiddlewareValidationRule
RedactedHashAlg
RedirectMethod
RuntimeMode
SecretSource
Where Ordinary will look for the secret.
SecretVisibility
Where the secret is accessible from.
StoredCachePolicy
UuidVersion
XXH3Variation

Statics§

DOMAIN_REGEX

Functions§

check_config_against_limits
exec_script