@jaypie/mcp 0.3.2 → 0.4.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.
- package/dist/createMcpServer.d.ts +7 -1
- package/dist/index.js +26 -3135
- package/dist/index.js.map +1 -1
- package/dist/suite.d.ts +1 -0
- package/dist/suite.js +2442 -0
- package/dist/suite.js.map +1 -0
- package/package.json +8 -3
- package/release-notes/constructs/1.2.17.md +11 -0
- package/release-notes/fabric/0.1.2.md +11 -0
- package/release-notes/fabric/0.1.3.md +25 -0
- package/release-notes/fabric/0.1.4.md +42 -0
- package/release-notes/mcp/0.3.3.md +12 -0
- package/release-notes/mcp/0.3.4.md +36 -0
- package/release-notes/mcp/0.4.0.md +27 -0
- package/release-notes/testkit/1.2.15.md +23 -0
- package/skills/agents.md +25 -0
- package/skills/aws.md +107 -0
- package/skills/cdk.md +141 -0
- package/skills/cicd.md +152 -0
- package/skills/datadog.md +129 -0
- package/skills/debugging.md +148 -0
- package/skills/dns.md +134 -0
- package/skills/dynamodb.md +140 -0
- package/skills/errors.md +142 -0
- package/skills/fabric.md +191 -0
- package/skills/index.md +7 -0
- package/skills/jaypie.md +100 -0
- package/skills/legacy.md +97 -0
- package/skills/logs.md +160 -0
- package/skills/mocks.md +174 -0
- package/skills/models.md +195 -0
- package/skills/releasenotes.md +94 -0
- package/skills/secrets.md +155 -0
- package/skills/services.md +175 -0
- package/skills/style.md +190 -0
- package/skills/tests.md +209 -0
- package/skills/tools.md +127 -0
- package/skills/topics.md +116 -0
- package/skills/variables.md +146 -0
- package/skills/writing.md +153 -0
- package/prompts/Branch_Management.md +0 -34
- package/prompts/Development_Process.md +0 -89
- package/prompts/Jaypie_Agent_Rules.md +0 -110
- package/prompts/Jaypie_Auth0_Express_Mongoose.md +0 -736
- package/prompts/Jaypie_Browser_and_Frontend_Web_Packages.md +0 -18
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +0 -430
- package/prompts/Jaypie_CICD_with_GitHub_Actions.md +0 -371
- package/prompts/Jaypie_Commander_CLI_Package.md +0 -166
- package/prompts/Jaypie_Core_Errors_and_Logging.md +0 -39
- package/prompts/Jaypie_DynamoDB_Package.md +0 -774
- package/prompts/Jaypie_Eslint_NPM_Package.md +0 -78
- package/prompts/Jaypie_Express_Package.md +0 -630
- package/prompts/Jaypie_Fabric_Commander.md +0 -411
- package/prompts/Jaypie_Fabric_LLM.md +0 -312
- package/prompts/Jaypie_Fabric_Lambda.md +0 -308
- package/prompts/Jaypie_Fabric_MCP.md +0 -316
- package/prompts/Jaypie_Fabric_Package.md +0 -513
- package/prompts/Jaypie_Fabricator.md +0 -617
- package/prompts/Jaypie_Ideal_Project_Structure.md +0 -78
- package/prompts/Jaypie_Init_CICD_with_GitHub_Actions.md +0 -1186
- package/prompts/Jaypie_Init_Express_on_Lambda.md +0 -115
- package/prompts/Jaypie_Init_Jaypie_CDK_Package.md +0 -35
- package/prompts/Jaypie_Init_Lambda_Package.md +0 -505
- package/prompts/Jaypie_Init_Monorepo_Project.md +0 -44
- package/prompts/Jaypie_Init_Project_Subpackage.md +0 -65
- package/prompts/Jaypie_Legacy_Patterns.md +0 -15
- package/prompts/Jaypie_Llm_Calls.md +0 -449
- package/prompts/Jaypie_Llm_Tools.md +0 -155
- package/prompts/Jaypie_MCP_Package.md +0 -281
- package/prompts/Jaypie_Mocks_and_Testkit.md +0 -137
- package/prompts/Jaypie_Repokit.md +0 -103
- package/prompts/Jaypie_Scrub.md +0 -177
- package/prompts/Jaypie_Streaming.md +0 -467
- package/prompts/Templates_CDK_Subpackage.md +0 -115
- package/prompts/Templates_Express_Subpackage.md +0 -187
- package/prompts/Templates_Project_Monorepo.md +0 -326
- package/prompts/Templates_Project_Subpackage.md +0 -93
- package/prompts/Write_Efficient_Prompt_Guides.md +0 -48
- package/prompts/Write_and_Maintain_Engaging_Readme.md +0 -67
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: limitations of Jaypie in the frontend and project structure
|
|
3
|
-
globs: packages/nuxt/**
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Jaypie Browser and Frontend Web Packages
|
|
7
|
-
|
|
8
|
-
`@jaypie/webkit` exists as a front-end package but only wraps `@jaypie/errors`.
|
|
9
|
-
`@jaypie/core` is not compatible with the browser.
|
|
10
|
-
In particular, frontend logging does not follow Jaypie conventions.
|
|
11
|
-
|
|
12
|
-
Jaypie Nuxt apps are usually in `packages/nuxt` or similar.
|
|
13
|
-
Apps may be declaring a logger like `useLog` in `app/composables/` that can be declared with `import { useLog } from "~/composables/useLog"`
|
|
14
|
-
In this case, initialize `log = useLog()`, and call trace, debug, info, warn, and error functions with a single string message or single key-value variable. For example, log.trace("Hello") or log.debug({ name: "World" }).
|
|
15
|
-
Prefer trace for anything on the "happy path" and debug off-path.
|
|
16
|
-
Avoid console.log unless working tests.
|
|
17
|
-
This may pull from a plugin like `app/plugins/`.
|
|
18
|
-
`datadog.client.ts` may provide a logger connected to Datadog.
|
|
@@ -1,430 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Working with Jaypie CDK patterns and constructs
|
|
3
|
-
globs: packages/cdk/**
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Jaypie CDK Constructs and Patterns
|
|
7
|
-
|
|
8
|
-
Reusable AWS CDK constructs with standardized defaults and Jaypie conventions.
|
|
9
|
-
|
|
10
|
-
## Goal
|
|
11
|
-
|
|
12
|
-
Implement AWS infrastructure using Jaypie CDK constructs with consistent patterns, defaults, and tagging.
|
|
13
|
-
|
|
14
|
-
## Guidelines
|
|
15
|
-
|
|
16
|
-
CDK constructs enforce standard Jaypie conventions.
|
|
17
|
-
Environment variables prefixed with `CDK_ENV_` configure constructs.
|
|
18
|
-
All constructs apply standard tags and follow removal policies.
|
|
19
|
-
Constructs implement AWS CDK interfaces for compatibility.
|
|
20
|
-
|
|
21
|
-
## Process
|
|
22
|
-
|
|
23
|
-
### Lambda Functions
|
|
24
|
-
|
|
25
|
-
Use `JaypieLambda` for standard Lambda configurations:
|
|
26
|
-
```typescript
|
|
27
|
-
new JaypieLambda(this, "MyFunction", {
|
|
28
|
-
code: "dist",
|
|
29
|
-
handler: "index.handler",
|
|
30
|
-
timeout: Duration.seconds(30),
|
|
31
|
-
environment: { KEY: "value" }
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Features:
|
|
36
|
-
- Automatic Datadog integration when `DATADOG_API_KEY_ARN` or `CDK_ENV_DATADOG_API_KEY_ARN` exists
|
|
37
|
-
- Default environment variables from `PROJECT_*` settings
|
|
38
|
-
- Provisioned concurrency support via `provisionedConcurrentExecutions`
|
|
39
|
-
- Secrets management via `secrets` array (JaypieEnvSecret[])
|
|
40
|
-
- Direct secret integration via `envSecrets` object
|
|
41
|
-
- Parameter Store/Secrets Manager layer via `paramsAndSecrets`
|
|
42
|
-
- VPC, security groups, filesystem, and all standard Lambda configuration options
|
|
43
|
-
|
|
44
|
-
### Queue-Lambda Patterns
|
|
45
|
-
|
|
46
|
-
Use `JaypieQueuedLambda` for SQS-triggered Lambdas:
|
|
47
|
-
```typescript
|
|
48
|
-
new JaypieQueuedLambda(this, "Worker", {
|
|
49
|
-
code: "dist",
|
|
50
|
-
fifo: true,
|
|
51
|
-
batchSize: 10,
|
|
52
|
-
visibilityTimeout: Duration.seconds(900)
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Features:
|
|
57
|
-
- Auto-creates SQS queue and connects to Lambda
|
|
58
|
-
- Implements both `lambda.IFunction` and `sqs.IQueue` interfaces
|
|
59
|
-
- Auto-injects `CDK_ENV_QUEUE_URL` environment variable
|
|
60
|
-
- Grants consume and send permissions to Lambda
|
|
61
|
-
|
|
62
|
-
Use `JaypieBucketQueuedLambda` for S3-triggered processing:
|
|
63
|
-
```typescript
|
|
64
|
-
new JaypieBucketQueuedLambda(this, "Processor", {
|
|
65
|
-
code: "dist",
|
|
66
|
-
bucketName: "my-bucket",
|
|
67
|
-
bucketOptions: { versioned: true } // Optional S3 configuration
|
|
68
|
-
});
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Features:
|
|
72
|
-
- Extends `JaypieQueuedLambda` with S3 bucket and event notifications
|
|
73
|
-
- Forces non-FIFO queue (S3 limitation)
|
|
74
|
-
- Auto-injects `CDK_ENV_BUCKET_NAME` environment variable
|
|
75
|
-
- Grants read/write permissions to Lambda
|
|
76
|
-
- Implements `s3.IBucket` interface
|
|
77
|
-
|
|
78
|
-
### API Gateway
|
|
79
|
-
|
|
80
|
-
Use `JaypieApiGateway` for REST APIs with custom domains:
|
|
81
|
-
```typescript
|
|
82
|
-
new JaypieApiGateway(this, "Api", {
|
|
83
|
-
handler: lambdaFunction,
|
|
84
|
-
host: "api.example.com",
|
|
85
|
-
zone: "example.com"
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Configures SSL certificates and Route53 records automatically.
|
|
90
|
-
|
|
91
|
-
### Express Lambda
|
|
92
|
-
|
|
93
|
-
Use `JaypieExpressLambda` for Express.js applications:
|
|
94
|
-
```typescript
|
|
95
|
-
new JaypieExpressLambda(this, "ExpressApp", {
|
|
96
|
-
code: "dist",
|
|
97
|
-
handler: "app.handler"
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Preconfigured with API-optimized timeouts and role tags.
|
|
102
|
-
|
|
103
|
-
### Streaming Lambda Functions
|
|
104
|
-
|
|
105
|
-
For streaming responses (SSE, real-time updates), use `createLambdaStreamHandler` from `@jaypie/express` with `JaypieDistribution`:
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
import { JaypieExpressLambda, JaypieDistribution } from "@jaypie/constructs";
|
|
109
|
-
|
|
110
|
-
// Create Lambda (handler uses createLambdaStreamHandler internally)
|
|
111
|
-
const streamingApi = new JaypieExpressLambda(this, "StreamingApi", {
|
|
112
|
-
code: "dist/api",
|
|
113
|
-
handler: "index.handler",
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Use with CloudFront and streaming enabled
|
|
117
|
-
new JaypieDistribution(this, "Distribution", {
|
|
118
|
-
handler: streamingApi,
|
|
119
|
-
streaming: true,
|
|
120
|
-
host: "api.example.com",
|
|
121
|
-
zone: "example.com",
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
For direct Function URL access (bypass CloudFront):
|
|
126
|
-
```typescript
|
|
127
|
-
import { FunctionUrlAuthType, InvokeMode } from "aws-cdk-lib/aws-lambda";
|
|
128
|
-
|
|
129
|
-
const streamingLambda = new JaypieLambda(this, "StreamingFunction", {
|
|
130
|
-
code: "dist",
|
|
131
|
-
handler: "stream.handler",
|
|
132
|
-
timeout: Duration.minutes(5),
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const functionUrl = streamingLambda.addFunctionUrl({
|
|
136
|
-
authType: FunctionUrlAuthType.NONE,
|
|
137
|
-
invokeMode: InvokeMode.RESPONSE_STREAM, // Direct Function URL still uses InvokeMode
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
new cdk.CfnOutput(this, "StreamingUrl", { value: functionUrl.url });
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Note: Streaming requires Lambda Function URLs (not API Gateway). `JaypieDistribution` uses Function URLs by default and accepts `streaming: true` for a cleaner API.
|
|
144
|
-
|
|
145
|
-
### Stack Types
|
|
146
|
-
|
|
147
|
-
Always extend Jaypie stack classes instead of raw CDK classes:
|
|
148
|
-
|
|
149
|
-
| Use | Instead of |
|
|
150
|
-
|-----|------------|
|
|
151
|
-
| `JaypieAppStack` | `cdk.Stack` |
|
|
152
|
-
| `JaypieInfrastructureStack` | `cdk.Stack` |
|
|
153
|
-
|
|
154
|
-
Jaypie stacks automatically configure:
|
|
155
|
-
- `env` with `CDK_DEFAULT_ACCOUNT` and `CDK_DEFAULT_REGION` (required for context providers)
|
|
156
|
-
- Standard tagging
|
|
157
|
-
- Removal policies based on environment
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
new JaypieAppStack(scope, "AppStack"); // Application resources
|
|
161
|
-
new JaypieInfrastructureStack(scope, "InfraStack"); // Infrastructure resources
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
#### Error: Using cdk.Stack with Context Providers
|
|
165
|
-
|
|
166
|
-
Using `cdk.Stack` directly with constructs that need context providers causes:
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
ValidationError: Cannot retrieve value from context provider hosted-zone since
|
|
170
|
-
account/region are not specified at the stack level.
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
**Solution:** Change the base class:
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
// Wrong
|
|
177
|
-
import * as cdk from "aws-cdk-lib";
|
|
178
|
-
export class AppStack extends cdk.Stack { ... }
|
|
179
|
-
|
|
180
|
-
// Correct
|
|
181
|
-
import { JaypieAppStack } from "@jaypie/constructs";
|
|
182
|
-
export class AppStack extends JaypieAppStack { ... }
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Secrets Management
|
|
186
|
-
|
|
187
|
-
Use `JaypieEnvSecret` for cross-stack secret sharing:
|
|
188
|
-
```typescript
|
|
189
|
-
// Shorthand: if API_KEY exists in process.env, uses it as envKey
|
|
190
|
-
// Creates construct with id "EnvSecret_API_KEY"
|
|
191
|
-
new JaypieEnvSecret(this, "API_KEY");
|
|
192
|
-
|
|
193
|
-
// Explicit configuration
|
|
194
|
-
new JaypieEnvSecret(this, "ApiKey", {
|
|
195
|
-
envKey: "API_KEY",
|
|
196
|
-
provider: true, // Exports for other stacks (default: PROJECT_ENV=sandbox)
|
|
197
|
-
consumer: false, // Imports from provider stack (default: PROJECT_ENV=personal)
|
|
198
|
-
value: "secret-value", // Direct value (alternative to envKey)
|
|
199
|
-
generateSecretString: {}, // Auto-generate secret
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
Provider/consumer pattern:
|
|
204
|
-
- Provider stacks (sandbox) create and export secrets
|
|
205
|
-
- Consumer stacks (personal/ephemeral) import secrets by name
|
|
206
|
-
- Export name format: `env-${PROJECT_ENV}-${PROJECT_KEY}-${id}`
|
|
207
|
-
|
|
208
|
-
### Web Hosting
|
|
209
|
-
|
|
210
|
-
Use `JaypieWebDeploymentBucket` for static sites:
|
|
211
|
-
```typescript
|
|
212
|
-
new JaypieWebDeploymentBucket(this, "WebSite", {
|
|
213
|
-
host: "www.example.com",
|
|
214
|
-
zone: "example.com",
|
|
215
|
-
certificate: true // Creates new cert; can pass ICertificate or false
|
|
216
|
-
});
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
Features:
|
|
220
|
-
- Creates S3 bucket with website hosting enabled
|
|
221
|
-
- Creates CloudFront distribution with SSL certificate
|
|
222
|
-
- Creates Route53 DNS records
|
|
223
|
-
- Auto-creates GitHub deployment role when `CDK_ENV_REPO` is set
|
|
224
|
-
- Production environments get optimized caching (index.html excluded)
|
|
225
|
-
- Implements `s3.IBucket` interface
|
|
226
|
-
- Can use `CDK_ENV_WEB_HOST` or `CDK_ENV_WEB_SUBDOMAIN` + hosted zone
|
|
227
|
-
|
|
228
|
-
### Hosted Zones
|
|
229
|
-
|
|
230
|
-
Use `JaypieHostedZone` for DNS with query logging:
|
|
231
|
-
```typescript
|
|
232
|
-
new JaypieHostedZone(this, "Zone", {
|
|
233
|
-
zoneName: "example.com"
|
|
234
|
-
});
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
## Environment Variables
|
|
238
|
-
|
|
239
|
-
Configure constructs via environment:
|
|
240
|
-
|
|
241
|
-
### API Configuration
|
|
242
|
-
- `CDK_ENV_API_HOST_NAME`: Full API domain name
|
|
243
|
-
- `CDK_ENV_API_SUBDOMAIN`: API subdomain (combined with CDK_ENV_API_HOSTED_ZONE)
|
|
244
|
-
- `CDK_ENV_API_HOSTED_ZONE`: API hosted zone
|
|
245
|
-
|
|
246
|
-
### Web Configuration
|
|
247
|
-
- `CDK_ENV_WEB_HOST`: Full web domain name
|
|
248
|
-
- `CDK_ENV_WEB_SUBDOMAIN`: Web subdomain (combined with CDK_ENV_WEB_HOSTED_ZONE)
|
|
249
|
-
- `CDK_ENV_WEB_HOSTED_ZONE`: Web hosted zone
|
|
250
|
-
|
|
251
|
-
### General DNS
|
|
252
|
-
- `CDK_ENV_HOSTED_ZONE`: Fallback hosted zone (used by API and Web if specific zones not set)
|
|
253
|
-
|
|
254
|
-
### Deployment
|
|
255
|
-
- `CDK_ENV_REPO`: GitHub repository for deployment roles (format: owner/repo)
|
|
256
|
-
|
|
257
|
-
### Datadog Integration
|
|
258
|
-
- `DATADOG_API_KEY_ARN`: Datadog API key secret ARN (primary)
|
|
259
|
-
- `CDK_ENV_DATADOG_API_KEY_ARN`: Datadog API key secret ARN (fallback)
|
|
260
|
-
- `CDK_ENV_DATADOG_ROLE_ARN`: Datadog IAM role ARN for extended permissions
|
|
261
|
-
|
|
262
|
-
### Project Configuration
|
|
263
|
-
- `PROJECT_ENV`: Environment name (sandbox, production, personal, etc.)
|
|
264
|
-
- `PROJECT_KEY`: Project identifier
|
|
265
|
-
- `PROJECT_SERVICE`: Service name
|
|
266
|
-
- `PROJECT_SPONSOR`: Cost allocation tag
|
|
267
|
-
- `PROJECT_NONCE`: Unique identifier for ephemeral builds
|
|
268
|
-
|
|
269
|
-
### Infrastructure Tracking
|
|
270
|
-
- `CDK_ENV_INFRASTRUCTURE_STACK_SHA`: Git SHA for infrastructure stack tagging
|
|
271
|
-
|
|
272
|
-
### Auto-Injected (Set by Constructs)
|
|
273
|
-
- `CDK_ENV_BUCKET_NAME`: S3 bucket name (set by JaypieBucketQueuedLambda)
|
|
274
|
-
- `CDK_ENV_QUEUE_URL`: SQS queue URL (set by JaypieQueuedLambda)
|
|
275
|
-
|
|
276
|
-
## Helper Functions
|
|
277
|
-
|
|
278
|
-
Use helper utilities:
|
|
279
|
-
```typescript
|
|
280
|
-
import { constructStackName, constructEnvName, isEnv } from "@jaypie/constructs";
|
|
281
|
-
|
|
282
|
-
const stackName = constructStackName("app"); // project-env-app
|
|
283
|
-
const resourceName = constructEnvName("bucket"); // project-env-bucket
|
|
284
|
-
const isProduction = isEnv("production");
|
|
285
|
-
```
|
|
286
|
-
|
|
287
|
-
## Additional Helper Functions
|
|
288
|
-
|
|
289
|
-
Available from `@jaypie/constructs`:
|
|
290
|
-
|
|
291
|
-
```typescript
|
|
292
|
-
import {
|
|
293
|
-
isProductionEnv,
|
|
294
|
-
isSandboxEnv,
|
|
295
|
-
jaypieLambdaEnv,
|
|
296
|
-
constructTagger,
|
|
297
|
-
resolveHostedZone,
|
|
298
|
-
resolveDatadogLayers,
|
|
299
|
-
resolveDatadogForwarderFunction,
|
|
300
|
-
resolveDatadogLoggingDestination,
|
|
301
|
-
resolveParamsAndSecrets,
|
|
302
|
-
extendDatadogRole,
|
|
303
|
-
envHostname,
|
|
304
|
-
isValidHostname,
|
|
305
|
-
isValidSubdomain,
|
|
306
|
-
mergeDomain,
|
|
307
|
-
} from "@jaypie/constructs";
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Common usage:
|
|
311
|
-
- `isProductionEnv()`: Returns true if PROJECT_ENV is production
|
|
312
|
-
- `isSandboxEnv()`: Returns true if PROJECT_ENV is sandbox
|
|
313
|
-
- `jaypieLambdaEnv({ initialEnvironment })`: Merges PROJECT_* vars into Lambda env
|
|
314
|
-
- `resolveHostedZone(scope, { zone })`: Gets IHostedZone from string or object
|
|
315
|
-
- `extendDatadogRole(lambda)`: Adds Datadog IAM permissions when CDK_ENV_DATADOG_ROLE_ARN set
|
|
316
|
-
|
|
317
|
-
### DynamoDB Tables
|
|
318
|
-
|
|
319
|
-
Use `JaypieDynamoDb` for single-table design with Jaypie patterns:
|
|
320
|
-
```typescript
|
|
321
|
-
// Shorthand: tableName becomes "myApp", construct id is "JaypieDynamoDb-myApp"
|
|
322
|
-
const table = new JaypieDynamoDb(this, "myApp");
|
|
323
|
-
|
|
324
|
-
// With standard Jaypie GSIs (indexScope, indexAlias, indexClass, indexType, indexXid)
|
|
325
|
-
const tableWithIndexes = new JaypieDynamoDb(this, "myApp", {
|
|
326
|
-
indexes: JaypieDynamoDb.DEFAULT_INDEXES,
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
// With custom indexes using IndexDefinition from @jaypie/fabric
|
|
330
|
-
const customTable = new JaypieDynamoDb(this, "myApp", {
|
|
331
|
-
indexes: [
|
|
332
|
-
{ pk: ["scope", "model"], sk: ["sequence"] }, // indexScopeModel
|
|
333
|
-
{ pk: ["scope", "model", "type"], sparse: true }, // indexScopeModelType
|
|
334
|
-
{ name: "byAlias", pk: ["alias"], sk: ["createdAt"] }, // custom name
|
|
335
|
-
],
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// Connect table to Lambda
|
|
339
|
-
new JaypieLambda(this, "Worker", {
|
|
340
|
-
code: "dist",
|
|
341
|
-
tables: [table], // Grants read/write, sets DYNAMODB_TABLE_NAME
|
|
342
|
-
});
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
Features:
|
|
346
|
-
- Default partition key: `model` (string), sort key: `id` (string)
|
|
347
|
-
- PAY_PER_REQUEST billing mode by default
|
|
348
|
-
- RETAIN removal policy in production, DESTROY otherwise
|
|
349
|
-
- No GSIs by default - use `indexes` prop to add them
|
|
350
|
-
- `JaypieDynamoDb.DEFAULT_INDEXES` provides standard Jaypie GSIs from `@jaypie/fabric`
|
|
351
|
-
- Uses `IndexDefinition` from `@jaypie/fabric` for GSI configuration
|
|
352
|
-
- Implements `ITableV2` interface
|
|
353
|
-
|
|
354
|
-
For single-table design patterns, key builders, and query utilities, see `Jaypie_DynamoDB_Package.md`.
|
|
355
|
-
|
|
356
|
-
### Next.js Applications
|
|
357
|
-
|
|
358
|
-
Use `JaypieNextJs` for Next.js deployments with CloudFront and custom domains:
|
|
359
|
-
```typescript
|
|
360
|
-
const nextjs = new JaypieNextJs(this, "Web", {
|
|
361
|
-
domainName: "app.example.com",
|
|
362
|
-
hostedZone: "example.com",
|
|
363
|
-
nextjsPath: "../nextjs", // Path to Next.js project
|
|
364
|
-
environment: ["NODE_ENV", { CUSTOM_VAR: "value" }],
|
|
365
|
-
secrets: ["AUTH0_CLIENT_SECRET", "AUTH0_SECRET"],
|
|
366
|
-
tables: [dynamoTable],
|
|
367
|
-
});
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
Features:
|
|
371
|
-
- Uses `cdk-nextjs-standalone` under the hood
|
|
372
|
-
- CloudFront distribution with SSL certificate
|
|
373
|
-
- Custom domain via Route53
|
|
374
|
-
- Automatic Datadog integration
|
|
375
|
-
- Parameter Store/Secrets Manager layer
|
|
376
|
-
- Server-side function with secrets and tables access
|
|
377
|
-
- NEXT_PUBLIC_* environment variables automatically included
|
|
378
|
-
- `domainName` accepts string or config object: `{ component, domain, env, subdomain }`
|
|
379
|
-
|
|
380
|
-
Properties exposed:
|
|
381
|
-
- `bucket`: S3 bucket for static assets
|
|
382
|
-
- `distribution`: CloudFront distribution
|
|
383
|
-
- `domain`: Route53 domain configuration
|
|
384
|
-
- `serverFunction`: Next.js server Lambda function
|
|
385
|
-
- `imageOptimizationFunction`: Image optimization Lambda
|
|
386
|
-
- `url`: CloudFront distribution URL
|
|
387
|
-
|
|
388
|
-
## Additional Constructs
|
|
389
|
-
|
|
390
|
-
Other constructs available but not commonly used:
|
|
391
|
-
|
|
392
|
-
### Base and Infrastructure
|
|
393
|
-
- `JaypieStack`: Base stack with standard tagging and configuration
|
|
394
|
-
|
|
395
|
-
### Specialized Secrets
|
|
396
|
-
- `JaypieDatadogSecret`: Datadog API key secret management
|
|
397
|
-
- `JaypieMongoDbSecret`: MongoDB connection string secret
|
|
398
|
-
- `JaypieOpenAiSecret`: OpenAI API key secret
|
|
399
|
-
- `JaypieTraceSigningKeySecret`: Trace signing key secret
|
|
400
|
-
|
|
401
|
-
### DNS and Networking
|
|
402
|
-
- `JaypieDnsRecord`: Create individual DNS records in hosted zones
|
|
403
|
-
|
|
404
|
-
### Deployment and CI/CD
|
|
405
|
-
- `JaypieGitHubDeployRole`: GitHub Actions OIDC deployment role
|
|
406
|
-
|
|
407
|
-
### Event-Driven
|
|
408
|
-
- `JaypieEventsRule`: EventBridge rules with standard configuration
|
|
409
|
-
|
|
410
|
-
### Advanced Features
|
|
411
|
-
- `JaypieNextJs`: Next.js application deployment (uses cdk-nextjs-standalone)
|
|
412
|
-
- `JaypieDatadogForwarder`: Datadog log forwarder Lambda setup
|
|
413
|
-
- `JaypieOrganizationTrail`: CloudTrail organization-wide trail
|
|
414
|
-
- `JaypieSsoPermissions`: AWS IAM Identity Center permission sets
|
|
415
|
-
- `JaypieSsoSyncApplication`: SSO sync application for Google Workspace
|
|
416
|
-
- `JaypieAccountLoggingBucket`: Account-level centralized logging bucket
|
|
417
|
-
- `JaypieDatadogBucket`: Datadog-specific S3 bucket
|
|
418
|
-
- `JaypieStaticWebBucket`: Static web bucket (simpler than JaypieWebDeploymentBucket)
|
|
419
|
-
- `JaypieDistribution`: CloudFront distribution construct
|
|
420
|
-
|
|
421
|
-
## Tagging Strategy
|
|
422
|
-
|
|
423
|
-
Constructs apply standard tags:
|
|
424
|
-
- `role`: Resource role (api, processing, networking, hosting, deploy, monitoring, security, storage, stack)
|
|
425
|
-
- `vendor`: External service provider (auth0, datadog, mongodb, openai, knowtrace)
|
|
426
|
-
- `service`: Service category (datadog, infrastructure, libraries, sso, trace)
|
|
427
|
-
- `sponsor`: Cost allocation
|
|
428
|
-
- `project`: Project identifier (from PROJECT_KEY)
|
|
429
|
-
- `env`: Environment name (from PROJECT_ENV)
|
|
430
|
-
- `stackSha`: Git SHA for infrastructure stacks (from CDK_ENV_INFRASTRUCTURE_STACK_SHA)
|