@stacksjs/ts-cloud 0.1.11 → 0.1.14

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 (77) hide show
  1. package/README.md +41 -379
  2. package/dist/bin/cli.js +1039 -416
  3. package/dist/index.d.ts +34 -1
  4. package/dist/index.js +76467 -7133
  5. package/package.json +6 -6
  6. package/dist/aws/acm.d.ts +0 -129
  7. package/dist/aws/application-autoscaling.d.ts +0 -282
  8. package/dist/aws/bedrock.d.ts +0 -2292
  9. package/dist/aws/client.d.ts +0 -79
  10. package/dist/aws/cloudformation.d.ts +0 -105
  11. package/dist/aws/cloudfront.d.ts +0 -265
  12. package/dist/aws/cloudwatch-logs.d.ts +0 -48
  13. package/dist/aws/comprehend.d.ts +0 -505
  14. package/dist/aws/connect.d.ts +0 -377
  15. package/dist/aws/deploy-imap.d.ts +0 -14
  16. package/dist/aws/dynamodb.d.ts +0 -176
  17. package/dist/aws/ec2.d.ts +0 -272
  18. package/dist/aws/ecr.d.ts +0 -149
  19. package/dist/aws/ecs.d.ts +0 -162
  20. package/dist/aws/elasticache.d.ts +0 -71
  21. package/dist/aws/elbv2.d.ts +0 -248
  22. package/dist/aws/email.d.ts +0 -175
  23. package/dist/aws/eventbridge.d.ts +0 -142
  24. package/dist/aws/iam.d.ts +0 -638
  25. package/dist/aws/imap-server.d.ts +0 -119
  26. package/dist/aws/index.d.ts +0 -192
  27. package/dist/aws/kendra.d.ts +0 -782
  28. package/dist/aws/lambda.d.ts +0 -232
  29. package/dist/aws/opensearch.d.ts +0 -87
  30. package/dist/aws/personalize.d.ts +0 -516
  31. package/dist/aws/polly.d.ts +0 -214
  32. package/dist/aws/rds.d.ts +0 -240
  33. package/dist/aws/rekognition.d.ts +0 -543
  34. package/dist/aws/route53-domains.d.ts +0 -113
  35. package/dist/aws/route53.d.ts +0 -215
  36. package/dist/aws/s3.d.ts +0 -212
  37. package/dist/aws/scheduler.d.ts +0 -140
  38. package/dist/aws/secrets-manager.d.ts +0 -170
  39. package/dist/aws/ses.d.ts +0 -288
  40. package/dist/aws/setup-phone.d.ts +0 -0
  41. package/dist/aws/setup-sms.d.ts +0 -116
  42. package/dist/aws/sms.d.ts +0 -304
  43. package/dist/aws/smtp-server.d.ts +0 -61
  44. package/dist/aws/sns.d.ts +0 -117
  45. package/dist/aws/sqs.d.ts +0 -65
  46. package/dist/aws/ssm.d.ts +0 -179
  47. package/dist/aws/sts.d.ts +0 -15
  48. package/dist/aws/support.d.ts +0 -104
  49. package/dist/aws/test-imap.d.ts +0 -0
  50. package/dist/aws/textract.d.ts +0 -403
  51. package/dist/aws/transcribe.d.ts +0 -60
  52. package/dist/aws/translate.d.ts +0 -358
  53. package/dist/aws/voice.d.ts +0 -219
  54. package/dist/config.d.ts +0 -7
  55. package/dist/deploy/index.d.ts +0 -2
  56. package/dist/deploy/static-site-external-dns.d.ts +0 -51
  57. package/dist/deploy/static-site.d.ts +0 -71
  58. package/dist/dns/cloudflare.d.ts +0 -52
  59. package/dist/dns/godaddy.d.ts +0 -38
  60. package/dist/dns/index.d.ts +0 -45
  61. package/dist/dns/porkbun.d.ts +0 -18
  62. package/dist/dns/route53-adapter.d.ts +0 -38
  63. package/dist/dns/types.d.ts +0 -77
  64. package/dist/dns/validator.d.ts +0 -78
  65. package/dist/generators/index.d.ts +0 -1
  66. package/dist/generators/infrastructure.d.ts +0 -30
  67. package/dist/push/apns.d.ts +0 -60
  68. package/dist/push/fcm.d.ts +0 -117
  69. package/dist/push/index.d.ts +0 -14
  70. package/dist/security/pre-deploy-scanner.d.ts +0 -69
  71. package/dist/ssl/acme-client.d.ts +0 -67
  72. package/dist/ssl/index.d.ts +0 -2
  73. package/dist/ssl/letsencrypt.d.ts +0 -48
  74. package/dist/types.d.ts +0 -1
  75. package/dist/utils/cli.d.ts +0 -123
  76. package/dist/validation/index.d.ts +0 -1
  77. package/dist/validation/template.d.ts +0 -23
