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.2-py3-none-win_amd64.whl (18.8 MB view details)

Uploaded Python 3Windows x86-64

tiders_x402_server-0.3.2-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.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (19.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

tiders_x402_server-0.3.2-py3-none-macosx_11_0_arm64.whl (22.2 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

tiders_x402_server-0.3.2-py3-none-macosx_10_12_x86_64.whl (23.7 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for tiders_x402_server-0.3.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 14c61834f2a33b53ee05b99bccdc9202830a3355d8b36b67b7bd170b0cdf8615
MD5 8e80ad3db41335abd3c56dd49eafe741
BLAKE2b-256 cc6821c5fb4813f0c5ab2d2658ddc7b74caa90b45310498f9cf0abee67279478

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiders_x402_server-0.3.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 767f4bb160cec31770c959f2230da161bc50839ed28d5f375e6eb5655ccbfcf6
MD5 75fca05fb9fccd3db97cc0f740637055
BLAKE2b-256 1cc867557f01eb7f2c5665cdedd4177add32837713fe3abaca912f889fc21b45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiders_x402_server-0.3.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b39df95e1c0d60783fd79def45b884f206d4623cc5469f6715035b3d091fefcd
MD5 4ca37c2291c3635b8632a6c647b34144
BLAKE2b-256 4e7624b5499baef86dbf79f17b19835db8966a03bd4ac53a525b60dc1b91604e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiders_x402_server-0.3.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b48e59c015576eda850d66decef5d2bf7adde89e9683393c430f061ea9ae202d
MD5 7ee4634095e1da0e487115356201c536
BLAKE2b-256 d608788d1343621189bb4f568b46994ef463c98ac715d6c0c79dcc9419134be7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tiders_x402_server-0.3.2-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9090b8bc0061e9cb415772f1093505ad94c011655543af6c2d787568b583815d
MD5 1d8ce9ef45a3394b52a9c0630c87b8be
BLAKE2b-256 edb2b1db616352e04e8e7e180bd9fa826dd438db5bf14d3cd72032e7da70f56f

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