stacktape 3.5.8 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.tsconfig.bun-build.json +1 -0
  2. package/ai-docs/cli-ref/aws-profile-create.md +22 -0
  3. package/ai-docs/cli-ref/aws-profile-delete.md +22 -0
  4. package/ai-docs/cli-ref/aws-profile-list.md +20 -0
  5. package/ai-docs/cli-ref/aws-profile-update.md +22 -0
  6. package/ai-docs/cli-ref/bastion-session.md +29 -0
  7. package/ai-docs/cli-ref/bastion-tunnel.md +30 -0
  8. package/ai-docs/cli-ref/bucket-sync.md +30 -0
  9. package/ai-docs/cli-ref/cf-module-update.md +26 -0
  10. package/ai-docs/cli-ref/cf-rollback.md +28 -0
  11. package/ai-docs/cli-ref/codebuild-deploy.md +34 -0
  12. package/ai-docs/cli-ref/compile-template.md +25 -0
  13. package/ai-docs/cli-ref/container-session.md +30 -0
  14. package/ai-docs/cli-ref/debug-alarms.md +28 -0
  15. package/ai-docs/cli-ref/debug-aws-sdk.md +33 -0
  16. package/ai-docs/cli-ref/debug-container-exec.md +36 -0
  17. package/ai-docs/cli-ref/debug-dynamodb.md +35 -0
  18. package/ai-docs/cli-ref/debug-logs.md +34 -0
  19. package/ai-docs/cli-ref/debug-metrics.md +33 -0
  20. package/ai-docs/cli-ref/debug-opensearch.md +35 -0
  21. package/ai-docs/cli-ref/debug-redis.md +36 -0
  22. package/ai-docs/cli-ref/debug-sql.md +35 -0
  23. package/ai-docs/cli-ref/defaults-configure.md +29 -0
  24. package/ai-docs/cli-ref/defaults-list.md +20 -0
  25. package/ai-docs/cli-ref/delete.md +24 -0
  26. package/ai-docs/cli-ref/deploy.md +25 -0
  27. package/ai-docs/cli-ref/deployment-script-run.md +28 -0
  28. package/ai-docs/cli-ref/dev-stop.md +26 -0
  29. package/ai-docs/cli-ref/dev.md +45 -0
  30. package/ai-docs/cli-ref/domain-add.md +26 -0
  31. package/ai-docs/cli-ref/help.md +18 -0
  32. package/ai-docs/cli-ref/info-operations.md +22 -0
  33. package/ai-docs/cli-ref/info-stack.md +30 -0
  34. package/ai-docs/cli-ref/info-stacks.md +26 -0
  35. package/ai-docs/cli-ref/info-whoami.md +22 -0
  36. package/ai-docs/cli-ref/init.md +30 -0
  37. package/ai-docs/cli-ref/login.md +20 -0
  38. package/ai-docs/cli-ref/logout.md +18 -0
  39. package/ai-docs/cli-ref/mcp-add.md +22 -0
  40. package/ai-docs/cli-ref/mcp.md +20 -0
  41. package/ai-docs/cli-ref/org-create.md +24 -0
  42. package/ai-docs/cli-ref/org-delete.md +24 -0
  43. package/ai-docs/cli-ref/org-list.md +22 -0
  44. package/ai-docs/cli-ref/package-workloads.md +25 -0
  45. package/ai-docs/cli-ref/param-get.md +26 -0
  46. package/ai-docs/cli-ref/preview-changes.md +23 -0
  47. package/ai-docs/cli-ref/project-create.md +22 -0
  48. package/ai-docs/cli-ref/projects-list.md +22 -0
  49. package/ai-docs/cli-ref/rollback.md +28 -0
  50. package/ai-docs/cli-ref/script-run.md +29 -0
  51. package/ai-docs/cli-ref/secret-create.md +28 -0
  52. package/ai-docs/cli-ref/secret-delete.md +26 -0
  53. package/ai-docs/cli-ref/secret-get.md +26 -0
  54. package/ai-docs/cli-ref/upgrade.md +20 -0
  55. package/ai-docs/cli-ref/version.md +18 -0
  56. package/ai-docs/concept/connecting-resources.md +369 -0
  57. package/ai-docs/concept/directives.md +371 -0
  58. package/ai-docs/concept/extending-cloudformation.md +315 -0
  59. package/ai-docs/concept/overrides-and-transforms.md +352 -0
  60. package/ai-docs/concept/stages-and-environments.md +347 -0
  61. package/ai-docs/concept/typescript-config.md +447 -0
  62. package/ai-docs/concept/yaml-config.md +338 -0
  63. package/ai-docs/config-ref/_root.md +131 -0
  64. package/ai-docs/config-ref/application-load-balancer.md +1109 -0
  65. package/ai-docs/config-ref/astro-web.md +115 -0
  66. package/ai-docs/config-ref/aws-cdk-construct.md +68 -0
  67. package/ai-docs/config-ref/bastion.md +93 -0
  68. package/ai-docs/config-ref/batch-job.md +179 -0
  69. package/ai-docs/config-ref/bucket.md +348 -0
  70. package/ai-docs/config-ref/cdn.md +496 -0
  71. package/ai-docs/config-ref/custom-resource.md +80 -0
  72. package/ai-docs/config-ref/deployment-script.md +79 -0
  73. package/ai-docs/config-ref/dynamo-db-table.md +202 -0
  74. package/ai-docs/config-ref/edge-lambda-function.md +87 -0
  75. package/ai-docs/config-ref/efs-filesystem.md +72 -0
  76. package/ai-docs/config-ref/event-bus.md +63 -0
  77. package/ai-docs/config-ref/function.md +409 -0
  78. package/ai-docs/config-ref/hosting-bucket.md +171 -0
  79. package/ai-docs/config-ref/http-api-gateway.md +149 -0
  80. package/ai-docs/config-ref/http-endpoint.md +92 -0
  81. package/ai-docs/config-ref/kinesis-stream.md +97 -0
  82. package/ai-docs/config-ref/mongo-db-atlas-cluster.md +254 -0
  83. package/ai-docs/config-ref/multi-container-workload.md +399 -0
  84. package/ai-docs/config-ref/network-load-balancer.md +118 -0
  85. package/ai-docs/config-ref/nextjs-web.md +147 -0
  86. package/ai-docs/config-ref/nuxt-web.md +81 -0
  87. package/ai-docs/config-ref/open-search.md +206 -0
  88. package/ai-docs/config-ref/private-service.md +75 -0
  89. package/ai-docs/config-ref/redis-cluster.md +223 -0
  90. package/ai-docs/config-ref/relational-database.md +525 -0
  91. package/ai-docs/config-ref/remix-web.md +74 -0
  92. package/ai-docs/config-ref/sns-topic.md +69 -0
  93. package/ai-docs/config-ref/solidstart-web.md +75 -0
  94. package/ai-docs/config-ref/sqs-queue-not-empty.md +414 -0
  95. package/ai-docs/config-ref/sqs-queue.md +232 -0
  96. package/ai-docs/config-ref/state-machine.md +235 -0
  97. package/ai-docs/config-ref/sveltekit-web.md +81 -0
  98. package/ai-docs/config-ref/tanstack-web.md +75 -0
  99. package/ai-docs/config-ref/upstash-redis.md +59 -0
  100. package/ai-docs/config-ref/user-auth-pool.md +876 -0
  101. package/ai-docs/config-ref/web-app-firewall.md +212 -0
  102. package/ai-docs/config-ref/web-service.md +178 -0
  103. package/ai-docs/config-ref/worker-service.md +41 -0
  104. package/ai-docs/getting-started/console.md +232 -0
  105. package/ai-docs/getting-started/deployment.md +434 -0
  106. package/ai-docs/getting-started/dev-mode.md +118 -0
  107. package/ai-docs/getting-started/how-it-works.md +119 -0
  108. package/ai-docs/getting-started/intro.md +157 -0
  109. package/ai-docs/getting-started/using-with-ai.md +228 -0
  110. package/ai-docs/getting-started/workflow.md +197 -0
  111. package/ai-docs/index.json +1514 -0
  112. package/ai-docs/recipe/background-jobs.md +183 -0
  113. package/ai-docs/recipe/database-migrations.md +240 -0
  114. package/ai-docs/recipe/graphql-api.md +211 -0
  115. package/ai-docs/recipe/monorepo-setup.md +183 -0
  116. package/ai-docs/recipe/nextjs-full-stack.md +188 -0
  117. package/ai-docs/recipe/rest-api-with-database.md +156 -0
  118. package/ai-docs/recipe/scheduled-tasks.md +186 -0
  119. package/ai-docs/recipe/static-website.md +241 -0
  120. package/ai-docs/troubleshooting/cloudformation-stack-states.md +189 -0
  121. package/bin/stacktape.js +0 -12
  122. package/package.json +1 -1
  123. package/plain.d.ts +372 -111
