BAQ Documentation

website·Indexed 32 days ago

https://baq.dev

Documentation for BAQ, featuring a protocol HTTP API for record and blob management, a JavaScript SDK, and a React SDK with hooks like useAuthentication and useRecordQuery. Includes guides on building apps, setting up data models, and connecting to a BAQ server.

Tokens
45.4K
Snippets
245
Records
360
Agent score
51%

What's inside BAQ

  1. Overview of the BAQ federated app platform

    BAQ is a federated app platform consisting of protocols and tools that enable developers to build connected applications without needing to manage significant backend infrastructure. The platform is designed to decouple data hosting from the application layer, allowing end users to choose who hosts their data and which apps they use to interact with that data.
  2. Overview of the BAQ federated app platform

    BAQ is a federated app platform designed to let developers build connected apps with minimal backend infrastructure while ensuring end users retain control over their data. It follows three core principles: keeping users in control of their data and trust, enabling developers to build local-first and cloud-synchronized apps using familiar technology, and allowing any data to be easily shared socially (privately or publicly).
  3. Overview of BAQ Schema format

    The BAQ Schema format is inspired by JSON Schema and JSON Type Definition. It is designed for strictness (no implicit behavior, no additional properties), schema evolution (programmatic comparison for backward compatibility), and automated code generation for TypeScript.
  4. Overview of the BAQ federated app platform

    BAQ is a federated app platform designed to let developers build connected apps with minimal backend infrastructure. It follows three core principles: keeping users in control of their data and trust settings, enabling developers to create local-first and cloud-synchronized apps using familiar technology, and allowing any data to be easily shared socially (privately or publicly).
  5. Overview of the BAQ Federated App Platform

    BAQ is a federated app platform that allows developers to build connected applications without writing server code or managing infrastructure. It features a flexible data format using BAQ schemas, built-in permission management (Private, Shared, or Public), and app interoperability for sharing data across different applications. The platform is built on standard DNS, HTTP, and JSON technologies and provides a powerful SDK for sending requests and managing application state.
  6. Understand the Entity Record structure

    The EntityRecord is a public record returned during the discovery process. It serves as the entrypoint to a user's BAQ data and is created by the user's server during initial sign-up. There can be only one Entity record per user. When a user moves to a new server, this record is updated and propagated across the network.
    {
      "entity": "maggie.baq.run",
      "previous_entities": [],
      "profile": {
        "name": "Maggie Blum"
      },
      "servers": []
    }
  7. Understand the benefits of using BAQ for app development

    BAQ allows developers to build connected apps without writing server-side code. Key benefits include:

    • User authentication without building a bespoke account system.
    • Storing arbitrary data on the user's server, accessible from any device.
    • Real-time data updates.
    • Data sharing via permission settings.
    • Interoperability between apps by reusing the same record types.
  8. Understand the anatomy of a BAQ record

    A record is the fundamental unit of data in the BAQ network. Each record contains a set of properties that dictate how servers handle the data. Key components include:

    • Identity: Defined by the author (a link to the user who created the record) and a unique id within that author's scope.
    • Type: Defined by a type property, which links to a Type record. This determines the record's schema. Users can use built-in types or create custom ones.
    • Permissions: The permissions object manages read/write access and propagation. Records are categorized as Private (author only), Shared (specific entities), or Public (everyone).
    • Version: Records are versioned. Every update creates a new immutable version identified by version.hash. New versions must link to their parent version.
    • Timestamps: Records track four distinct timestamps for sorting and auditing: created_at (author's creation time), received_at (server's receipt time), version.created_at (author's version creation time), and version.received_at (server's version receipt time).
  9. Use RecordLink to reference a record in the Baq JS SDK

    A RecordLink is used to reference a specific record. It consists of an entity (the target record's initial author) and a recordId (the unique identifier of the record within that entity's scope).
    const recordLink = {
      entity: "alice.baq.run",
      recordId: "012a494c14154f2c91e35f34e077e5be",
    };
  10. Understand the BAQ Record model

    BAQ is a federated database designed for immutable pieces of data called records. In BAQ, all platform components—including core features like types and subscriptions—are implemented as records. These records are exposed and accessible through a standard HTTP API.
  11. Choose a BAQ server for hosting data

    To use BAQ, you need a server to communicate with other servers and host data for your applications. You can choose a server based on pricing, geographical location, and policies. You can migrate to a different server at a later date if needed.
  12. Reference a blob using BlobLink

    The BlobLink class is used to reference a blob. It contains the SHA256 hash of the blob content, the MIME type for serving the blob, and the filename to be used when serving the blob. A single record can link to the same blob multiple times using different type and name attributes to change how the blob is served.
    const blobLink = {
      hash: "2c29c30097484dad91d5b4f1e4c4560c0b1ffdeda4c447e396fea6ce38004583",
      type: "image/jpeg",
      name: "thumbnail.jpg",
    };