Module templates
Part of StrataForge
opensearch and stream templates ship with the StrataForge release that is in release-candidate testing.strataforge new module <id> --template <name> scaffolds a working StrataBI module: manifest, pages, Lambda code with tests, OpenTofu that packages, deploys and registers it, an install schema, an llm_context.txt for agents, and a README. Every resource name derives from the module id, so the scaffold also deploys as a sandbox or a Facies without edits. The module contract is the one in Build a module.
Guildmaster starts from a template too, after it has looked at modules like the one you asked for. See Learning from modules you already have.
| Template | Builds |
|---|---|
app (default) | one tile Lambda that returns Markdown — the smallest module that follows the contract |
cache | a scheduled Lambda that runs Athena and keeps one Parquet file per dataset for instant tiles |
opensearch | named OpenSearch queries (aggregations, PPL, SQL, search) answered by a Lambda in milliseconds |
stream | a Kinesis proof of concept: producer and consumer Lambdas and a live React block |
Every template, straight after scaffolding:
strataforge validate . && python -m pytest -qpasses;- its Python passes PEP 8 / PEP 257 (
strataforge pycheck), with the ruff configuration inpyproject.toml; - its declared deploy permissions are scoped to the module's own resources and fit StrataCI's session-policy limit, also as a sandbox copy.
cache
strataforge new module fleet_cache --template cacheEach dataset in src/refresh/datasets.json is a SQL query. On a schedule (refresh_schedule, daily by default) and from the button on the module's page, the Lambda runs it through Athena UNLOAD and keeps the answer as one Parquet file in StrataBI's system bucket. Tiles read it with "exec": {"type": "cache", "cache_s3_uri": "s3://<system bucket>/cache/<module_id>/<dataset>/latest.parquet"}. The module's status tile shows each dataset's last refresh, rows and size.
opensearch
strataforge new module fleet_search --template opensearch| File | What it is |
|---|---|
src/search/queries.json | the queries the module may run: name, kind (dsl, ppl, sql), index, body with {{params}} |
src/search/handler.py | fills the parameters, signs the request (SigV4: es for a domain, aoss for Serverless), turns buckets, rows or hits into CSV |
terraform/opensearch.tf | query rights on your domain or collection, optional VPC placement |
Set opensearch_endpoint, opensearch_arn and opensearch_service at install. For OpenSearch Serverless, add the function's role (output search_role_arns) to the collection's data access policy; for a domain with fine-grained access control, map the role to an OpenSearch role. A tile names a query by its id (or inputs.query), and the page's controls fill the query's parameters — tiles never send query bodies. The scaffold's own page:
{"id": "events_by_hour", "triggered_by": ["service"],
"exec": {"type": "lambda", "module_id": "fleet_search", "lambda_index": 0, "result_kind": "dataframe",
"result_format": "csv", "result_name": "result.csv", "sync": true, "timeout_seconds": 30},
"block": {"type": "plotly", "config": {"figure": {"data": [
{"type": "bar", "x": "@hour", "y": "@doc_count", "name": "events"}]}}}}stream — Kinesis and React
strataforge new module live_orders --template stream
cd projects/live_orders/app && npm install && npm run build # later builds: npm ci"Send events" tile → produce → Kinesis (on-demand) → consume → live window → latest → React block (every 5 s)- produce puts synthetic events on an on-demand stream; consume (an event source mapping) folds each batch into 5-second buckets over the last 10 minutes; latest returns the window.
- The React block (React 18, bundled by esbuild, licenses included) shows totals, a bar per bucket and latency, refreshed by its tile every 5 seconds.
strataforge preview blocks/live_streamshows it on its own with example data. - Why the browser never calls Kinesis: an external block runs in a sandboxed frame with no network and no credentials. Its data arrives through its tile, so access stays governed by IAM and StrataBI's roles.
It is a proof of concept: for production volumes keep the stream and the Lambdas, and replace the live window with DynamoDB counters or a Managed Service for Apache Flink application.
Redshift
Redshift data comes from a ready-made module rather than a template: the Redshift Connector.
Shaleio