@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.
Files changed (54) hide show
  1. package/bin/aws-nx-mcp.js +17 -17
  2. package/docs/guides/agentcore-gateway.mdx +4 -4
  3. package/docs/guides/connection/agentcore-gateway-gateway.mdx +4 -4
  4. package/docs/guides/connection/agentcore-gateway-mcp.mdx +5 -5
  5. package/docs/guides/connection/py-agent-a2a.mdx +5 -5
  6. package/docs/guides/connection/py-agent-dynamodb.mdx +1 -1
  7. package/docs/guides/connection/py-agent-gateway.mdx +7 -7
  8. package/docs/guides/connection/py-agent-mcp.mdx +4 -4
  9. package/docs/guides/connection/py-fast-api-dynamodb.mdx +1 -1
  10. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +1 -1
  11. package/docs/guides/connection/react-agui.mdx +4 -4
  12. package/docs/guides/connection/react-fastapi.mdx +2 -2
  13. package/docs/guides/connection/react-py-agent.mdx +3 -3
  14. package/docs/guides/connection/react-smithy.mdx +2 -2
  15. package/docs/guides/connection/react-ts-agent.mdx +5 -5
  16. package/docs/guides/connection/smithy-dynamodb.mdx +1 -1
  17. package/docs/guides/connection/smithy-rdb.mdx +3 -3
  18. package/docs/guides/connection/trpc-dynamodb.mdx +1 -1
  19. package/docs/guides/connection/trpc-rdb.mdx +3 -3
  20. package/docs/guides/connection/ts-agent-a2a.mdx +5 -5
  21. package/docs/guides/connection/ts-agent-dynamodb.mdx +1 -1
  22. package/docs/guides/connection/ts-agent-gateway.mdx +6 -6
  23. package/docs/guides/connection/ts-agent-mcp.mdx +4 -4
  24. package/docs/guides/connection/ts-agent-rdb.mdx +3 -3
  25. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +1 -1
  26. package/docs/guides/connection/ts-mcp-server-rdb.mdx +3 -3
  27. package/docs/guides/connection.mdx +1 -1
  28. package/docs/guides/fastapi.mdx +6 -0
  29. package/docs/guides/local-development.mdx +20 -9
  30. package/docs/guides/nx-generator.mdx +2 -2
  31. package/docs/guides/py-agent.mdx +9 -5
  32. package/docs/guides/py-dynamodb.mdx +4 -4
  33. package/docs/guides/py-mcp-server.mdx +11 -1
  34. package/docs/guides/react-website-auth.mdx +36 -0
  35. package/docs/guides/react-website.mdx +22 -14
  36. package/docs/guides/trpc.mdx +6 -0
  37. package/docs/guides/ts-agent.mdx +9 -5
  38. package/docs/guides/ts-dynamodb.mdx +4 -4
  39. package/docs/guides/ts-mcp-server.mdx +11 -1
  40. package/docs/guides/ts-rdb.mdx +5 -4
  41. package/docs/guides/ts-smithy-api.mdx +4 -0
  42. package/docs/guides/typescript-infrastructure.mdx +1 -1
  43. package/docs/snippets/api/access-logging.mdx +33 -0
  44. package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
  45. package/docs/snippets/connection/py-dynamodb-local-development.mdx +2 -2
  46. package/docs/snippets/dynamodb/gsi-config.mdx +1 -1
  47. package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
  48. package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
  49. package/package.json +1 -1
  50. package/src/preset/schema.json +0 -5
  51. package/src/ts/react-website/app/schema.json +6 -6
  52. package/src/ts/website/app/schema.json +6 -6
  53. package/docs/snippets/dynamodb/serve-local-start.mdx +0 -13
  54. 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>-serve-local` target is updated to depend on the database's `serve-local` target.
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>-serve-local <project-name>"]} />
139
+ <NxCommands commands={["<agent-name>-dev <project-name>"]} />
140
140
 
141
- This starts the agent and all connected databases. The `SERVE_LOCAL=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
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>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target. No source files are modified.
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>-serve-local` target is updated to depend on the database's `serve-local` target.
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>-serve-local <project-name>"]} />
133
+ <NxCommands commands={["<mcp-server-name>-dev <project-name>"]} />
134
134
 
135
- This starts the MCP server and all connected databases. The `SERVE_LOCAL=true` environment variable causes each Prisma client to connect to its local Docker database instead of Aurora.
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 `serve-local` targets. See the <Link path="guides/local-development">Local Development</Link> guide for details.
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
  :::
@@ -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 serve-local targets
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 `serve-local`. The difference is one of **scope** — how much of your application runs locally versus pointing at deployed AWS infrastructure.
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
- ## `serve-local`
42
+ ## `dev`
43
43
 
44
- The `serve-local` target runs the **targeted project** and **every project connected to it transitively**, all on your machine. The connection generator wires this up automatically — running `serve-local` on the website also starts local servers for the `api`, the `agent`, and the `mcp` server it reaches through the agent.
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={['serve-local website']} />
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 `serve-local`) so that it points at your locally running servers instead of deployed URLs.
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 `serve-local` when you are working across several connected projects at once and want to iterate quickly without deploying your infrastructure.
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
- :::tip[`dev` shortcut]
71
- A root `dev` script is added as a shortcut for the first website you generate in your workspace, so you can spin up the website and all connected components with:
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(__dirname, 'files'), // Template directory
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(__dirname, 'files'), // Template directory
462
+ joinPathFragments(import.meta.dirname, 'files'), // Template directory
463
463
  'path/to/output', // Output directory
464
464
  data,
465
465
  );
@@ -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
- The generator configures a target named `<your-agent-name>-serve`, which starts your Agent locally for development and testing.
400
+ To run your Agent (and everything connected to it) locally, use the project's `dev` target:
401
401
 
402
- <NxCommands commands={['agent-serve your-project']} />
402
+ <NxCommands commands={['dev your-project']} />
403
403
 
404
- This command uses `uv run` to execute your Agent using the [Bedrock AgentCore Python SDK](https://github.com/aws/bedrock-agentcore-sdk-python).
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>-serve-local` first (in a separate terminal):
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={['run your-project:agent-serve-local']} />
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/serve-local-start" />
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 `SERVE_LOCAL=true`, used to switch between local and AWS behaviour.
410
- - `get_table_name()` — returns the DynamoDB table name. When `SERVE_LOCAL=true`, reads the table name from `serveLocal.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.
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/serve-local-windows" />
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>-serve-local` 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.
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 [Cloudscape](http://cloudscape.design/) 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/).
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 [Cloudscape](http://cloudscape.design/). You can also select [shadcn/ui](https://ui.shadcn.com/) or `None` (bring your own component library).
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
- You can run a local development server using either the `serve` or `serve-local` target.
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
- ### Serve Local Target
320
+ ### Dev Target
317
321
 
318
- The `serve-local` target starts a local development server for your website (with [Vite `MODE`](https://vite.dev/guide/env-and-mode) set to `serve-local`), as well as starting any local servers for APIs you have connected your website to via the <Link path="/guides/connection">Connection generator</Link>.
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={['serve-local <my-website>']} />
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
- If no `dev` script exists in your root `package.json` when this generator runs, a `dev` script is added that invokes `serve-local` for the generated website, meaning you can also start the local development server with:
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 makes the first React website you generate the default `dev` target for the workspace. Subsequent websites do not overwrite the existing `dev` script — you can invoke their `serve-local` targets directly, or update the script manually.
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 `serve-local`, deploy your infrastructure and load runtime config.
343
+ To enable login and authentication for `dev`, deploy your infrastructure and load runtime config.
340
344
  :::
341
345
 
342
- :::tip[Serve-Local Behavior]
343
- When running with `serve-local`, you can specify any environment variables required by your APIs to point to other deployed AWS resources, for example:
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={['serve-local <my-website>']} />
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 use Vite to create a production bundle in the root `dist/packages/<my-website>/bundle` directory, as well as type-checking, compiling and linting your website.
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.
@@ -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" />
@@ -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
- The generator configures a target named `<your-agent-name>-serve`, which starts your Agent locally for development and testing.
266
+ To run your Agent (and everything connected to it) locally, use the project's `dev` target:
267
267
 
268
- <NxCommands commands={['agent-serve your-project']} />
268
+ <NxCommands commands={['dev your-project']} />
269
269
 
270
- This command 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).
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>-serve-local` first (in a separate terminal):
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={['run your-project:agent-serve-local']} />
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/serve-local-start" />
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 `SERVE_LOCAL=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 `SERVE_LOCAL=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.
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/serve-local-windows" />
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>-serve-local` 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.
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
 
@@ -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 `serve-local` (e.g. with `Ctrl+C`) automatically removes the local database container, but preserves the named volume so your data persists across restarts.
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 `serve-local` is stopped. You will need to remove it manually:
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 `serveLocal.image` field of the generated `config.json` file in your database project root. Update that value when you change engine versions.
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">CloudScape website</Link> generator, you will notice you already have a construct in `packages/common/constructs` to deploy it. For example:
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 `serve-local` target to depend on the DynamoDB project's `serve-local` target. DynamoDB Local will start automatically alongside your project when running `serve-local`.
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 `SERVE_LOCAL=true` environment variable is set automatically, so `getDynamoDBClient()` and `resolveTableName()` connect to the local DynamoDB Local instance instead of AWS.
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 `serve-local` target to depend on the DynamoDB project's `serve-local` target. DynamoDB Local will start automatically alongside your project when running `serve-local`.
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 `SERVE_LOCAL=true` environment variable is set automatically, so `is_local()` returns `True` and your PynamoDB entities connect to the local DynamoDB instance instead of AWS.
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** — `serve-local` reads `config.json` and creates or updates the local table to match the GSI list
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
+ :::