package/README.md CHANGED
@@ -1,406 +1,68 @@
1
- <p align="center"><img src=".github/art/cover.jpg" alt="Social Card of this repo"></p>
1
+ # @stacksjs/ts-cloud
2
2
 
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![GitHub Actions][github-actions-src]][github-actions-href]
5
- [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
6
- <!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
7
- <!-- [![Codecov][codecov-src]][codecov-href] -->
3
+ A lightweight, performant infrastructure-as-code library and CLI for deploying both server-based (EC2) and serverless applications on AWS.
8
4
 
9
- # ts-cloud
10
-
11
- > Zero-dependency AWS infrastructure as TypeScript. Deploy production-ready cloud infrastructure without AWS SDK or CLI.
12
-
13
- ## Overview
14
-
15
- ts-cloud is a modern infrastructure-as-code framework that lets you define AWS infrastructure using TypeScript configuration files. Unlike AWS CDK or Terraform, ts-cloud:
16
-
17
- - **Zero AWS Dependencies** - No AWS SDK, no AWS CLI. Direct AWS API calls only.
18
- - **Type-Safe Configuration** - Full TypeScript types for all AWS resources
19
- - **Production-Ready Presets** - 13 battle-tested infrastructure templates
20
- - **Bun-Powered** - Lightning-fast builds and deployments
21
- - **CloudFormation Native** - Generate clean, reviewable CloudFormation templates
22
-
23
- ## Features
24
-
25
- ### 🚀 Configuration Presets
26
-
27
- Skip the boilerplate with production-ready presets for common architectures:
28
-
29
- - **Static Sites** - S3 + CloudFront for SPAs and static websites
30
- - **Node.js Servers** - EC2 + ALB + RDS + Redis for traditional apps
31
- - **Serverless Apps** - ECS Fargate + ALB + DynamoDB for scalable services
32
- - **Full-Stack Apps** - Complete frontend + backend + database stack
33
- - **API Backends** - API Gateway + Lambda + DynamoDB for serverless APIs
34
- - **WordPress** - Optimized WordPress hosting with RDS + EFS + CloudFront
35
- - **JAMstack** - Modern static sites with Lambda@Edge for SSR
36
- - **Microservices** - Multi-service architecture with service discovery
37
- - **Real-time Apps** - WebSocket API + Lambda + DynamoDB Streams
38
- - **Data Pipelines** - Kinesis + Lambda + S3 + Athena + Glue for ETL
39
- - **ML APIs** - SageMaker + API Gateway for ML inference
40
- - **Traditional Web Apps** - Session-based apps with EFS + Redis + ALB
41
-
42
- ### 🛠️ Infrastructure Builders
43
-
44
- Complete CloudFormation template builders for:
45
-
46
- - **Network** - VPC, subnets, NAT gateways, routing, security groups
47
- - **Storage** - S3 buckets with versioning, encryption, lifecycle rules, EFS
48
- - **Compute** - EC2 Auto Scaling, ECS Fargate, Lambda functions
49
- - **Database** - RDS (PostgreSQL/MySQL), DynamoDB with streams and GSIs
50
- - **Cache** - ElastiCache Redis/Memcached with replication
51
- - **CDN** - CloudFront distributions with custom domains and Lambda@Edge
52
- - **API Gateway** - HTTP, REST, and WebSocket APIs
53
- - **Queue** - SQS queues with dead letter queues
54
- - **Messaging** - SNS topics and subscriptions
55
- - **Monitoring** - CloudWatch dashboards, alarms, and log groups
56
- - **Security** - ACM certificates, WAF rules, security groups
57
-
58
- ### 🔒 Pre-Deployment Security Scanning
59
-
60
- Built-in secret detection to prevent accidental credential exposure:
61
-
62
- - **35+ Secret Patterns** - AWS keys, API tokens, private keys, database credentials
63
- - **Automatic Scanning** - Runs before every deployment
64
- - **Configurable Severity** - Block on critical, high, medium, or low findings
65
- - **CI/CD Ready** - Integrate security checks into your pipeline
66
-
67
- ```bash
68
- # Scan for secrets before deploying
69
- cloud deploy:security-scan --source ./dist
70
-
71
- # Deploy with automatic security scanning
72
- cloud deploy # Scans automatically before deployment
73
- ```
74
-
75
- ### ☁️ Direct AWS Integration
76
-
77
- No SDK, no CLI - pure AWS Signature V4 API calls:
78
-
79
- - **CloudFormation** - CreateStack, UpdateStack, DeleteStack, DescribeStacks
80
- - **S3** - PutObject, multipart upload, sync directory
81
- - **CloudFront** - Cache invalidations with wait support
82
- - **Credentials** - Resolve from env vars, ~/.aws/credentials, or IAM roles
83
-
84
- ## Quick Start
85
-
86
- ### Installation
5
+ ## Installation
87
6
 
88
7
  ```bash
89
- bun add ts-cloud
8
+ bun add @stacksjs/ts-cloud
90
9
  ```
91
10
 
92
- ### Your First Deployment
93
-
94
- Create a `cloud.config.ts`:
95
-
96
- ```typescript
97
- import { createStaticSitePreset } from 'ts-cloud/presets'
98
-
99
- export default createStaticSitePreset({
100
- name: 'My Website',
101
- slug: 'my-website',
102
- domain: 'example.com',
103
- })
104
- ```
105
-
106
- Deploy:
107
-
108
11
  ```bash
109
- bun run cloud deploy
110
- ```
111
-
112
- That's it! You now have:
113
-
114
- - ✅ S3 bucket with static website hosting
115
- - ✅ CloudFront CDN with HTTPS
116
- - ✅ Route53 DNS configuration
117
- - ✅ ACM SSL certificate
118
-
119
- ### More Examples
120
-
121
- #### Full-Stack Application
122
-
123
- ```typescript
124
- import { createFullStackAppPreset } from 'ts-cloud/presets'
125
-
126
- export default createFullStackAppPreset({
127
- name: 'My App',
128
- slug: 'my-app',
129
- domain: 'app.example.com',
130
- apiSubdomain: 'api.example.com',
131
- })
132
- ```
133
-
134
- Includes:
135
-
136
- - Frontend: S3 + CloudFront
137
- - Backend: ECS Fargate with auto-scaling
138
- - Database: PostgreSQL RDS with Multi-AZ
139
- - Cache: Redis ElastiCache
140
- - Queue: SQS for background jobs
141
-
142
- #### Serverless API
143
-
144
- ```typescript
145
- import { createApiBackendPreset } from 'ts-cloud/presets'
146
-
147
- export default createApiBackendPreset({
148
- name: 'My API',
149
- slug: 'my-api',
150
- domain: 'api.example.com',
151
- })
152
- ```
153
-
154
- Includes:
155
-
156
- - API Gateway HTTP API
157
- - Lambda functions with auto-scaling
158
- - DynamoDB tables with on-demand billing
159
- - CloudWatch monitoring and alarms
160
-
161
- ## Configuration
162
-
163
- ### Extending Presets
164
-
165
- You can extend any preset with custom configuration:
166
-
167
- ```typescript
168
- import { createNodeJsServerPreset, extendPreset } from 'ts-cloud/presets'
169
-
170
- export default extendPreset(
171
- createNodeJsServerPreset({
172
- name: 'My App',
173
- slug: 'my-app',
174
- }),
175
- {
176
- infrastructure: {
177
- compute: {
178
- server: {
179
- instanceType: 't3.large', // Upgrade instance type
180
- autoScaling: {
181
- max: 20, // Increase max instances
182
- },
183
- },
184
- },
185
- },
186
- }
187
- )
188
- ```
189
-
190
- ### Composing Presets
191
-
192
- Combine multiple presets:
193
-
194
- ```typescript
195
- import { composePresets, createStaticSitePreset, createApiBackendPreset } from 'ts-cloud/presets'
196
-
197
- export default composePresets(
198
- createStaticSitePreset({ name: 'Frontend', slug: 'frontend', domain: 'example.com' }),
199
- createApiBackendPreset({ name: 'Backend', slug: 'backend' }),
200
- {
201
- // Custom overrides
202
- infrastructure: {
203
- monitoring: {
204
- alarms: [{ metric: 'Errors', threshold: 10 }],
205
- },
206
- },
207
- }
208
- )
12
+ npm install @stacksjs/ts-cloud
209
13
  ```
210
14
 
211
- ## Advanced Usage
212
-
213
- ### Custom CloudFormation
214
-
215
- Generate templates programmatically:
216
-
217
- ```typescript
218
- import { CloudFormationBuilder } from 'ts-cloud/cloudformation'
219
-
220
- const builder = new CloudFormationBuilder(config)
221
- const template = builder.build()
222
-
223
- console.log(JSON.stringify(template, null, 2))
224
- ```
225
-
226
- ### Direct AWS API Calls
227
-
228
- Use the AWS clients directly:
15
+ ## Usage
229
16
 
230
17
  ```typescript
231
- import { CloudFormationClient, S3Client, CloudFrontClient } from 'ts-cloud/aws'
232
-
233
- // CloudFormation
234
- const cfn = new CloudFormationClient('us-east-1')
235
- await cfn.createStack({
236
- stackName: 'my-stack',
237
- templateBody: JSON.stringify(template),
238
- })
239
-
240
- // S3
241
- const s3 = new S3Client('us-east-1')
242
- await s3.putObject({
243
- bucket: 'my-bucket',
244
- key: 'file.txt',
245
- body: 'Hello World',
246
- })
18
+ import { defineStack } from '@stacksjs/ts-cloud'
247
19
 
248
- // CloudFront
249
- const cloudfront = new CloudFrontClient()
250
- await cloudfront.createInvalidation({
251
- distributionId: 'E1234567890',
252
- paths: ['/*'],
20
+ const stack = defineStack({
21
+ name: 'my-app',
22
+ resources: {
23
+ // Define your infrastructure
24
+ },
253
25
  })
254
- ```
255
-
256
- ## DNS Providers
257
-
258
- ts-cloud supports multiple DNS providers for domain management and SSL certificate validation:
259
-
260
- ### Cloudflare
261
-
262
- 1. Log in to your [Cloudflare Dashboard](https://dash.cloudflare.com/)
263
- 2. Go to **My Profile** → **API Tokens** (or visit <https://dash.cloudflare.com/profile/api-tokens>)
264
- 3. Click **Create Token**
265
- 4. Use the **Edit zone DNS** template, or create a custom token with:
266
- - **Permissions**: Zone → DNS → Edit
267
- - **Zone Resources**: Include → All zones (or specific zones)
268
- 5. Copy the generated token
269
-
270
- ```bash
271
- export CLOUDFLARE_API_TOKEN="your-api-token-here"
272
- ```
273
-
274
- ### Porkbun
275
-
276
- 1. Log in to your [Porkbun Dashboard](https://porkbun.com/account/api)
277
- 2. Enable API access for your domain(s)
278
- 3. Generate an API key pair
279
-
280
- ```bash
281
- export PORKBUN_API_KEY="your-api-key"
282
- export PORKBUN_SECRET_KEY="your-secret-key"
283
- ```
284
-
285
- ### GoDaddy
286
-
287
- 1. Log in to [GoDaddy Developer Portal](https://developer.godaddy.com/)
288
- 2. Create a new API key
289
- 3. Note both the key and secret
290
-
291
- ```bash
292
- export GODADDY_API_KEY="your-api-key"
293
- export GODADDY_API_SECRET="your-api-secret"
294
- export GODADDY_ENVIRONMENT="production" # or "ote" for testing
295
- ```
296
-
297
- ### Route53
298
26
 
299
- Uses AWS credentials from environment or ~/.aws/credentials:
300
-
301
- ```bash
302
- export AWS_ACCESS_KEY_ID="your-access-key"
303
- export AWS_SECRET_ACCESS_KEY="your-secret-key"
304
- export AWS_REGION="us-east-1"
305
- export AWS_HOSTED_ZONE_ID="Z1234567890" # Optional
306
- ```
307
-
308
- ### CLI Usage
309
-
310
- ```bash
311
- # List domains
312
- cloud domain:list --provider cloudflare
313
-
314
- # List DNS records
315
- cloud dns:records example.com --provider cloudflare
316
-
317
- # Add a DNS record
318
- cloud dns:add example.com A 192.168.1.1 --name api --provider cloudflare
319
-
320
- # Generate SSL certificate with DNS validation
321
- cloud domain:ssl example.com --provider cloudflare
27
+ // Deploy the stack
28
+ await stack.deploy()
322
29
  ```
323
30
 
324
- ## Development
31
+ ### CLI
325
32
 
326
33
  ```bash
327
- # Install dependencies
328
- bun install
34
+ # Initialize a new project
35
+ cloud init
329
36
 
330
- # Run tests
331
- bun test
37
+ # Deploy your stack
38
+ cloud stack deploy
332
39
 
333
- # Build
334
- bun run build
40
+ # Manage resources
41
+ cloud database status
42
+ cloud cdn invalidate
43
+ cloud storage list
44
+ cloud secrets set MY_SECRET value
335
45
 
336
- # Type check
337
- bun run typecheck
46
+ # Monitoring & logs
47
+ cloud logs tail --stack my-app
48
+ cloud cost estimate
49
+ cloud status
338
50
  ```
339
51
 
340
- ## Architecture
341
-
342
- ### How It Works
343
-
344
- 1. **Configuration** - Define infrastructure in TypeScript
345
- 2. **CloudFormation Generation** - Convert config to CloudFormation templates
346
- 3. **AWS API Calls** - Direct HTTPS calls to AWS CloudFormation API
347
- 4. **Deployment** - Create/update stacks with change sets
348
- 5. **Monitoring** - Track deployment progress with real-time events
349
-
350
- ### No Dependencies
351
-
352
- ts-cloud uses **zero external dependencies** for AWS operations:
353
-
354
- - **AWS Signature V4** - Manual request signing for authentication
355
- - **Direct HTTPS** - Native `fetch()` for API calls
356
- - **Credentials** - Parse ~/.aws/credentials without SDK
357
- - **CloudFormation** - XML/JSON parsing for responses
358
-
359
- This means:
360
-
361
- - ⚡ Faster startup and execution
362
- - 📦 Smaller bundle size
363
- - 🔒 Better security (no supply chain attacks)
364
- - 🎯 Full control over AWS interactions
365
-
366
- ## Contributing
367
-
368
- Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
369
-
370
- ## Community
371
-
372
- For help, discussion about best practices, or any other conversation that would benefit from being searchable:
373
-
374
- [Discussions on GitHub](https://github.com/stacksjs/ts-cloud/discussions)
375
-
376
- For casual chit-chat with others using this package:
377
-
378
- [Join the Stacks Discord Server](https://discord.gg/stacksjs)
379
-
380
- ## Postcardware
381
-
382
- "Software that is free, but hopes for a postcard." We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.
383
-
384
- Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎
385
-
386
- ## Sponsors
387
-
388
- We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.
52
+ ## Features
389
53
 
390
- - [JetBrains](https://www.jetbrains.com/)
391
- - [The Solana Foundation](https://solana.com/)
54
+ - TypeScript-first infrastructure as code
55
+ - Full AWS CloudFormation support with type safety
56
+ - CLI for managing deployments, databases, CDN, storage, secrets, and more
57
+ - Server-based (EC2) and serverless deployment support
58
+ - DNS and SSL management
59
+ - Container and registry support
60
+ - Event-driven architecture (EventBridge, SNS, SQS)
61
+ - Scheduler, notifications, and email integration
62
+ - Environment and team management
63
+ - Cost estimation and analytics
64
+ - Cross-platform compiled binaries (Linux, macOS, Windows)
392
65
 
393
66
  ## License
394
67
 
395
- The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
396
-
397
- Made with 💙
398
-
399
- <!-- Badges -->
400
- [npm-version-src]: https://img.shields.io/npm/v/ts-cloud?style=flat-square
401
- [npm-version-href]: https://npmjs.com/package/ts-cloud
402
- [github-actions-src]: https://img.shields.io/github/actions/workflow/status/stacksjs/ts-cloud/ci.yml?style=flat-square&branch=main
403
- [github-actions-href]: https://github.com/stacksjs/ts-cloud/actions?query=workflow%3Aci
404
-
405
- <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/ts-cloud/main?style=flat-square
406
- [codecov-href]: https://codecov.io/gh/stacksjs/ts-cloud -->
68
+ MIT