CDK API Reference
This page is the canonical human-readable overview of the AppTheory CDK surface. For exact prop types and exported
constructs, read cdk/.jsii, cdk/lib/index.ts, and cdk/lib/*.d.ts.
Core API constructs
AppTheoryHttpApi: API Gateway HTTP API v2 plus Lambda proxy routesAppTheoryRestApi: API Gateway REST API v1 plus single-Lambda proxy routesAppTheoryRestApiRouter: REST API v1 multi-Lambda routing with streaming supportAppTheoryMcpServer: attach-first HTTP API v2 route-family facade with MCPPOST/GET/DELETE, RFC 9728, canonical and suffix RFC 8414 discovery, and application-owned authorize/token routes; owned API, session state, logging, and throttling are the standalone specialization with production defaultsAppTheoryMcpRouteAlgebra: versioned MCP patterns and every protected-resource, discovery, authorize, and token derivation consumed by the construct and mirrored Go runtime helperAppTheoryMcpPaths: canonical MCP and OAuth discovery route pathsAppTheoryRemoteMcpServer: REST API v1/mcpwith streaming for Remote MCPAppTheoryMcpProtectedResource: deprecated URL-valued compatibility surface for a synth-time-static/.well-known/oauth-protected-resourcedocument;metadataPathis its explicit static-route escape hatchAppTheoryInstallParameters: ten required governed namespaceStringparameters, a caller-account CloudFormation Rule, and typedReftoken accessors for consuming constructsAppTheoryJobsTable: opinionated DynamoDB jobs ledger tableAppTheoryS3Ingest: secure S3 ingest front door with optional notificationsAppTheoryS3VersionedIngress: versioned namespace artifact bucket with fixedns/layout and exact-object grantsAppTheoryVectorIndex: S3 vector bucket/index plus vectorstore and Bedrock embedding env/grantsAppTheoryCodeBuildJobRunner: batch-step runner for import pipelinesAppTheoryEventBridgeBus: custom EventBridge bus with explicit cross-account publish allowlistAppTheoryEventBridgeRuleTarget: EventBridge rule or schedule to Lambda targetAppTheoryKinesisStream: create or wrap the encrypted Kinesis Data Stream used by AppTheory stream consumersAppTheoryKinesisStreamMapping: Kinesis stream to AppTheory Lambda event-source mapping with partial-batch failures enabled by defaultAppTheoryCloudWatchLogsDestination: CloudWatch Logs destination and fail-closed source allowlist for Logs-to-Kinesis deliveryAppTheoryCloudWatchLogsSubscription: source-side CloudWatch Logs subscription attachment for a caller-provided log group, destination ARN, filter pattern, and optional delivery roleAppTheoryHttpIngestionEndpoint: authenticated HTTP API v2 ingestion endpoint with Lambda request authorizerAppTheoryMicrovmNetworkConnector: caller-owned VPC/subnet/security-group egress wiring plus typed ingress/egress/shell connector references for Lambda MicroVMsAppTheoryMicrovmImage:AWS::Lambda::MicrovmImagedeployment with AppTheory hook, logging, resource, and connector validationAppTheoryMicrovmController: protected controller routes, controller Lambda, IAM grants, and durablepk/sk/ttlsession registry tableAppTheorySsrSite: FaceTheory-first CloudFront + S3 + Lambda URL deployment for SSR, SSG, and ISRAppTheoryQueue,AppTheoryQueueConsumer,AppTheoryQueueProcessor: SQS queue and consumer patterns
Supporting constructs exported from cdk/lib/index.ts
AppTheoryFunction: Lambda wrapper with AppTheory defaults; setroleNamewhen the execution role needs a stable physical nameAppTheoryFunctionAlarmsAppTheoryDynamoDBStreamMappingAppTheoryDynamoTableAppTheoryEventBusTable: durable EventBus DynamoDB table plus Lambda binding helper for publish/query/replay flowsAppTheoryLambdaRoleAppTheoryPathRoutedFrontendAppTheoryMediaCdnAppTheoryWebSocketApi
Governed namespace install parameters
AppTheoryInstallParameters keeps namespace templates account-agnostic. It accepts no install identity as props;
instead it emits TargetAccountId, NamespaceSlug, AccountClass, TargetApplicationId, TenantId, DnsHost,
Stage, PublicHostedZoneId, AuthorizationServerOrigin, and AutheoryJwksUrl as required String parameters and
exposes each value as a typed string token. TargetAccountMatchesCaller rejects a target account that differs from
AWS::AccountId.
Patterns and allowed values are evaluated by CloudFormation rather than duplicated at synthesis. CloudFormation Rules
cannot use Fn::Join, so the governed install-profile validator retains the relational
DnsHost == cloud-keeper.<NamespaceSlug>.theorycloud.app check; the parameter pattern still enforces the
theorycloud.app suffix. See Namespace Install Parameters.
Versioned namespace artifact ingress
AppTheoryS3VersionedIngress creates the namespace release bucket with versioning enabled, all four public-access-block
settings, S3-managed encryption, bucket-owner-enforced ownership, TLS enforcement, retain semantics, and an enabled
lifecycle rule that aborts incomplete multipart uploads after 7 days. It defines no object expiration or
noncurrent-version deletion because the governed artifact flow does not authorize deletion of pinned versions.
grantUpload grants exactly one action, s3:PutObject; grantVersionedRead grants exactly one action,
s3:GetObjectVersion. For literal inputs, each grant targets one exact ns/<namespaceSlug>/<bundleId> object ARN with
no wildcard. s3:PutObject inherently covers multipart create, part upload, and completion on that key, but the helper
does not grant the separate abort or part-listing actions; the lifecycle rule prevents permanent incomplete-upload
residue. Literal slugs and bundle IDs are synthesis-validated against the application-release patterns. Under the
accepted Option A policy, unresolved CDK tokens skip literal value validation but remain required and render through a
CloudFormation-safe join. CloudFormation resolves them at deployment; AppTheory cannot guarantee exactness for
token-valued inputs. Bucket identity is exposed through bucketName and bucketArn; the canonical root is
AppTheoryS3VersionedIngress.KEY_ROOT and the instance keyRoot accessor. See
S3 Versioned Artifact Ingress.
Stable Lambda execution role names
AppTheoryFunctionProps.roleName lets the Lambda L2 create its execution role, preserving every CDK-computed managed
policy, then sets the synthesized AWS::IAM::Role.RoleName to the exact requested value.
AppTheoryAppProps.roleName forwards the same contract to its named function:
new AppTheoryApp(this, "Runtime", {
appName: "orders-api",
code: lambda.Code.fromAsset("dist"),
roleName: "orders-api-runtime",
});
When roleName is omitted, CloudFormation generates the role name. Concrete values must be non-empty, no more than 64
characters, and match IAM’s ^[\w+=,.@-]+$ role-name pattern; AppTheory validates those constraints at synthesis.
Values for which Token.isUnresolved(roleName) is true are exempt from value validation so account-agnostic synthesis
remains representable for the THE-2861 token-valued-input failure class. IAM validates the resolved value at deployment,
so a bad token-resolved name fails deployment rather than synthesis. AppTheory still fails synthesis rather than
silently using an unnamed or differently named role when the generated role cannot be renamed. This prop supersedes
direct CfnRole.addPropertyOverride("RoleName", ...) escape hatches for stable function role names.
Function log group removal policy
AppTheoryFunction accepts the inherited logRemovalPolicy prop for log groups it creates, and
AppTheoryAppProps.logRemovalPolicy forwards that contract to the app’s named function:
new AppTheoryApp(this, "Runtime", {
appName: "orders-api",
code: lambda.Code.fromAsset("dist"),
logRemovalPolicy: RemovalPolicy.RETAIN,
});
All AppTheory-created function log groups default to RemovalPolicy.DESTROY, including the anonymous path whose
function name CloudFormation generates. This matches the prototype’s self-cleaning posture; for named functions it
also prevents failed deployments from leaving /aws/lambda/<function-name> behind and blocking a recreate. Set
RemovalPolicy.RETAIN explicitly when the logs must survive stack deletion. RemovalPolicy.SNAPSHOT fails synthesis
because AWS::Logs::LogGroup does not support snapshot removal policies. The prop supersedes direct
CfnLogGroup.applyRemovalPolicy(...) escape hatches for AppTheory-created function log groups.
Caller-provided log groups remain caller-owned: AppTheory never changes their removal policy. Supplying both
logGroup and logRemovalPolicy fails synthesis rather than silently ignoring the requested policy. AppTheory also
fails synthesis if an AppTheory-created log group is not backed by the expected AWS::Logs::LogGroup resource.
Stage access-log groups are intentionally outside this function-log policy. The auto-created access-log groups in
AppTheoryHttpApi, AppTheoryMcpServer, AppTheoryRestApiRouter, AppTheoryMicrovmController, and
AppTheoryHttpIngestionEndpoint omit logGroupName and deliberately retain the CDK removal-policy default.
AppTheoryWebSocketApi is the sixth construct with an auto-created unnamed access-log group; it defaults to one-week
retention and applies the caller-tunable accessLogRemovalPolicy, which defaults to RemovalPolicy.RETAIN. Because
CloudFormation generates the physical names for all six groups, none can hit the fixed-name collision on redeploy that
RemovalPolicy.DESTROY prevents for named Lambda log groups.
Selection guide
- Use
AppTheoryHttpApifor the simplest HTTP API v2 deployment - Use
AppTheoryRestApiwhen you need REST API v1 but not multi-Lambda routing - Use
AppTheoryRestApiRouterwhen you need SSE or response streaming - Use
AppTheoryMcpServerfor the route-algebra MCP facade. Supplyapifor a shared front door or omit it for the standalone owned API; then use Gomcpfacade.RegisterMCPFacadewith explicit app-owned issuer, JWKS, scopes, capabilities, and handlers. Public unauthenticated MCP requires the explicitunauthenticatedMcpopt-out. - Use
AppTheoryRemoteMcpServerwhen REST API v1 response streaming and resumable Remote MCP transport are required; do not start new namespace applications on the URL-valuedAppTheoryMcpProtectedResourcecompatibility construct. - Use
AppTheorySsrSitewhen you need the canonical FaceTheory-first SSR/SSG/ISR deployment story - Use
AppTheoryJobsTable,AppTheoryS3Ingest, andAppTheoryCodeBuildJobRunnerfor import pipelines - Use
AppTheoryVectorIndexwhen an import pipeline or MCP tool needs S3 Vectors semantic recall - Use
AppTheoryMicrovmNetworkConnector,AppTheoryMicrovmImage, andAppTheoryMicrovmControllertogether for the corrective M16 AWS Lambda MicroVM golden path. The controller requires an authorizer, explicit ingress/egress/shell connector references, endpoint-dispatched no-hook image wiring for the live example path, token-hidden invoke routes, and fails closed when omitted.
Event workload wiring:
- use
AppTheoryEventBridgeRuleTargetfor scheduled workloads and EventBridge pattern intake - use
targetPropson EventBridge targets for DLQ, retry, and maximum-event-age policy - use
AppTheoryDynamoDBStreamMappingfor DynamoDB Streams to Lambda wiring - use
AppTheoryKinesisStreamplusAppTheoryKinesisStreamMappingfor Kinesis stream consumers - use
AppTheoryCloudWatchLogsDestinationwhen CloudWatch Logs subscriptions deliver through Kinesis; configureallowedSourceAccountsand/orallowedOrganizationIdsexplicitly - use
AppTheoryCloudWatchLogsSubscriptionto attach one source log group to the destination ARN from TypeScript (new AppTheoryCloudWatchLogsSubscription(...)) or Go (apptheorycdk.NewAppTheoryCloudWatchLogsSubscription(...)) - use
AppTheoryJobsTablewhen the workload needs durable run state, idempotency, leases, or record status - keep handlers on AppTheory runtime entrypoints so routing, retry posture, and observability stay fixture-backed
Runtime guide:
Kinesis guide and example:
- Kinesis + CloudWatch Logs
examples/cdk/kinesis-cloudwatch-logs
Guide:
MicroVM guide and example:
- Lambda MicroVM CDK Constructs
examples/cdk/microvm-controller
AppSync note
AppTheory does not currently export an AppSync-specific CDK construct.
Use aws-cdk-lib/aws-appsync for the GraphQL API, schema, auth, and Lambda data source wiring, and keep the Lambda
handler on AppTheory’s AppSync runtime entrypoints.
Guide: