Module templates

Part of StrataForge

Note
The 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.

TemplateBuilds
app (default)one tile Lambda that returns Markdown — the smallest module that follows the contract
cachea scheduled Lambda that runs Athena and keeps one Parquet file per dataset for instant tiles
opensearchnamed OpenSearch queries (aggregations, PPL, SQL, search) answered by a Lambda in milliseconds
streama Kinesis proof of concept: producer and consumer Lambdas and a live React block

Every template, straight after scaffolding:

cache

bash
strataforge new module fleet_cache --template cache

Each 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

bash
strataforge new module fleet_search --template opensearch
FileWhat it is
src/search/queries.jsonthe queries the module may run: name, kind (dsl, ppl, sql), index, body with {{params}}
src/search/handler.pyfills the parameters, signs the request (SigV4: es for a domain, aoss for Serverless), turns buckets, rows or hits into CSV
terraform/opensearch.tfquery 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:

json
{"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

bash
strataforge new module live_orders --template stream
cd projects/live_orders/app && npm install && npm run build    # later builds: npm ci
text
"Send events" tile → produce → Kinesis (on-demand) → consume → live window → latest → React block (every 5 s)

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.