DiscoveryServicesHow We WorkPlatformSolutionsInsightsDocsStart with the Map
Docs/Language/Examples

Examples

Four complete .pxy files that run on the proxyweb runtime as-is. Each pairs the source with the command to serve it. Read top to bottom, or copy one and start editing.

1 · A storefront

A multi-product store with a cart, a mock checkout, sign-in, and an account form — plus a commerce catalog and an OrderFlow machine that audits the order lifecycle.

shop.pxyProxyLang
site "Proxy Shop"

theme:
  direction: modern-minimal
  accent: slateblue
  radius: 12px

nav:
  link: Store | /store
  link: Account | /account

auth:
  login: /signin
  account: /account
  user: demo@proxy.dev | proxy123 | Demo Shopper

page Store:
  route:
    /store
  heading: Store
  grid catalog:
    product_card Tee:
      heading: Proxy Tee
      price: 28.00 USD
      button primary: Add to cart | /cart/add?sku=tee

page Checkout:
  route:
    /checkout
  heading: Checkout
  checkout:
    cart: current

commerce Shop:
  currency: USD
  product Tee:
    type: physical
    sku: tee
    name: Proxy Tee
    price: 28.00
    fulfillment: ship
  checkout:
    provider: mock
    success: /success
    cancel: /store

machine OrderFlow

states:
  created
  pending_payment
  paid
  fulfilled

when checkout_started:
  state = pending_payment
  audit checkout

when payment_succeeded:
  state = paid
  fulfill order
  audit transaction
terminalshell
cargo run -p proxyweb -- shop.pxy
#  /store → add items → /checkout → Pay (mock) → /success

2 · A SQL dashboard

KPI, bars, a multi-series line, and a table — all filled from SQLite per request with auto-scaled axes and no JavaScript. Charts bind {{query}}; the table reads the query named like its id.

sql-dashboard.pxyProxyLang
site "Sales Ops"
  queries:
    revenue: SELECT amount FROM sales ORDER BY id
    traffic: SELECT sessions, signups FROM traffic ORDER BY id
    orders: SELECT customer, amount, status FROM orders ORDER BY id

theme:
  direction: modern-minimal
  accent: #3b82f6

page Home:
  route:
    /
  section frame:
    layout: dashboard
    section content:
      heading: Saleslive from SQL
      card revenue:
        heading: Revenue by month
        bars r:
          values: {{revenue}}
          unit: $
      card traffic:
        heading: Traffic
        line t:
          legend: Sessions | Signups
          series: {{traffic.sessions}} | accent
          series: {{traffic.signups}} | coral
      card orders:
        heading: Recent orders
        table orders:
          head: loading
          row: loading
terminalshell
sqlite3 demo.db "CREATE TABLE sales(id INTEGER PRIMARY KEY, amount INTEGER);
  INSERT INTO sales(amount) VALUES (23000),(42000),(38000),(51000);"
PROXYWEB_DB=sqlite://demo.db cargo run -p proxyweb -- sql-dashboard.pxy

3 · A guestbook (database writes)

Governed CRUD in one file: a form writes a row through a pre-declared mutation, and the page reads it back. The form can only run the sign template with its :placeholders bound to the fields — never free-form SQL — and every write is appended to a tamper-evident audit chain.

guestbook.pxyProxyLang
site "Guestbook"
  schema:
    CREATE TABLE IF NOT EXISTS entries (
      id INTEGER PRIMARY KEY, name TEXT, message TEXT, created TEXT)
  mutations:
    sign: INSERT INTO entries (name, message, created)
          VALUES (:name, :message, datetime('now'))
  queries:
    recent: SELECT name, message FROM entries ORDER BY id DESC

page Home:
  route:
    /
  heading: Sign the guestbook
  form sign:
    field name: Your name
    textarea message: Your message
    submit: Sign
  divider
  heading: Recent
  table recent:
    head: loading
    row: loading
terminalshell
PROXYWEB_DB=sqlite://guestbook.db cargo run -p proxyweb -- guestbook.pxy

4 · A governed agent

An agent as governed orchestration: the model picks which declared action advances the goal, and the runtime runs it as an allowlisted mutation. The agent below can only ever add_lead — it cannot invent new writes.

crm-agent.pxyProxyLang
site "CRM"
  schema:
    CREATE TABLE IF NOT EXISTS leads (
      id INTEGER PRIMARY KEY, name TEXT, status TEXT, created TEXT)
  mutations:
    add_lead: INSERT INTO leads (name, status, created)
              VALUES (:name, :status, datetime('now'))
  queries:
    recent: SELECT name, status FROM leads ORDER BY id DESC

page Home:
  route:
    /
  heading: Leads
  table recent:
    head: loading
    row: loading

agent Sales
  goal: qualify the inbound lead and record it with a status
  model: qwen3.5-9b
  memory:
    crm
  actions:
    add_lead
terminalshell
PROXYWEB_DB=sqlite://crm.db PROXYWEB_LLM=lmstudio \
  cargo run -p proxyweb --features llm -- crm-agent.pxy
curl -X POST localhost:3200/agent/Sales   # run the loop, returns the transcript
Preview

These files run today on the preview runtime. Provider integrations (Stripe checkout via --features http, LLM via --features llm) need their own keys/config. See the reference for every block.

Related