@aws/nx-plugin-mcp 1.0.0-rc.22 → 1.0.0-rc.24
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/bin/aws-nx-mcp.js +17 -17
- package/docs/guides/agentcore-gateway.mdx +4 -4
- package/docs/guides/connection/agentcore-gateway-gateway.mdx +4 -4
- package/docs/guides/connection/agentcore-gateway-mcp.mdx +5 -5
- package/docs/guides/connection/py-agent-a2a.mdx +5 -5
- package/docs/guides/connection/py-agent-dynamodb.mdx +1 -1
- package/docs/guides/connection/py-agent-gateway.mdx +7 -7
- package/docs/guides/connection/py-agent-mcp.mdx +4 -4
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +1 -1
- package/docs/guides/connection/py-mcp-server-dynamodb.mdx +1 -1
- package/docs/guides/connection/react-agui.mdx +4 -4
- package/docs/guides/connection/react-fastapi.mdx +2 -2
- package/docs/guides/connection/react-py-agent.mdx +3 -3
- package/docs/guides/connection/react-smithy.mdx +2 -2
- package/docs/guides/connection/react-ts-agent.mdx +5 -5
- package/docs/guides/connection/smithy-dynamodb.mdx +1 -1
- package/docs/guides/connection/smithy-rdb.mdx +3 -3
- package/docs/guides/connection/trpc-dynamodb.mdx +1 -1
- package/docs/guides/connection/trpc-rdb.mdx +3 -3
- package/docs/guides/connection/ts-agent-a2a.mdx +5 -5
- package/docs/guides/connection/ts-agent-dynamodb.mdx +1 -1
- package/docs/guides/connection/ts-agent-gateway.mdx +6 -6
- package/docs/guides/connection/ts-agent-mcp.mdx +4 -4
- package/docs/guides/connection/ts-agent-rdb.mdx +3 -3
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +1 -1
- package/docs/guides/connection/ts-mcp-server-rdb.mdx +3 -3
- package/docs/guides/connection.mdx +1 -1
- package/docs/guides/fastapi.mdx +6 -0
- package/docs/guides/local-development.mdx +20 -9
- package/docs/guides/nx-generator.mdx +2 -2
- package/docs/guides/py-agent.mdx +9 -5
- package/docs/guides/py-dynamodb.mdx +4 -4
- package/docs/guides/py-mcp-server.mdx +11 -1
- package/docs/guides/react-website-auth.mdx +36 -0
- package/docs/guides/react-website.mdx +22 -14
- package/docs/guides/trpc.mdx +6 -0
- package/docs/guides/ts-agent.mdx +9 -5
- package/docs/guides/ts-dynamodb.mdx +4 -4
- package/docs/guides/ts-mcp-server.mdx +11 -1
- package/docs/guides/ts-rdb.mdx +5 -4
- package/docs/guides/ts-smithy-api.mdx +4 -0
- package/docs/guides/typescript-infrastructure.mdx +1 -1
- package/docs/snippets/api/access-logging.mdx +33 -0
- package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
- package/docs/snippets/connection/py-dynamodb-local-development.mdx +2 -2
- package/docs/snippets/dynamodb/gsi-config.mdx +1 -1
- package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
- package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
- package/package.json +1 -1
- package/src/preset/schema.json +0 -5
- package/src/ts/react-website/app/schema.json +6 -6
- package/src/ts/website/app/schema.json +6 -6
- package/docs/snippets/dynamodb/serve-local-start.mdx +0 -13
- package/docs/snippets/dynamodb/serve-local-windows.mdx +0 -15
|
@@ -46,7 +46,7 @@ The generator modifies two files in your agent's source directory:
|
|
|
46
46
|
|
|
47
47
|
</FileTree>
|
|
48
48
|
|
|
49
|
-
Additionally, the agent's `<agent-name>-
|
|
49
|
+
Additionally, the agent's `<agent-name>-dev` target is updated to depend on the database's `dev` target.
|
|
50
50
|
|
|
51
51
|
## How It Works
|
|
52
52
|
|
|
@@ -136,6 +136,6 @@ Ensure the agent's execution role has `rds-db:connect` permission and that its s
|
|
|
136
136
|
|
|
137
137
|
## Local Development
|
|
138
138
|
|
|
139
|
-
<NxCommands commands={["<agent-name>-
|
|
139
|
+
<NxCommands commands={["<agent-name>-dev <project-name>"]} />
|
|
140
140
|
|
|
141
|
-
This starts the agent and all connected databases. The `
|
|
141
|
+
This starts the agent and all connected databases. The `LOCAL_DEV=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
|
|
@@ -35,7 +35,7 @@ Select your MCP server project as the source and your DynamoDB project as the ta
|
|
|
35
35
|
|
|
36
36
|
## Generator Output
|
|
37
37
|
|
|
38
|
-
The generator updates the MCP server's `<mcp-server-name>-
|
|
38
|
+
The generator updates the MCP server's `<mcp-server-name>-dev` target in `project.json` to depend on the DynamoDB project's `dev` target. No source files are modified.
|
|
39
39
|
|
|
40
40
|
## Using DynamoDB in Tools
|
|
41
41
|
|
|
@@ -46,7 +46,7 @@ The generator modifies two files in your MCP server's source directory:
|
|
|
46
46
|
|
|
47
47
|
</FileTree>
|
|
48
48
|
|
|
49
|
-
Additionally, the `<mcp-server-name>-
|
|
49
|
+
Additionally, the `<mcp-server-name>-dev` target is updated to depend on the database's `dev` target.
|
|
50
50
|
|
|
51
51
|
## How It Works
|
|
52
52
|
|
|
@@ -130,6 +130,6 @@ Ensure the MCP server's execution role has `rds-db:connect` permission and that
|
|
|
130
130
|
|
|
131
131
|
## Local Development
|
|
132
132
|
|
|
133
|
-
<NxCommands commands={["<mcp-server-name>-
|
|
133
|
+
<NxCommands commands={["<mcp-server-name>-dev <project-name>"]} />
|
|
134
134
|
|
|
135
|
-
This starts the MCP server and all connected databases. The `
|
|
135
|
+
This starts the MCP server and all connected databases. The `LOCAL_DEV=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
|
|
@@ -211,5 +211,5 @@ The connection generator makes use of <Link path="guides/runtime-config">Runtime
|
|
|
211
211
|
:::
|
|
212
212
|
|
|
213
213
|
:::tip[Local Development]
|
|
214
|
-
Connected projects can be run on your machine with the `serve` and `
|
|
214
|
+
Connected projects can be run on your machine with the `serve` and `dev` targets. See the <Link path="guides/local-development">Local Development</Link> guide for details.
|
|
215
215
|
:::
|
package/docs/guides/fastapi.mdx
CHANGED
|
@@ -618,6 +618,12 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
618
618
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
619
619
|
</OptionFilter>
|
|
620
620
|
|
|
621
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Access logging — REST APIs log requests to CloudWatch by default">
|
|
622
|
+
### Access logging
|
|
623
|
+
|
|
624
|
+
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
625
|
+
</OptionFilter>
|
|
626
|
+
|
|
621
627
|
### Integrations
|
|
622
628
|
|
|
623
629
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Local Development
|
|
3
|
-
description: How local development works with the serve and
|
|
3
|
+
description: How local development works with the serve and dev targets
|
|
4
4
|
---
|
|
5
5
|
import Link from '@components/link.astro';
|
|
6
6
|
import NxCommands from '@components/nx-commands.astro';
|
|
7
7
|
import PackageManagerShortCommand from '@components/package-manager-short-command.astro';
|
|
8
8
|
|
|
9
|
-
Connected projects expose two targets for running them on your machine: `serve` and `
|
|
9
|
+
Connected projects expose two targets for running them on your machine: `serve` and `dev`. The difference is one of **scope** — how much of your application runs locally versus pointing at deployed AWS infrastructure.
|
|
10
10
|
|
|
11
11
|
Consider a workspace with the following connections: a website that calls a tRPC `api`, and also calls an `agent` which in turn calls an `mcp` server.
|
|
12
12
|
|
|
@@ -39,13 +39,13 @@ deployed.agent -> deployed.mcp
|
|
|
39
39
|
|
|
40
40
|
Use `serve` when you want to iterate on a single project against the "real", deployed versions of everything it depends on.
|
|
41
41
|
|
|
42
|
-
## `
|
|
42
|
+
## `dev`
|
|
43
43
|
|
|
44
|
-
The `
|
|
44
|
+
The `dev` target runs the **targeted project** and **every project connected to it transitively**, all on your machine. The connection generator wires this up automatically — running `dev` on the website also starts local servers for the `api`, the `agent`, and the `mcp` server it reaches through the agent.
|
|
45
45
|
|
|
46
|
-
<NxCommands commands={['
|
|
46
|
+
<NxCommands commands={['dev website']} />
|
|
47
47
|
|
|
48
|
-
When run this way, the website's `runtime-config.json` is automatically overridden (via [Vite's `MODE`](https://vite.dev/guide/env-and-mode), set to `
|
|
48
|
+
When run this way, the website's `runtime-config.json` is automatically overridden (via [Vite's `MODE`](https://vite.dev/guide/env-and-mode), set to `local-dev`) so that it points at your locally running servers instead of deployed URLs.
|
|
49
49
|
|
|
50
50
|
```d2
|
|
51
51
|
direction: right
|
|
@@ -65,10 +65,21 @@ local: Local {
|
|
|
65
65
|
|
|
66
66
|
Every project runs locally, so there are no deployed dependencies.
|
|
67
67
|
|
|
68
|
-
Use `
|
|
68
|
+
Use `dev` when you are working across several connected projects at once and want to iterate quickly without deploying your infrastructure.
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
### Projects with multiple components
|
|
71
|
+
|
|
72
|
+
Some project types can hold multiple components in a single project (for example a TypeScript or Python project containing several agents and MCP servers). For these:
|
|
73
|
+
|
|
74
|
+
- The project-level `dev` target starts **all** of the project's components together. Each component is added to `dev` as it is generated:
|
|
75
|
+
|
|
76
|
+
<NxCommands commands={['dev my-project']} />
|
|
77
|
+
- Each component also exposes a `<component-name>-dev` target, so you can run a single component on its own:
|
|
78
|
+
|
|
79
|
+
<NxCommands commands={['my-component-dev my-project']} />
|
|
80
|
+
|
|
81
|
+
:::tip[Workspace `dev` script]
|
|
82
|
+
Your workspace's root `package.json` includes a `dev` script that runs `nx run-many --target dev`, starting the `dev` target for every project that has one. Spin up your whole workspace's local development servers with:
|
|
72
83
|
|
|
73
84
|
<PackageManagerShortCommand commands={["dev"]} />
|
|
74
85
|
:::
|
|
@@ -286,7 +286,7 @@ import { generateFiles, joinPathFragments } from '@nx/devkit';
|
|
|
286
286
|
// Generate files from templates
|
|
287
287
|
generateFiles(
|
|
288
288
|
tree,
|
|
289
|
-
joinPathFragments(
|
|
289
|
+
joinPathFragments(import.meta.dirname, 'files'), // Template directory
|
|
290
290
|
'path/to/output', // Output directory
|
|
291
291
|
{
|
|
292
292
|
// Variables to replace in templates
|
|
@@ -459,7 +459,7 @@ export const myGenerator = async (tree: Tree, schema: MyGeneratorSchema) => {
|
|
|
459
459
|
|
|
460
460
|
generateFiles(
|
|
461
461
|
tree,
|
|
462
|
-
joinPathFragments(
|
|
462
|
+
joinPathFragments(import.meta.dirname, 'files'), // Template directory
|
|
463
463
|
'path/to/output', // Output directory
|
|
464
464
|
data,
|
|
465
465
|
);
|
package/docs/guides/py-agent.mdx
CHANGED
|
@@ -397,19 +397,23 @@ AG-UI agents are designed to be consumed directly by a frontend. Use the <Link p
|
|
|
397
397
|
|
|
398
398
|
### Local Development
|
|
399
399
|
|
|
400
|
-
|
|
400
|
+
To run your Agent (and everything connected to it) locally, use the project's `dev` target:
|
|
401
401
|
|
|
402
|
-
<NxCommands commands={['
|
|
402
|
+
<NxCommands commands={['dev your-project']} />
|
|
403
403
|
|
|
404
|
-
|
|
404
|
+
If you have added multiple components to your project (agents, MCP servers, etc.), this starts them all. To run just this agent, target its `<your-agent-name>-dev` target:
|
|
405
|
+
|
|
406
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
407
|
+
|
|
408
|
+
This uses `uv run` to execute your Agent using the [Bedrock AgentCore Python SDK](https://github.com/aws/bedrock-agentcore-sdk-python).
|
|
405
409
|
|
|
406
410
|
### Chat with Your Agent
|
|
407
411
|
|
|
408
412
|
The generator configures a `<your-agent-name>-chat` Nx target that drops you into an interactive terminal chat with your agent.
|
|
409
413
|
|
|
410
|
-
The chat target runs standalone. By default it connects to your locally running agent, so start `<your-agent-name>-
|
|
414
|
+
The chat target runs standalone. By default it connects to your locally running agent, so start the agent's `<your-agent-name>-dev` target first (in a separate terminal):
|
|
411
415
|
|
|
412
|
-
<NxCommands commands={['
|
|
416
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
413
417
|
|
|
414
418
|
Then, in another terminal, start the chat:
|
|
415
419
|
|
|
@@ -57,7 +57,7 @@ The local development scripts are shared across all DynamoDB projects (both Type
|
|
|
57
57
|
|
|
58
58
|
### Starting Local DynamoDB
|
|
59
59
|
|
|
60
|
-
<Snippet name="dynamodb/
|
|
60
|
+
<Snippet name="dynamodb/local-dev-start" />
|
|
61
61
|
|
|
62
62
|
### Data Modelling
|
|
63
63
|
|
|
@@ -406,8 +406,8 @@ For further reading on DynamoDB data modelling, see the [DynamoDB data modelling
|
|
|
406
406
|
|
|
407
407
|
The generated `client.py` exports two key utilities:
|
|
408
408
|
|
|
409
|
-
- `is_local()` — returns `True` when `
|
|
410
|
-
- `get_table_name()` — returns the DynamoDB table name. When `
|
|
409
|
+
- `is_local()` — returns `True` when `LOCAL_DEV=true`, used to switch between local and AWS behaviour.
|
|
410
|
+
- `get_table_name()` — returns the DynamoDB table name. When `LOCAL_DEV=true`, reads the table name from `localDev.tableName` in `config.json`; otherwise fetches the name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable and caches it for subsequent calls.
|
|
411
411
|
|
|
412
412
|
`BaseModel` in `entities/base.py` uses both to configure PynamoDB automatically:
|
|
413
413
|
|
|
@@ -416,7 +416,7 @@ The generated `client.py` exports two key utilities:
|
|
|
416
416
|
|
|
417
417
|
### Stopping Local DynamoDB
|
|
418
418
|
|
|
419
|
-
<Snippet name="dynamodb/
|
|
419
|
+
<Snippet name="dynamodb/local-dev-windows" />
|
|
420
420
|
|
|
421
421
|
## Adding/Removing Global Secondary Indexes
|
|
422
422
|
|
|
@@ -117,9 +117,19 @@ def dynamic_resource(item_id: str) -> str:
|
|
|
117
117
|
|
|
118
118
|
## Running Your MCP Server
|
|
119
119
|
|
|
120
|
+
### Local Development
|
|
121
|
+
|
|
122
|
+
To run your MCP server (and everything connected to it, such as a local database) locally, use the project's `dev` target:
|
|
123
|
+
|
|
124
|
+
<NxCommands commands={['dev your-project']} />
|
|
125
|
+
|
|
126
|
+
If you have added multiple components to your project (MCP servers, agents, etc.), this starts them all. To run just this MCP server, target its `<your-server-name>-dev` target:
|
|
127
|
+
|
|
128
|
+
<NxCommands commands={['your-server-name-dev your-project']} />
|
|
129
|
+
|
|
120
130
|
### Inspector
|
|
121
131
|
|
|
122
|
-
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-
|
|
132
|
+
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-dev` target, including any connected dependencies such as a local database) and launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) pre-configured to connect to it over Streamable HTTP transport.
|
|
123
133
|
|
|
124
134
|
<NxCommands commands={['your-server-name-inspect your-project']} />
|
|
125
135
|
|
|
@@ -98,6 +98,42 @@ cognito -> iam
|
|
|
98
98
|
browser -> backend: IAM/Cognito
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
#### Threat protection
|
|
102
|
+
|
|
103
|
+
The User Pool is created on the Cognito [Plus feature plan](https://docs.aws.amazon.com/cognito/latest/developerguide/feature-plans-features-plus.html) with [threat protection](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pool-settings-threat-protection.html) set to `AUDIT` mode for standard authentication. In audit mode, Cognito assigns a risk level to each sign-in and logs the assessment to CloudWatch without blocking users.
|
|
104
|
+
|
|
105
|
+
Once you have observed the risk assessments for your users, you can switch to full-function enforcement to automatically respond to risky activity (for example requiring MFA or blocking sign-in):
|
|
106
|
+
|
|
107
|
+
<Infrastructure>
|
|
108
|
+
<Fragment slot="cdk">
|
|
109
|
+
Set `standardThreatProtectionMode` to `StandardThreatProtectionMode.FULL_FUNCTION` in `packages/common/constructs/src/core/user-identity.ts`.
|
|
110
|
+
</Fragment>
|
|
111
|
+
<Fragment slot="terraform">
|
|
112
|
+
Set `advanced_security_mode` to `ENFORCED` in the `user_pool_add_ons` block in `packages/common/terraform/src/core/user-identity/identity/identity.tf`.
|
|
113
|
+
</Fragment>
|
|
114
|
+
</Infrastructure>
|
|
115
|
+
|
|
116
|
+
#### Web Application Firewall (WAF)
|
|
117
|
+
|
|
118
|
+
By default the User Pool is associated with an [AWS WAFv2](https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html) Web ACL using the `AWSManagedRulesCommonRuleSet` and `AWSManagedRulesKnownBadInputsRuleSet` managed rule groups. You can disable this if you wish to manage your own Web ACL or do not require one:
|
|
119
|
+
|
|
120
|
+
<Infrastructure>
|
|
121
|
+
<Fragment slot="cdk">
|
|
122
|
+
```ts
|
|
123
|
+
new UserIdentity(this, 'Identity', { enableWaf: false });
|
|
124
|
+
```
|
|
125
|
+
</Fragment>
|
|
126
|
+
<Fragment slot="terraform">
|
|
127
|
+
```hcl
|
|
128
|
+
module "user_identity" {
|
|
129
|
+
source = "../../common/terraform/src/core/user-identity"
|
|
130
|
+
|
|
131
|
+
enable_waf = false
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
</Fragment>
|
|
135
|
+
</Infrastructure>
|
|
136
|
+
|
|
101
137
|
## Infrastructure Usage
|
|
102
138
|
|
|
103
139
|
<Infrastructure>
|
|
@@ -18,12 +18,12 @@ import Infrastructure from '@components/infrastructure.astro';
|
|
|
18
18
|
import Snippet from '@components/snippet.astro';
|
|
19
19
|
import OptionFilter from '@components/option-filter.astro';
|
|
20
20
|
|
|
21
|
-
This generator creates a new [React](https://react.dev/) website with [
|
|
21
|
+
This generator creates a new [React](https://react.dev/) website with [shadcn/ui](https://ui.shadcn.com/) configured by default, along with the AWS CDK or Terraform infrastructure to deploy your website to the cloud as a static website hosted in [S3](https://aws.amazon.com/s3/), served by [CloudFront](https://aws.amazon.com/cloudfront/) and protected by [WAF](https://aws.amazon.com/waf/).
|
|
22
22
|
|
|
23
23
|
The generated application uses [Vite](https://vite.dev/) as the build tool and bundler. It uses [TanStack Router](https://tanstack.com/router/v1) for type-safe routing.
|
|
24
24
|
|
|
25
25
|
:::note[UX Provider]
|
|
26
|
-
The default `uxProvider` is [
|
|
26
|
+
The default `uxProvider` is [shadcn/ui](https://ui.shadcn.com/). You can also select [Cloudscape](http://cloudscape.design/) or `None` (bring your own component library).
|
|
27
27
|
:::
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
@@ -301,7 +301,11 @@ For Terraform projects, the `load:runtime-config` target copies the `runtime-con
|
|
|
301
301
|
|
|
302
302
|
## Local Development Server
|
|
303
303
|
|
|
304
|
-
|
|
304
|
+
The canonical command for local development is `dev`, which starts your website (and any local servers for APIs you've connected it to) with one command:
|
|
305
|
+
|
|
306
|
+
<NxCommands commands={['dev <my-website>']} />
|
|
307
|
+
|
|
308
|
+
The `serve` target is also available for when you need to control how much of your application runs locally versus pointing at deployed AWS infrastructure. For a broader overview of local development across connected projects, including how `dev` behaves for projects with multiple components, see the <Link path="guides/local-development">Local Development</Link> guide.
|
|
305
309
|
|
|
306
310
|
### Serve Target
|
|
307
311
|
|
|
@@ -313,46 +317,50 @@ You can run this target with the following command:
|
|
|
313
317
|
|
|
314
318
|
This target is useful for working on website changes while pointing to "real" deployed APIs and other infrastructure.
|
|
315
319
|
|
|
316
|
-
###
|
|
320
|
+
### Dev Target
|
|
317
321
|
|
|
318
|
-
The `
|
|
322
|
+
The `dev` target starts a local development server for your website (with [Vite `MODE`](https://vite.dev/guide/env-and-mode) set to `local-dev`), as well as starting any local servers for APIs you have connected your website to via the <Link path="/guides/connection">Connection generator</Link>.
|
|
319
323
|
|
|
320
324
|
When your local website server is run via this target, `runtime-config.json` is automatically overridden to point to your locally running API urls.
|
|
321
325
|
|
|
322
326
|
You can run this target with the following command:
|
|
323
327
|
|
|
324
|
-
<NxCommands commands={['
|
|
328
|
+
<NxCommands commands={['dev <my-website>']} />
|
|
325
329
|
|
|
326
330
|
This target is useful when you are working across your website and API and wish to quickly iterate without deploying your infrastructure.
|
|
327
331
|
|
|
328
|
-
:::note[`dev` script]
|
|
329
|
-
|
|
332
|
+
:::note[Workspace `dev` script]
|
|
333
|
+
Your workspace's root `package.json` includes a `dev` script that runs the `dev` target for every project that has one:
|
|
330
334
|
|
|
331
335
|
<PackageManagerShortCommand commands={["dev"]} />
|
|
332
336
|
|
|
333
|
-
This
|
|
337
|
+
This starts the local development server for your website (and any other projects with a `dev` target) in one command. To run just this website, use its own `dev` target (e.g. `nx dev <my-website>`).
|
|
334
338
|
:::
|
|
335
339
|
|
|
336
340
|
:::warning[Mock Authentication]
|
|
337
341
|
When run in this mode and no `runtime-config.json` is present, if you have configured Cognito Authentication (via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link>), login will be skipped and requests to your local servers will not include authentication headers.
|
|
338
342
|
|
|
339
|
-
To enable login and authentication for `
|
|
343
|
+
To enable login and authentication for `dev`, deploy your infrastructure and load runtime config.
|
|
340
344
|
:::
|
|
341
345
|
|
|
342
|
-
:::tip[
|
|
343
|
-
When running with `
|
|
346
|
+
:::tip[Dev Behavior]
|
|
347
|
+
When running with `dev`, you can specify any environment variables required by your APIs to point to other deployed AWS resources, for example:
|
|
344
348
|
|
|
345
|
-
<NxCommands env={{DYNAMODB_TABLE_NAME: 'xxxxx'}} commands={['
|
|
349
|
+
<NxCommands env={{DYNAMODB_TABLE_NAME: 'xxxxx'}} commands={['dev <my-website>']} />
|
|
346
350
|
|
|
347
351
|
Note that your local API servers will run with the AWS credentials you have configured locally.
|
|
348
352
|
:::
|
|
349
353
|
|
|
350
354
|
## Building
|
|
351
355
|
|
|
352
|
-
You can build your website using the `build` target. This
|
|
356
|
+
You can build your website using the `build` target. This runs the `bundle`, `compile`, `test` and `lint` targets, type-checking, bundling, testing and linting your website.
|
|
353
357
|
|
|
354
358
|
<NxCommands commands={['build <my-website>']} />
|
|
355
359
|
|
|
360
|
+
The `bundle` target uses Vite to create a production bundle in the root `dist/packages/<my-website>/bundle` directory. This is the deployable artifact consumed by your website infrastructure. You can run it on its own:
|
|
361
|
+
|
|
362
|
+
<NxCommands commands={['bundle <my-website>']} />
|
|
363
|
+
|
|
356
364
|
## Testing
|
|
357
365
|
|
|
358
366
|
Testing your website is much like writing tests in a standard TypeScript project, so please refer to the <Link path="guides/typescript-project#testing">TypeScript project guide</Link> for more details.
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -728,6 +728,12 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
728
728
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
729
729
|
</OptionFilter>
|
|
730
730
|
|
|
731
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Access logging — REST APIs log requests to CloudWatch by default">
|
|
732
|
+
### Access logging
|
|
733
|
+
|
|
734
|
+
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
735
|
+
</OptionFilter>
|
|
736
|
+
|
|
731
737
|
### Integrations
|
|
732
738
|
|
|
733
739
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
package/docs/guides/ts-agent.mdx
CHANGED
|
@@ -263,19 +263,23 @@ Most users will not need to modify `index.ts` — edit `agent.ts` to change tool
|
|
|
263
263
|
|
|
264
264
|
### Local Development
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
To run your Agent (and everything connected to it) locally, use the project's `dev` target:
|
|
267
267
|
|
|
268
|
-
<NxCommands commands={['
|
|
268
|
+
<NxCommands commands={['dev your-project']} />
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
If you have added multiple components to your project (agents, MCP servers, etc.), this starts them all. To run just this agent, target its `<your-agent-name>-dev` target:
|
|
271
|
+
|
|
272
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
273
|
+
|
|
274
|
+
This uses `tsx --watch` to automatically restart the server when files change. The agent will be available at `http://localhost:8081` (or the assigned port if you have multiple agents).
|
|
271
275
|
|
|
272
276
|
### Chat with Your Agent
|
|
273
277
|
|
|
274
278
|
The generator configures a `<your-agent-name>-chat` Nx target that drops you into an interactive terminal chat with your agent.
|
|
275
279
|
|
|
276
|
-
The chat target runs standalone. By default it connects to your locally running agent, so start `<your-agent-name>-
|
|
280
|
+
The chat target runs standalone. By default it connects to your locally running agent, so start the agent's `<your-agent-name>-dev` target first (in a separate terminal):
|
|
277
281
|
|
|
278
|
-
<NxCommands commands={['
|
|
282
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
279
283
|
|
|
280
284
|
Then, in another terminal, start the chat:
|
|
281
285
|
|
|
@@ -56,7 +56,7 @@ The local development scripts are shared across all DynamoDB projects (both Type
|
|
|
56
56
|
|
|
57
57
|
### Starting Local DynamoDB
|
|
58
58
|
|
|
59
|
-
<Snippet name="dynamodb/
|
|
59
|
+
<Snippet name="dynamodb/local-dev-start" />
|
|
60
60
|
|
|
61
61
|
### Data Modelling
|
|
62
62
|
|
|
@@ -118,12 +118,12 @@ For more details, see the [ElectroDB entity documentation](https://electrodb.dev
|
|
|
118
118
|
|
|
119
119
|
The generated `src/client.ts` exports two key utilities:
|
|
120
120
|
|
|
121
|
-
- `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `
|
|
122
|
-
- `resolveTableName()` — returns the DynamoDB table name. When `
|
|
121
|
+
- `getDynamoDBClient()` — returns a cached singleton `DynamoDBClient`. When `LOCAL_DEV=true`, connects to the local DynamoDB Local instance; otherwise creates an AWS client using the default credential chain.
|
|
122
|
+
- `resolveTableName()` — returns the DynamoDB table name. When `LOCAL_DEV=true`, returns the local table name constant; otherwise fetches the name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable and caches it for subsequent calls.
|
|
123
123
|
|
|
124
124
|
### Stopping Local DynamoDB
|
|
125
125
|
|
|
126
|
-
<Snippet name="dynamodb/
|
|
126
|
+
<Snippet name="dynamodb/local-dev-windows" />
|
|
127
127
|
|
|
128
128
|
## Adding/Removing Global Secondary Indexes
|
|
129
129
|
|
|
@@ -122,9 +122,19 @@ server.registerResource('dynamic-resource', 'dynamic://resource', {}, async (uri
|
|
|
122
122
|
|
|
123
123
|
## Running Your MCP Server
|
|
124
124
|
|
|
125
|
+
### Local Development
|
|
126
|
+
|
|
127
|
+
To run your MCP server (and everything connected to it, such as a local database) locally, use the project's `dev` target:
|
|
128
|
+
|
|
129
|
+
<NxCommands commands={['dev your-project']} />
|
|
130
|
+
|
|
131
|
+
If you have added multiple components to your project (MCP servers, agents, etc.), this starts them all. To run just this MCP server, target its `<your-server-name>-dev` target:
|
|
132
|
+
|
|
133
|
+
<NxCommands commands={['your-server-name-dev your-project']} />
|
|
134
|
+
|
|
125
135
|
### Inspector
|
|
126
136
|
|
|
127
|
-
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-
|
|
137
|
+
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-dev` target, including any connected dependencies such as a local database) and launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) pre-configured to connect to it over Streamable HTTP transport.
|
|
128
138
|
|
|
129
139
|
<NxCommands commands={['your-server-name-inspect your-project']} />
|
|
130
140
|
|
package/docs/guides/ts-rdb.mdx
CHANGED
|
@@ -58,7 +58,8 @@ Local development scripts are shared across all database projects and generated
|
|
|
58
58
|
- packages/common/scripts/src/rdb
|
|
59
59
|
- pull-image.ts Pulls the database container image
|
|
60
60
|
- start-container.ts Starts a local database container
|
|
61
|
-
- wait-for-db.ts Waits for the local database to be ready
|
|
61
|
+
- wait-for-postgres-db.ts Waits for the local database to be ready (PostgreSQL)
|
|
62
|
+
- wait-for-mysql-db.ts Waits for the local database to be ready (MySQL)
|
|
62
63
|
</FileTree>
|
|
63
64
|
|
|
64
65
|
### Infrastructure
|
|
@@ -218,10 +219,10 @@ The generated `prisma` target exposes the Prisma CLI, so you can use it to run a
|
|
|
218
219
|
|
|
219
220
|
### Stopping the Local Database
|
|
220
221
|
|
|
221
|
-
Stopping `
|
|
222
|
+
Stopping `dev` (e.g. with `Ctrl+C`) automatically removes the local database container, but preserves the named volume so your data persists across restarts.
|
|
222
223
|
|
|
223
224
|
:::caution[Windows]
|
|
224
|
-
Due to limitations with signal handling on Windows, the container is not automatically removed when `
|
|
225
|
+
Due to limitations with signal handling on Windows, the container is not automatically removed when `dev` is stopped. You will need to remove it manually:
|
|
225
226
|
|
|
226
227
|
```bash
|
|
227
228
|
<engine> rm -f <scope>-<db-name>
|
|
@@ -537,7 +538,7 @@ Pin a specific Aurora engine version.
|
|
|
537
538
|
|
|
538
539
|
By default, the generated local database container image matches the default Aurora engine version. If you change the Aurora engine version, it's recommended to also use a matching local container image version for maximum compatibility. See the AWS release notes for [Aurora PostgreSQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraPostgreSQLReleaseNotes/aurorapostgresql-release-calendar.html) and [Aurora MySQL versions](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraMySQLReleaseNotes/AuroraMySQL.Updates.30Updates.html) to identify the corresponding community database version.
|
|
539
540
|
|
|
540
|
-
The local database image is configured in the `
|
|
541
|
+
The local database image is configured in the `localDev.image` field of the generated `config.json` file in your database project root. Update that value when you change engine versions.
|
|
541
542
|
|
|
542
543
|
<OptionFilter when={{ engine: 'postgres' }}>
|
|
543
544
|
<Infrastructure>
|
|
@@ -730,6 +730,10 @@ output "lambda_function_name" {
|
|
|
730
730
|
|
|
731
731
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
732
732
|
|
|
733
|
+
### Access logging
|
|
734
|
+
|
|
735
|
+
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
736
|
+
|
|
733
737
|
### Integrations
|
|
734
738
|
|
|
735
739
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
|
@@ -286,7 +286,7 @@ export class ApplicationStack extends Stack {
|
|
|
286
286
|
|
|
287
287
|
### Website Infrastructure
|
|
288
288
|
|
|
289
|
-
If you have used the <Link path="guides/react-website">
|
|
289
|
+
If you have used the <Link path="guides/react-website">React Website</Link> generator, you will notice you already have a construct in `packages/common/constructs` to deploy it. For example:
|
|
290
290
|
|
|
291
291
|
```ts title="src/stacks/application-stack.ts" {3, 9-10}
|
|
292
292
|
import { Stack, StackProps } from 'aws-cdk-lib';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Access logging
|
|
3
|
+
---
|
|
4
|
+
import Infrastructure from '@components/infrastructure.astro';
|
|
5
|
+
|
|
6
|
+
For REST APIs, the generated infrastructure enables [access logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html) by default, writing one structured JSON line per request to a dedicated CloudWatch Logs group. The log group is encrypted with a customer-managed KMS key and retained for one year.
|
|
7
|
+
|
|
8
|
+
API Gateway writes access logs using an account-level CloudWatch Logs role. This role is configured on the `AWS::ApiGateway::Account` setting, which is a **singleton per region per account** — there is only one role for every REST API in the region. To manage this safely across multiple independently-deployed stacks, the generated infrastructure:
|
|
9
|
+
|
|
10
|
+
- Creates a shared CloudWatch Logs role and configures it on the account only when no working role is already set, so deployments never overwrite a role another stack owns.
|
|
11
|
+
- Leaves the account setting untouched on teardown, so destroying one stack never disables logging for other REST APIs in the region.
|
|
12
|
+
|
|
13
|
+
<Infrastructure>
|
|
14
|
+
<Fragment slot="cdk">
|
|
15
|
+
The account role is managed by the `ApiGatewayAccount` construct, a stack-scoped singleton resolved via `ApiGatewayAccount.ensure(scope)`. Each REST API's stage depends on it, and the role is configured by a Lambda-backed custom resource.
|
|
16
|
+
|
|
17
|
+
You can customise the access log format by passing `deployOptions` when constructing your API:
|
|
18
|
+
|
|
19
|
+
```ts {3-5}
|
|
20
|
+
const api = new MyApi(this, 'MyApi', {
|
|
21
|
+
integrations: MyApi.defaultIntegrations(this).build(),
|
|
22
|
+
deployOptions: {
|
|
23
|
+
accessLogFormat: AccessLogFormat.clf(),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
</Fragment>
|
|
28
|
+
<Fragment slot="terraform">
|
|
29
|
+
The account role is managed by the `core/api/api-gateway-account` module, which is instantiated by the generated API module. It configures the account idempotently and is never reset on `terraform destroy`.
|
|
30
|
+
|
|
31
|
+
You can customise the access log format by editing the `access_log_settings` block on the `aws_api_gateway_stage` resource in the generated API module.
|
|
32
|
+
</Fragment>
|
|
33
|
+
</Infrastructure>
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
title: DynamoDB Local Development
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
The `connection` generator configures your project's `
|
|
5
|
+
The `connection` generator configures your project's `dev` target to depend on the DynamoDB project's `dev` target. DynamoDB Local will start automatically alongside your project when running `dev`.
|
|
6
6
|
|
|
7
|
-
The `
|
|
7
|
+
The `LOCAL_DEV=true` environment variable is set automatically, so `getDynamoDBClient()` and `resolveTableName()` connect to the local DynamoDB Local instance instead of AWS.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
title: Python DynamoDB Local Development
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
The `connection` generator configures your project's `
|
|
5
|
+
The `connection` generator configures your project's `dev` target to depend on the DynamoDB project's `dev` target. DynamoDB Local will start automatically alongside your project when running `dev`.
|
|
6
6
|
|
|
7
|
-
The `
|
|
7
|
+
The `LOCAL_DEV=true` environment variable is set automatically, so `is_local()` returns `True` and your PynamoDB entities connect to the local DynamoDB instance instead of AWS.
|
|
@@ -25,7 +25,7 @@ title: GSI Configuration
|
|
|
25
25
|
The `sortKey` field is optional for hash-key-only GSIs.
|
|
26
26
|
|
|
27
27
|
This config file is the single source of truth read by all consumers:
|
|
28
|
-
- **Local development** — `
|
|
28
|
+
- **Local development** — `dev` reads `config.json` and creates or updates the local table to match the GSI list
|
|
29
29
|
- **CDK** — the construct reads `config.json` at synth time, so GSI changes are reflected on the next `cdk deploy`
|
|
30
30
|
- **Terraform** — the module reads `config.json` at plan/apply time
|
|
31
31
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Starting Local DynamoDB
|
|
3
|
+
---
|
|
4
|
+
import NxCommands from '@components/nx-commands.astro';
|
|
5
|
+
|
|
6
|
+
The generator configures a `dev` target that starts a [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html) instance and creates the table. Use the project's `dev` target:
|
|
7
|
+
|
|
8
|
+
<NxCommands commands={['dev <project-name>']} />
|
|
9
|
+
|
|
10
|
+
This automatically:
|
|
11
|
+
1. Pulls the DynamoDB Local image (`pull-image` target)
|
|
12
|
+
2. Starts a container
|
|
13
|
+
3. Creates a local table with the indexes defined in `config.json`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Local Development Windows Caution
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Stopping `dev` (e.g. with `Ctrl+C`) automatically removes the DynamoDB Local container, but preserves the named volume so your data persists across restarts.
|
|
6
|
+
|
|
7
|
+
:::caution[Windows]
|
|
8
|
+
Due to limitations with signal handling on Windows, the container is not automatically removed when `dev` is stopped. You will need to remove it manually:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
<engine> rm -f <scope>-dynamodb
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Replace `<engine>` with your container engine (`docker` or `finch`) and `<scope>` with your Nx workspace scope (e.g. `proj`).
|
|
15
|
+
:::
|