Run SLayer with a real Postgres database using Docker Compose.
cd examples/postgres
docker compose up -dThis starts:
- Postgres (port 5433) with sample e-commerce data
- SLayer API (port 5143) with auto-ingested models
# Health check
curl http://localhost:5143/health
# List models
curl http://localhost:5143/models
# Query: orders by status
curl -X POST http://localhost:5143/query \
-H "Content-Type: application/json" \
-d '{"model": "orders", "fields": [{"formula": "count"}], "dimensions": [{"name": "status"}]}'
# Query: orders by product category (rollup join)
curl -X POST http://localhost:5143/query \
-H "Content-Type: application/json" \
-d '{"model": "orders", "fields": [{"formula": "count"}], "dimensions": [{"name": "products__category"}]}'
# Query: orders by region (transitive rollup)
curl -X POST http://localhost:5143/query \
-H "Content-Type: application/json" \
-d '{"model": "orders", "fields": [{"formula": "count"}], "dimensions": [{"name": "regions__name"}]}'python verify.pyRuns assertions against the REST API to validate everything works.
You can also connect Claude Code to the Postgres instance directly:
claude mcp add slayer -- slayer mcp --models-dir ./slayer_datadocker compose down -v