Skip to main content

CLI for tiders-x402-server: run a payment-enabled database API server from a YAML config file.

Project description

tiders-x402-server (CLI)

Sell access to your data — install the server, point this server at a database, set a price, and anyone on the internet can pay small cryptocurrency amounts to query your data instantly, with no contracts, accounts, or billing setup.

Buyers submit SQL queries over HTTP and receive results as efficient Apache Arrow IPC streams. You control what data is exposed, which tables are available, and how much each query costs — per row returned or a flat fee to access a table. Buyers interact using familiar SQL, but Tiders enforces a safe subset — blocking expensive operations like JOINs and subqueries — so your database stays protected and costs stay predictable.

Payments are handled by the x402 protocol, an open standard for HTTP-native micropayments. When a server needs payment it returns a standard 402 Payment Required response; a client with x402 support signs it, and the transaction settles in under a second using stablecoins — no accounts, no checkout pages, no minimum spend.

Under the hood, Tiders is a Rust server that connects to different databases such as DuckDB, PostgreSQL, or ClickHouse. Buyers query using familiar SQL, but Tiders enforces a safe subset — blocking expensive operations like JOINs and subqueries — so your database stays protected and costs stay predictable.

Serving raw data from your database through a paid API is the server's core job. As an optional addition — because selling data is hard without showing buyers what they're getting — the same server application can scaffold and publish interactive dashboards: fully customizable visual reports you design and your buyers explore in a browser, with a convenience button that hits the server's x402-gated APIs to download the underlying data. The server works exactly the same with or without dashboards.

Think of the dashboard feature as a vending machine for data: buyers browse the dashboard to preview what's available, then pay per request to access the full dataset. You stay in full control — what data is freely visible in the dashboard, which tables the server exposes, and how much each query costs, whether that's per row returned or a flat fee to access a table.

Full documentation: https://yulesa.github.io/tiders-x402-server/

Installation

pip install tiders-x402-server
# or
cargo install tiders-x402-server

Quick Start

Tiders-x402-server assumes you already have a database populated with the data you want to sell. If you don't, the Tiders ingestion tool can help you stand one up and load it with crypto data — see Choosing a Database for guidance on picking a backend.

  1. Install the CLI:
pip install tiders-x402-server
  1. Create a tiders-x402-server.yaml:
server:
  bind_address: "0.0.0.0:4021"
  base_url: "http://localhost:4021"

facilitator:
  url: "https://facilitator.x402.rs"

database:
  duckdb:
    path: "./data/my_data.duckdb"

tables:
  - name: my_table
    description: "My dataset"
    price_tags:
      - type: per_row
        pay_to: "0xYourWalletAddress"
        token: usdc/base_sepolia
        amount_per_item: "0.002"
        is_default: true

dashboard: # Optional
  entries:
    - slug: my_dashboard
      title: "My Dashboard"
      description: "Description text for the dashboard"
      tags: ["Tag1", "Tag2"]
  1. Start the server:
tiders-x402-server start

The CLI auto-discovers YAML config files, supports ${VAR_NAME} environment variable expansion, and hot-reloads configuration on file changes.

  1. Optional - Create the dashboards:

You can create dashboards before or after starting the server. Scaffold dashboards defined in the YAML with the CLI command:

tiders-x402-server dashboard          # scaffold all entries
tiders-x402-server dashboard <slug>   # scaffold one

This copies a minimal Evidence project template into dashboards/<slug>/. From there, edit the files, mainly dashboards/<slug>/pages/index.md, to build your reports — the Evidence docs cover the full dashboard authoring workflow.

Note: Data visible in the dashboard can be scraped freely without payment. Only expose data you are comfortable sharing publicly, and leave anything sensitive behind the paid API instead.

Once the dashboard is ready, build it into a static site:

(cd dashboards/<slug> && npm install && npm run build)

The server will pick up and serve the built files automatically. Dashboards are static — they do not update live. Rebuild whenever the underlying data changes.

HTTP API

Endpoint Description
GET /api/ Server metadata: tables, schemas, payment requirements, SQL parser rules
GET /api/table/:name Full schema and payment offers for a table. Requires payment if the table has a MetadataPrice tag
GET /api/query?query=… Execute a SQL query (SQL in the query URL parameter). Returns 402 with payment options, or 200 with an Arrow IPC stream
GET /<slug>/ Static Evidence dashboard, one per dashboards: entry

Response formats:

  • 200 OKapplication/vnd.apache.arrow.stream
  • 402 Payment Required — JSON payment options; resend with X-Payment header
  • 400 Bad Request / 500 Internal Server Error — plain text error

Related packages

License

Licensed under either of Apache License 2.0 or MIT license at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tiders_x402_server-0.3.1-py3-none-win_amd64.whl (18.7 MB view details)

Uploaded Python 3Windows x86-64

tiders_x402_server-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (20.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

tiders_x402_server-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

tiders_x402_server-0.3.1-py3-none-macosx_11_0_arm64.whl (22.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

tiders_x402_server-0.3.1-py3-none-macosx_10_12_x86_64.whl (23.6 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file tiders_x402_server-0.3.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 90722406864732a3ef1d77b3af1e99dba3af52871a062371a3b0b232e6765c46
MD5 5fa8ea062e9f3846f0cfd4085df0e75f
BLAKE2b-256 03a713ba4960f63c82a59c282bf25560900424ab30bb48dd618313260a61ba49

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 42d59b491de63b9934852021f2f5d2416ce50a554e5b581eba04dee020f4c7b6
MD5 4abc6266d113d69ad674e974ea7e2f57
BLAKE2b-256 43a3665e1f6c048db26a58cbe6098f1913a5f146c478cb19cb67bdb4f513feab

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2342be1f20451a084def4b7cb7128df467c8f1509a6581be4167140e5d384976
MD5 3ce417f63075c86b55360037895dff82
BLAKE2b-256 9efaddcd6ad0c62964927de3623210028eb091593ff79bfbf321eae0d5b244a2

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a644303bf4b35fde21e6d900116dc2a729c9ab33a4a39a56247264e3b3d3566e
MD5 773261217d0875697abd668d678b56f1
BLAKE2b-256 6d78986e2b448a719a75463d32de8ff60cdf8c0ae9e67c31d19be0aba4563bef

See more details on using hashes here.

File details

Details for the file tiders_x402_server-0.3.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for tiders_x402_server-0.3.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ddeb4218ed0ddf7f6d3313112eb3d8625901762e474d6160878d3ce5896c1da4
MD5 b27ea7ae5ec256e97845ad465ba2fba4
BLAKE2b-256 bfa4e2b75483fd8ebd265cd67e3e953e157702c062e3a23eb42863ac209017f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page