Skip to content

crate

weft_data

Data integrations for Weft apps.

Every integration builds plain Requests and parses Responses, so it's the same code in the browser (weft::web::fetch), on a server route (weft_api::send) and in tests. Parsers return template Values — lists of records ready for for … in.

ModuleRuns inFor
supabasebrowserPostgres tables (PostgREST), RPC, auth, storage URLs
contentfulbrowserCMS entries with links resolved, rich text as Markdown
wordpressbrowserHeadless WordPress posts, pages and terms
googlebrowserSheets, YouTube, Calendar, Places, Maps, OAuth
mongodbbrowser → your routeCollections, through a policy-checked API route
halaxybrowser → your routePractitioners and availability (FHIR), secret kept server-side

Loading state for templates lives in Resource. source reads any src a component is given into a typed table: CSV, JSON, GraphQL, SDMX.

Modules

  • contentful

    Contentful: entries from the Content Delivery (or Preview) API, with linked entries and assets resolved and rich text turned into Markdown.

  • google

    Google APIs: Sheets, YouTube, Calendar, Places and Maps, with an API key (restrict it to your site's referrers in the Cloud console) or a user's OAuth access token (see oauth_url / parse_oauth_redirect).

  • halaxy

    Halaxy (practice management) through its FHIR R4 API. Credentials are a practice's API client id and secret, so requests go through a server route (generated by weft add halaxy) that holds the secret, caches the access token and only passes on reads of the resources you allow — by default directory and availability data, never patient records.

  • html

    Turning CMS HTML into Markdown (which templates render safely with markdown(source: …)) or plain text.

  • http

    Transport-independent HTTP: integrations build Requests and parse Responses; the browser (weft::web::fetch) or a server (weft_api::send) does the sending.

  • json

    JSON → template values.

  • mongodb

    MongoDB through your own API route. Atlas retired its HTTP Data API (September 2025), and a database password must never reach the browser, so the browser sends Commands to a server route (generated by weft add mongodb), which checks them against a Policy and runs them with the official driver.

  • relay

    Sources the browser isn't allowed to read.

  • source

    Tabular data from a src: where it comes from, how to ask for it, and how to read what comes back, from a CSV file to a statistics agency's API.

  • supabase

    Supabase: tables through PostgREST, RPC, email/password auth and public storage URLs. The anon key is meant for browsers; row-level security decides what it can see.

  • template

    Sending templates' requests: a load's data and the request commands (post, put…) in handlers. They go through the same loader as a chart's src (source::send): fetch in the browser, public/ files (or, with blocking, the network) during the build, a fake in tests.

  • wordpress

    Headless WordPress through the REST API (/wp-json/wp/v2): posts, pages, categories, tags and media. Content arrives as Markdown, ready for markdown(source: post.body).

Structs

  • Contentful

    A Contentful space, read through its Content Delivery API (or the Preview API).

  • Google

    Google's APIs (Sheets, YouTube, Calendar, Places, Maps), with an API key or an OAuth access token.

  • Halaxy

    Server-side client: builds authorised requests.

  • HalaxyProxy

    Browser side: requests to your Halaxy route.

  • Mongo

    The browser side: builds commands for your API route.

  • Request

    An HTTP request, ready to send.

  • Resource

    Loading state for templates: bind it with [Resource::bind] and fill it with weft::web::load (or [Resource::set]).

  • Response

    An HTTP response.

  • Supabase

    A Supabase project: its tables (through PostgREST), RPC, auth and storage.

  • WordPress

    A WordPress site, read through its REST API (/wp-json/wp/v2).

Enums

Functions

to_json

pub fn to_json(v: &Value) -> Value

Convert a template Value back into JSON.

to_value

pub fn to_value(j: &Value) -> Value

Convert JSON into a template Value: objects become records, arrays lists, numbers Num.