@@ -0,0 +1,447 @@
1
+ ---
2
+ docType: concept
3
+ title: TypeScript Configuration
4
+ tags:
5
+ - typescript
6
+ - configuration
7
+ - concept
8
+ source: docs/_curated-docs/concepts/typescript-config.mdx
9
+ priority: 1
10
+ ---
11
+
12
+ # TypeScript Configuration
13
+
14
+ TypeScript is the recommended way to configure Stacktape. It provides type safety, IDE autocompletion, and the full power of a programming language for complex configurations.
15
+
16
+ ## Basic Setup
17
+
18
+ ### Install the SDK
19
+
20
+ ```bash
21
+ npm install stacktape --save-dev
22
+ ```
23
+
24
+ ### Create Configuration File
25
+
26
+ Create `stacktape.ts` in your project root:
27
+
28
+ ```typescript
29
+ import {
30
+ defineConfig,
31
+ HttpApiGateway,
32
+ LambdaFunction,
33
+ StacktapeLambdaBuildpackPackaging,
34
+ HttpApiIntegration
35
+ } from 'stacktape';
36
+
37
+ export default defineConfig(({ stage }) => {
38
+ const api = new HttpApiGateway({
39
+ cors: { enabled: true }
40
+ });
41
+
42
+ const handler = new LambdaFunction({
43
+ packaging: new StacktapeLambdaBuildpackPackaging({
44
+ entryfilePath: './src/handler.ts'
45
+ }),
46
+ events: [
47
+ new HttpApiIntegration({
48
+ httpApiGatewayName: api.resourceName,
49
+ method: 'GET',
50
+ path: '/'
51
+ })
52
+ ]
53
+ });
54
+
55
+ return {
56
+ resources: { api, handler }
57
+ };
58
+ });
59
+ ```
60
+
61
+ ## The defineConfig Function
62
+
63
+ `defineConfig` is the main entry point. It receives a callback with context information:
64
+
65
+ ```typescript
66
+ import { defineConfig } from 'stacktape';
67
+
68
+ export default defineConfig(({ stage, region, projectName, command, cliArgs }) => {
69
+ console.log(`Deploying ${projectName} to ${stage} in ${region}`);
70
+ console.log(`Running command: ${command}`);
71
+ console.log(`Extra CLI args:`, cliArgs);
72
+
73
+ return {
74
+ resources: {}
75
+ };
76
+ });
77
+ ```
78
+
79
+ ### Context Properties
80
+
81
+ | Property | Type | Description |
82
+ | ------------- | ---------- | ------------------------------------------------ |
83
+ | `stage` | `string` | Current stage (e.g., `dev`, `production`) |
84
+ | `region` | `string` | AWS region (e.g., `us-east-1`) |
85
+ | `projectName` | `string` | Project name |
86
+ | `command` | `string` | CLI command being run (`deploy`, `delete`, etc.) |
87
+ | `cliArgs` | `string[]` | Additional CLI arguments after `--` |
88
+
89
+ ## Resource Classes
90
+
91
+ Stacktape provides typed classes for all resources:
92
+
93
+ ### Compute Resources
94
+
95
+ ```typescript
96
+ import {
97
+ LambdaFunction,
98
+ EdgeLambdaFunction,
99
+ WebService,
100
+ PrivateService,
101
+ WorkerService,
102
+ MultiContainerWorkload,
103
+ BatchJob,
104
+ NextjsWeb
105
+ } from 'stacktape';
106
+ ```
107
+
108
+ ### Database Resources
109
+
110
+ ```typescript
111
+ import {
112
+ RelationalDatabase,
113
+ DynamoDbTable,
114
+ RedisCluster,
115
+ MongoDbAtlasCluster,
116
+ UpstashRedis,
117
+ OpenSearchDomain
118
+ } from 'stacktape';
119
+ ```
120
+
121
+ ### Networking Resources
122
+
123
+ ```typescript
124
+ import { HttpApiGateway, ApplicationLoadBalancer, NetworkLoadBalancer } from 'stacktape';
125
+ ```
126
+
127
+ ### Other Resources
128
+
129
+ ```typescript
130
+ import {
131
+ Bucket,
132
+ HostingBucket,
133
+ SqsQueue,
134
+ SnsTopic,
135
+ EventBus,
136
+ UserAuthPool,
137
+ WebAppFirewall,
138
+ Bastion,
139
+ StateMachine,
140
+ EfsFilesystem
141
+ } from 'stacktape';
142
+ ```
143
+
144
+ ## Packaging Classes
145
+
146
+ ```typescript
147
+ import {
148
+ // Lambda packaging
149
+ StacktapeLambdaBuildpackPackaging,
150
+ CustomArtifactPackaging,
151
+
152
+ // Container packaging
153
+ StacktapeImageBuildpackPackaging,
154
+ ExternalBuildpackPackaging,
155
+ CustomDockerfilePackaging,
156
+ PrebuiltImagePackaging,
157
+ NixpacksPackaging
158
+ } from 'stacktape';
159
+ ```
160
+
161
+ ## Event/Integration Classes
162
+
163
+ ```typescript
164
+ import {
165
+ // Lambda events
166
+ HttpApiIntegration,
167
+ LoadBalancerIntegration,
168
+ ScheduleIntegration,
169
+ SqsIntegration,
170
+ SnsIntegration,
171
+ S3Integration,
172
+ DynamoDbIntegration,
173
+ KinesisIntegration,
174
+ EventBridgeIntegration,
175
+ CloudwatchLogsIntegration,
176
+
177
+ // Container events
178
+ ContainerHttpApiIntegration,
179
+ ContainerLoadBalancerIntegration,
180
+ ContainerNetworkLoadBalancerIntegration
181
+ } from 'stacktape';
182
+ ```
183
+
184
+ ## Engine Classes
185
+
186
+ ```typescript
187
+ import {
188
+ // RDS engines
189
+ RdsEnginePostgres,
190
+ RdsEngineMysql,
191
+ RdsEngineMariadb,
192
+
193
+ // Aurora engines
194
+ AuroraEnginePostgresql,
195
+ AuroraEngineMysql,
196
+
197
+ // Aurora Serverless
198
+ AuroraServerlessEnginePostgresql,
199
+ AuroraServerlessEngineMysql
200
+ } from 'stacktape';
201
+ ```
202
+
203
+ ## Directive Functions
204
+
205
+ ```typescript
206
+ import { $Secret, $ResourceParam, $Stage, $Region, $Format, $Var, $File } from 'stacktape';
207
+ ```
208
+
209
+ ## Complete Example
210
+
211
+ Here's a full-featured configuration:
212
+
213
+ ```typescript
214
+ import {
215
+ defineConfig,
216
+ HttpApiGateway,
217
+ LambdaFunction,
218
+ RelationalDatabase,
219
+ Bucket,
220
+ SqsQueue,
221
+ StacktapeLambdaBuildpackPackaging,
222
+ RdsEnginePostgres,
223
+ HttpApiIntegration,
224
+ SqsIntegration,
225
+ LocalScript,
226
+ $Secret
227
+ } from 'stacktape';
228
+
229
+ export default defineConfig(({ stage }) => {
230
+ const isProduction = stage === 'production';
231
+
232
+ // Database
233
+ const database = new RelationalDatabase({
234
+ engine: new RdsEnginePostgres({
235
+ version: '16',
236
+ primaryInstance: {
237
+ instanceSize: isProduction ? 'db.t4g.medium' : 'db.t4g.micro',
238
+ multiAz: isProduction
239
+ }
240
+ }),
241
+ credentials: {
242
+ masterUserPassword: $Secret('db-password')
243
+ }
244
+ });
245
+
246
+ // File storage
247
+ const uploads = new Bucket({
248
+ cors: [
249
+ {
250
+ allowedOrigins: ['*'],
251
+ allowedMethods: ['GET', 'PUT'],
252
+ allowedHeaders: ['*']
253
+ }
254
+ ]
255
+ });
256
+
257
+ // Background job queue
258
+ const jobQueue = new SqsQueue({
259
+ visibilityTimeoutSeconds: 300
260
+ });
261
+
262
+ // API Gateway
263
+ const api = new HttpApiGateway({
264
+ cors: { enabled: true },
265
+ customDomains: isProduction ? [{ domainName: 'api.example.com' }] : []
266
+ });
267
+
268
+ // API handler
269
+ const apiHandler = new LambdaFunction({
270
+ packaging: new StacktapeLambdaBuildpackPackaging({
271
+ entryfilePath: './src/api/handler.ts'
272
+ }),
273
+ memory: 512,
274
+ timeout: 30,
275
+ connectTo: [database, uploads, jobQueue],
276
+ events: [
277
+ new HttpApiIntegration({
278
+ httpApiGatewayName: api.resourceName,
279
+ method: '*',
280
+ path: '/*'
281
+ })
282
+ ]
283
+ });
284
+
285
+ // Background worker
286
+ const worker = new LambdaFunction({
287
+ packaging: new StacktapeLambdaBuildpackPackaging({
288
+ entryfilePath: './src/worker/handler.ts'
289
+ }),
290
+ memory: 1024,
291
+ timeout: 300,
292
+ connectTo: [database, uploads],
293
+ events: [
294
+ new SqsIntegration({
295
+ sqsQueueName: jobQueue.resourceName,
296
+ batchSize: 10
297
+ })
298
+ ]
299
+ });
300
+
301
+ // Migration script
302
+ const migrate = new LocalScript({
303
+ executeCommand: 'npx prisma migrate deploy',
304
+ connectTo: [database]
305
+ });
306
+
307
+ return {
308
+ resources: {
309
+ database,
310
+ uploads,
311
+ jobQueue,
312
+ api,
313
+ apiHandler,
314
+ worker
315
+ },
316
+ scripts: { migrate },
317
+ hooks: {
318
+ afterDeploy: [{ scriptName: 'migrate' }]
319
+ }
320
+ };
321
+ });
322
+ ```
323
+
324
+ ## Conditional Configuration
325
+
326
+ Use TypeScript's full power for conditional logic:
327
+
328
+ ```typescript
329
+ export default defineConfig(({ stage }) => {
330
+ const resources: Record<string, any> = {};
331
+
332
+ // Always create API
333
+ resources.api = new HttpApiGateway({});
334
+
335
+ // Only create database in non-ephemeral stages
336
+ if (stage !== 'preview') {
337
+ resources.database = new RelationalDatabase({
338
+ engine: new RdsEnginePostgres({ version: '16' })
339
+ });
340
+ }
341
+
342
+ // Add monitoring in production
343
+ if (stage === 'production') {
344
+ resources.firewall = new WebAppFirewall({
345
+ scope: 'regional'
346
+ });
347
+ }
348
+
349
+ return { resources };
350
+ });
351
+ ```
352
+
353
+ ## Loops and Dynamic Resources
354
+
355
+ ```typescript
356
+ export default defineConfig(({ stage }) => {
357
+ const regions = ['us-east-1', 'eu-west-1', 'ap-southeast-1'];
358
+ const resources: Record<string, any> = {};
359
+
360
+ // Create a queue for each region
361
+ for (const region of regions) {
362
+ resources[`queue-${region}`] = new SqsQueue({
363
+ fifoQueue: true
364
+ });
365
+ }
366
+
367
+ // Create handlers from a list
368
+ const endpoints = ['users', 'products', 'orders'];
369
+ for (const endpoint of endpoints) {
370
+ resources[`${endpoint}Handler`] = new LambdaFunction({
371
+ packaging: new StacktapeLambdaBuildpackPackaging({
372
+ entryfilePath: `./src/handlers/${endpoint}.ts`
373
+ })
374
+ });
375
+ }
376
+
377
+ return { resources };
378
+ });
379
+ ```
380
+
381
+ ## Sharing Configuration
382
+
383
+ Create reusable configuration modules:
384
+
385
+ ```typescript
386
+ // config/database.ts
387
+ import { RelationalDatabase, RdsEnginePostgres, $Secret } from 'stacktape';
388
+
389
+ export const createDatabase = (stage: string) => {
390
+ return new RelationalDatabase({
391
+ engine: new RdsEnginePostgres({
392
+ version: '16',
393
+ primaryInstance: {
394
+ instanceSize: stage === 'production' ? 'db.t4g.medium' : 'db.t4g.micro'
395
+ }
396
+ }),
397
+ credentials: {
398
+ masterUserPassword: $Secret('db-password')
399
+ }
400
+ });
401
+ };
402
+
403
+ // stacktape.ts
404
+ import { defineConfig } from 'stacktape';
405
+ import { createDatabase } from './config/database';
406
+
407
+ export default defineConfig(({ stage }) => {
408
+ const database = createDatabase(stage);
409
+
410
+ return { resources: { database } };
411
+ });
412
+ ```
413
+
414
+ ## Type Safety Benefits
415
+
416
+ The TypeScript configuration catches errors at development time:
417
+
418
+ ```typescript
419
+ // ❌ Type error: 'invalid' is not a valid engine type
420
+ const db = new RelationalDatabase({
421
+ engine: { type: 'invalid' }
422
+ });
423
+
424
+ // ❌ Type error: 'memory' expects a number
425
+ const fn = new LambdaFunction({
426
+ memory: '512' // should be 512
427
+ });
428
+
429
+ // ✅ Correct
430
+ const fn = new LambdaFunction({
431
+ memory: 512
432
+ });
433
+ ```
434
+
435
+ ## IDE Support
436
+
437
+ With TypeScript, you get:
438
+
439
+ - **Autocompletion** for all properties
440
+ - **Inline documentation** on hover
441
+ - **Go to definition** for types
442
+ - **Rename refactoring** across files
443
+ - **Error highlighting** before deployment
444
+
445
+ `[IMAGE PLACEHOLDER: vscode-typescript-autocomplete]`
446
+
447
+ ## Next Steps