Amazon QuickSight dashboards, analyses, datasets, themes and topics are nested JSON documents.
This repository is a library for authoring them as code: typed builders over the CloudFormation
AWS::QuickSight::* definition model, a calculated-field expression DSL with type inference,
DataPrep v2 and v3 step chains with an offline simulator, a rule engine that checks definitions
before deploy, and adapters that turn ORM metadata into dataset schemas.
The core is TypeScript compiled with jsii, so one API is available in TypeScript, Python, Java, .NET and Go. Validation is offline and schema-level: a definition can pass every rule and still be refused by the service (see Limitations and non-goals).
Status: version 1.0.0, stability stable. Each release is a GitHub Release of a tag with every
language's build artifacts attached, and you pin that tag to install from it; see
Install for how to install from a Release, or build and use the packages from a
checkout.
@cfq/cdk wraps every core resource in a construct that emits the matching aws-cdk-lib
Cfn* resource. Define the dashboard once with the @cfq/core builders and deploy it with the
CDK app and pipeline you already have.
@cfq/core has no CDK dependency. cfq synth runs your app entry with CFQ_OUTDIR set, and the
app's synth() writes the cfq.out/ directory. It holds, per resource, one --cli-input-json
request body, one single-resource CloudFormation template and, when the resource has permissions,
a permissions request body. It also holds a manifest with the dependency order and a .gitignore
of *. Apply the files with cfq apply, which runs the plan through the AWS SDK with the
service's consistency waits, with aws cloudformation deploy, or with the AWS CLI directly:
cfq plan --emit-inputs <dir> writes the plan's steps in order as numbered
aws quicksight <operation> --cli-input-json files into <dir>, a subdirectory of the assembly
directory that it creates, with a README.md that lists them and their waits. Every file is the
step's resolved request body except the update-dashboard-published-version step, which is a
template: its VersionNumber is 0 and must be replaced with the version number that the
preceding update-dashboard response returned before the service accepts it. A cfq.out/ file
is a direct CLI input only when the app had an account and region at synth time.
Important
A plan file inlines data source credentials, the apply result is written beside it, and a run
that crashes can leave a .cfq-<random>.tmp temporary beside a plan written outside cfq.out/.
None of them belongs in version control. Add these four lines to your project's .gitignore
before the first cfq plan.
cfq.out/
*.plan.json
*.apply.json
.cfq-*.tmp
The two jsii libraries carry one identifier per language. The Python names are the distribution names of the wheels attached to each Release. The Java, .NET and Go names are placeholders until a registry release is decided; Install lists them with the install and build steps.
| Language | @cfq/core |
@cfq/cdk |
|---|---|---|
| TypeScript | @cfq/core |
@cfq/cdk |
| Python | cfq-core (modulecfq_core ) |
cfq-cdk (modulecfq_cdk ) |
| Java | software.amazon.constructsforquicksight:cfq-core |
software.amazon.constructsforquicksight:cfq-cdk |
| .NET | Cfq.Core |
Cfq.Cdk |
| Go | github.com/awslabs/constructs-for-quicksight-go/cfqcore |
github.com/awslabs/constructs-for-quicksight-go/cfqcdk |
The Java packages are software.amazon.constructsforquicksight.core and
software.amazon.constructsforquicksight.cdk.
The command line, the MCP server and the widgets are plain TypeScript and run on Node 22.13 or later. The ORM adapters are written in the language of the ORM they read and run on that language's runtime; adapters/README.md names the runtimes.
| Package | What it is |
|---|---|
@cfq/cli |
The cfq command:synth ,plan ,apply ,import andvalidate . |
@cfq/mcp |
The cfq-mcp stdio server. Its README lists the 11 tools;apply exists only with--allow-apply . |
@cfq/widgets |
The KaTeX and lineage pages for a QuickSight custom-content visual. @cfq/cdk bundles it. |
| ORM adapters | SQLAlchemy, Prisma, Drizzle, TypeORM, JPA and Hibernate, EF Core, GORM and ent to a dataset schema. |
Install from a GitHub Release as Install describes, or build the packages from a checkout as shown here.
Important
You need Node 22.13 or later (.nvmrc pins 22) and yarn 1 (classic), plus constructs ^10.0.0
beside @cfq/core. To run a .ts entry, cfq synth also needs ts-node and typescript
beside @cfq/cli. They are optional peer dependencies, so a plain install does not fetch them;
a .js entry needs neither. cfq plan and cfq apply read AWS credentials from the SDK default
chain. cfq synth and cfq validate never call AWS.
From the repository root, install and build:
yarn install
yarn build
When you run from a checkout, cfq is a shell alias for
node /path/to/constructs-for-quicksight/packages/cli/lib/bin/cfq.js, which the
install page sets up.
Write an app that builds a QuickSightApp. The tested program is
smoke/typescript/quickstart.ts, the same app that the
quickstart builds step by step. Its first half declares the app, a data
source and a data set with a DataPrep v2 chain:
import {
Dashboard,
DataPrepV2,
DataSet,
DataSource,
Expressions,
Permissions,
QsType,
QuickSightActions,
QuickSightApp,
generated,
} from '@cfq/core';
// The app holds the resources. `cfq synth` sets CFQ_OUTDIR; run on its own, the app writes to ./cfq.out.
const app = new QuickSightApp({ awsAccountId: '123456789012', region: 'us-east-1' });
const warehouse = new DataSource(app, 'Warehouse', {
resourceId: 'warehouse',
name: 'Warehouse',
typeProp: 'ATHENA',
parameters: { athenaParameters: { workGroup: 'primary' } },
});
// A physical table plus a DataPrep v2 chain: keep rows with a positive amount, then add a column.
const sales = new DataSet(app, 'Sales', {
resourceId: 'sales',
name: 'Sales',
dataSource: warehouse,
catalog: 'AwsDataCatalog',
schemaName: 'sales_db',
table: {
name: 'sales',
columns: [
{ name: 'amount', qsType: QsType.DECIMAL },
{ name: 'region', qsType: QsType.STRING },
],
},
dataPrep: DataPrepV2.builder()
.filter(Expressions.parse('{amount} > 0'))
.createColumns([{ name: 'net_amount', expr: Expressions.parse('{amount} * 0.9') }])
.toDataPrep(),
});
The file goes on to declare a Dashboard with one KPI, then calls app.synth(), which validates
every resource and writes the assembly. Save the full program as app.ts and run:
cfq synth app.ts
cfq validate --assembly cfq.out
cfq plan --assembly cfq.out --region us-east-1
For the full program, cfq synth prints the program's own output, then the command's count. These
are the two lines the quickstart records:
3 resources in /path/to/cfq.out
3 resource(s) in /path/to/cfq.out
cfq validate prints one line per finding, then <n> finding(s), <n> error(s) across <n> resource(s).
cfq plan writes cfq.out/cfq.plan.json and prints wrote <file> (<n> steps).
cfq plan takes the region from --region, else from the region the app was built with (the
manifest identity), else from AWS_REGION or AWS_DEFAULT_REGION. The quickstart app sets a
region, so --region is optional there. cfq apply --plan cfq.out/cfq.plan.json checks the plan's
digest and then the caller's account (STS GetCallerIdentity) before any QuickSight call, asks for
confirmation unless you pass --yes, and never deletes a resource or revokes a permission.
The documentation index lists every page. The main ones:
-
Install : package identifiers per language and how to build them.
-
Quickstart : a complete app, from synth to apply.
-
Concepts : the assembly layout, manifest, placeholders and findings.
-
Rules : every rule the engine runs, with its severity.
-
Limitations : what the library does not do and how that shows up.
-
Architecture : how the packages fit together.
-
API reference:
@cfq/coreand@cfq/cdk, generated from the jsii assemblies. -
Validation is offline and schema-level. A definition can pass every rule and still be refused by the service, and
cfq applythen stops at the first failed step. -
cfq plancompares nothing with the deployed state, so every existing resource gets an update step on every plan. -
cfq applynever deletes a resource or revokes a permission. Remove those with the AWS CLI. -
The generated model is as current as its schema snapshot. A QuickSight property added after the snapshot has no member until the model is regenerated.
-
On Windows the 0600 file mode does nothing, so keep the assembly directory private.
The limitations page lists the rest and how each one shows up.
packages/core and packages/cdk are jsii libraries managed by projen from the root
.projenrc.ts. packages/cli, packages/widgets, packages/mcp and packages/schema-gen are
plain TypeScript packages sharing tsconfig.base.json. adapters/<language>/ holds the ORM
adapters, each in its own language, with the helpers the TypeScript adapters share in
adapters/typescript/common and the Go wire helpers in adapters/go/cfqwire. smoke/ holds the
five-language smoke programs and tools/parity/ the parity tool; both are yarn workspaces.
docs/ holds the documentation and docs/measurements/ the records of service behavior that some
rules cite. The API reference for the two jsii libraries is generated:
packages/core/API.md and packages/cdk/API.md.
Node 22 and yarn 1 (classic). yarn install, then yarn build, yarn test, yarn lint.
After editing .projenrc.ts run yarn projen; never edit a file that starts with the projen
marker comment. yarn scrub-check runs the information-boundary scan by hand through
scripts/scrub-check.sh, before a push and before a release. See CONTRIBUTING.md
and RELEASE.md.
Open an issue before a larger change, as CONTRIBUTING.md asks. Report a vulnerability through the routes in SECURITY.md, not in a public issue.