← Documentation
Custom Platform
Generate OCP static files from any data source — a database, CSV, headless CMS, or custom API — using the OCP CLI or by writing the three files by hand.
Option A — CLI + JSON config
The fastest path: write an ocp.config.json pointing at your data source, run the CLI, and deploy the output.
1
Install the CLI
npm install -g @opencommerceprotocol/cli # or run without installing: npx @opencommerceprotocol/cli generate --help
2
Create ocp.config.json
ocp.config.json
{
"merchant": {
"name": "My Store",
"url": "https://mystore.com",
"currency": "USD"
},
"source": {
"type": "csv",
"path": "./products.csv",
"mapping": {
"id": "product_id",
"name": "title",
"price": "price_usd",
"url": "product_url",
"in_stock": "inventory_quantity > 0",
"category": "product_type"
}
},
"output": "./public"
}Supported source types: csv, json, jsonl, rest, graphql, postgres, mysql.
3
Generate the files
npx @opencommerceprotocol/cli generate ✓ Loaded 1,204 products from products.csv ✓ Wrote public/.well-known/ocp.json ✓ Wrote public/ocp.md ✓ Wrote public/ocp/products.jsonl (3 pages) Done in 2.1s
4
Deploy and validate
# Deploy public/ to your CDN / hosting, then: npx @opencommerceprotocol/cli validate https://mystore.com
Option B — Static files by hand
For small catalogs you can write the files directly. No tooling required.
.well-known/ocp.jsonCopy from the Quick Start and fill in your valuesocp.mdWrite a plain-text description of your store for AI agentsocp/products.jsonlOne product JSON object per line — see the feed specCI/CD integration
Run feed generation on a schedule so agents always see fresh data:
.github/workflows/ocp.yml
name: Rebuild OCP feed
on:
schedule:
- cron: '0 * * * *' # every hour
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: node generate-ocp.js
- name: Deploy to CDN
run: npx wrangler pages deploy public