@aws/nx-plugin-mcp 1.0.0-rc.9 → 1.0.0-rc.90
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 +14263 -13571
- package/docs/get_started/building-with-ai.mdx +116 -0
- package/docs/get_started/concepts.mdx +67 -0
- package/docs/get_started/existing-project.mdx +180 -0
- package/docs/get_started/graph-builder.mdx +39 -0
- package/docs/get_started/quick-start.mdx +277 -0
- package/docs/get_started/tutorials/contribute-generator.mdx +408 -0
- package/docs/get_started/tutorials/dungeon-game/1.mdx +1578 -0
- package/docs/get_started/tutorials/dungeon-game/2.mdx +245 -0
- package/docs/get_started/tutorials/dungeon-game/3.mdx +66 -0
- package/docs/get_started/tutorials/dungeon-game/4.mdx +164 -0
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +145 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
- package/docs/get_started/upgrading.mdx +157 -0
- package/docs/guides/agentcore-gateway.mdx +490 -0
- package/docs/guides/agentcore-harness.mdx +312 -0
- package/docs/guides/astro-docs.mdx +8 -0
- package/docs/guides/connection/agentcore-gateway-agent.mdx +222 -0
- package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
- package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
- package/docs/guides/connection/py-agent-a2a.mdx +48 -16
- package/docs/guides/connection/py-agent-dynamodb.mdx +115 -0
- package/docs/guides/connection/py-agent-gateway.mdx +182 -0
- package/docs/guides/connection/py-agent-mcp.mdx +43 -14
- package/docs/guides/connection/py-agent-rdb.mdx +169 -0
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
- package/docs/guides/connection/py-fast-api-rdb.mdx +175 -0
- package/docs/guides/connection/py-mcp-server-dynamodb.mdx +115 -0
- package/docs/guides/connection/py-mcp-server-rdb.mdx +178 -0
- package/docs/guides/connection/react-agentcore-gateway.mdx +112 -0
- package/docs/guides/connection/react-agui.mdx +33 -14
- package/docs/guides/connection/react-fastapi.mdx +39 -3
- package/docs/guides/connection/react-py-agent.mdx +10 -16
- package/docs/guides/connection/react-smithy.mdx +4 -4
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +9 -9
- package/docs/guides/connection/smithy-dynamodb.mdx +5 -5
- package/docs/guides/connection/smithy-rdb.mdx +9 -9
- package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
- package/docs/guides/connection/trpc-rdb.mdx +5 -5
- package/docs/guides/connection/ts-agent-a2a.mdx +14 -11
- package/docs/guides/connection/ts-agent-dynamodb.mdx +35 -36
- package/docs/guides/connection/ts-agent-gateway.mdx +147 -0
- package/docs/guides/connection/ts-agent-mcp.mdx +12 -9
- package/docs/guides/connection/ts-agent-rdb.mdx +61 -25
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +35 -36
- package/docs/guides/connection/ts-mcp-server-rdb.mdx +59 -18
- package/docs/guides/connection.mdx +122 -5
- package/docs/guides/docker-bundling.mdx +82 -14
- package/docs/guides/fastapi.mdx +253 -12
- package/docs/guides/local-development.mdx +87 -0
- package/docs/guides/nx-generator.mdx +4 -3
- package/docs/guides/nx-migration.mdx +165 -0
- package/docs/guides/py-agent.mdx +332 -55
- package/docs/guides/py-dynamodb.mdx +476 -0
- package/docs/guides/py-mcp-server.mdx +57 -2
- package/docs/guides/py-rdb.mdx +269 -0
- package/docs/guides/python-lambda-function.mdx +1 -1
- package/docs/guides/python-project.mdx +31 -0
- package/docs/guides/react-website-auth.mdx +104 -5
- package/docs/guides/react-website.mdx +409 -95
- package/docs/guides/runtime-config.mdx +17 -4
- package/docs/guides/security.mdx +75 -0
- package/docs/guides/smithy-project.mdx +167 -0
- package/docs/guides/terraform-project.mdx +119 -8
- package/docs/guides/trpc.mdx +55 -14
- package/docs/guides/ts-agent.mdx +207 -23
- package/docs/guides/ts-dcr-proxy.mdx +569 -0
- package/docs/guides/ts-dynamodb.mdx +66 -242
- package/docs/guides/ts-lambda-function.mdx +1 -1
- package/docs/guides/ts-mcp-server.mdx +111 -29
- package/docs/guides/ts-nx-plugin.mdx +4 -4
- package/docs/guides/ts-rdb.mdx +116 -466
- package/docs/guides/ts-smithy-api.mdx +260 -16
- package/docs/guides/typescript-infrastructure.mdx +79 -25
- package/docs/guides/typescript-project.mdx +157 -24
- package/docs/guides/workspace.mdx +31 -2
- package/docs/snippets/agent/architecture.mdx +1 -1
- package/docs/snippets/agent/bedrock-deployment.mdx +9 -5
- package/docs/snippets/agent/runtime-arn.mdx +23 -2
- package/docs/snippets/agent/securing-your-agent.mdx +39 -0
- package/docs/snippets/api/access-logging.mdx +38 -0
- package/docs/snippets/api/cors-configuration-cdk-note.mdx +1 -1
- package/docs/snippets/api/cors-configuration-terraform-note.mdx +1 -1
- package/docs/snippets/api/type-safe-api-integrations.mdx +218 -373
- package/docs/snippets/api/waf-configuration.mdx +3 -3
- package/docs/snippets/connection/a2a-infrastructure.mdx +1 -1
- package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
- package/docs/snippets/connection/lambda-dynamodb-access.mdx +2 -2
- package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
- package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
- package/docs/snippets/connection/rdb-api-infrastructure.mdx +42 -19
- package/docs/snippets/dynamodb/deploying-table.mdx +176 -0
- package/docs/snippets/dynamodb/encryption-options.mdx +168 -0
- package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
- package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
- package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
- package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
- package/docs/snippets/experimental-generator.mdx +8 -0
- package/docs/snippets/lambda-function/deploying-your-function.mdx +3 -3
- package/docs/snippets/mcp/architecture.mdx +1 -1
- package/docs/snippets/mcp/bedrock-deployment.mdx +9 -5
- package/docs/snippets/mcp/config.mdx +3 -2
- package/docs/snippets/mcp/shared-constructs.mdx +4 -5
- package/docs/snippets/pdk-migration/example/01-migrate-api.mdx +7 -5
- package/docs/snippets/pdk-migration/example/02-migrate-website.mdx +29 -10
- package/docs/snippets/pdk-migration/example/03-migrate-infra.mdx +4 -4
- package/docs/snippets/pdk-migration/faq/type-safe-api.mdx +5 -111
- package/docs/snippets/prerequisites.mdx +1 -4
- package/docs/snippets/rdb/admin-credentials.mdx +42 -0
- package/docs/snippets/rdb/architecture.mdx +39 -0
- package/docs/snippets/rdb/cluster-instances.mdx +31 -0
- package/docs/snippets/rdb/deletion-protection.mdx +64 -0
- package/docs/snippets/rdb/deploying.mdx +178 -0
- package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
- package/docs/snippets/rdb/engine-version.mdx +63 -0
- package/docs/snippets/rdb/infrastructure.mdx +35 -0
- package/docs/snippets/rdb/logging-mysql.mdx +5 -0
- package/docs/snippets/rdb/logging-postgres.mdx +5 -0
- package/docs/snippets/rdb/performance-insights.mdx +36 -0
- package/docs/snippets/rdb/rds-proxy.mdx +50 -0
- package/docs/snippets/rdb/removal-policy.mdx +57 -0
- package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
- package/docs/snippets/recommended-prerequisites.mdx +10 -0
- package/docs/snippets/required-prerequisites.mdx +1 -4
- package/docs/snippets/runtime-config-app-id-note.mdx +8 -0
- package/docs/snippets/shared-constructs.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +37 -0
- package/generators.json +170 -10
- package/package.json +1 -1
- package/src/agentcore-gateway/agent-connection/schema.json +31 -0
- package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
- package/src/agentcore-gateway/react-connection/schema.json +31 -0
- package/src/agentcore-gateway/schema.json +72 -0
- package/src/agentcore-harness/schema.json +53 -0
- package/src/connection/schema.json +5 -0
- package/src/infra/app/schema.json +5 -0
- package/src/init/schema.json +35 -0
- package/src/internal/test-matrix/schema.json +21 -0
- package/src/license/schema.json +5 -0
- package/src/open-api/json-metadata/schema.json +20 -0
- package/src/preset/schema.json +16 -5
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/gateway-connection/schema.json +31 -0
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/schema.json +5 -0
- package/src/py/agent/schema.json +15 -1
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/agent-connection/schema.json +27 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
- package/src/py/dynamodb/schema.json +76 -0
- package/src/py/fast-api/react/schema.json +5 -0
- package/src/py/fast-api/schema.json +6 -0
- package/src/py/lambda-function/schema.json +6 -1
- package/src/py/mcp-server/schema.json +6 -0
- package/src/py/project/schema.json +6 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.json +78 -0
- package/src/smithy/project/schema.json +28 -1
- package/src/smithy/react-connection/schema.json +5 -0
- package/src/smithy/ts/api/schema.json +6 -0
- package/src/terraform/project/schema.json +5 -0
- package/src/trpc/backend/schema.json +6 -0
- package/src/trpc/react/schema.json +5 -0
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/gateway-connection/schema.json +31 -0
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/schema.json +5 -0
- package/src/ts/agent/schema.json +14 -0
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/schema.json +3 -3
- package/src/ts/dcr-proxy/schema.json +44 -0
- package/src/ts/docs/schema.json +3 -3
- package/src/ts/dynamodb/agent-connection/schema.json +5 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
- package/src/ts/dynamodb/schema.json +26 -2
- package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/schema.json +5 -0
- package/src/ts/mcp-server/schema.json +6 -0
- package/src/ts/nx-generator/schema.json +5 -0
- package/src/ts/nx-migration/schema.json +63 -0
- package/src/ts/nx-plugin/schema.json +5 -0
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
- package/src/ts/rdb/schema.json +7 -1
- package/src/ts/rdb/smithy-connection/schema.json +5 -0
- package/src/ts/rdb/trpc-connection/schema.json +5 -0
- package/src/ts/react-website/app/schema.json +12 -6
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/runtime-config/schema.json +5 -0
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/schema.json +5 -0
- /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
- /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Building with AI
|
|
3
|
+
description: Building with AI and the Nx Plugin for AWS MCP Server
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Link from "@components/link.astro";
|
|
7
|
+
import Snippet from "@components/snippet.astro";
|
|
8
|
+
import { Steps, Tabs, TabItem } from "@astrojs/starlight/components";
|
|
9
|
+
|
|
10
|
+
Install the [Claude Plugin](https://code.claude.com/docs/en/plugins), [Kiro Power](https://kiro.dev/docs/powers/), or [MCP Server](https://modelcontextprotocol.io/introduction) to enable AI assistants to work effectively with the plugin. By using these, you can accelerate your development workflow with AI while benefitting from your projects being scaffolded in a consistent fashion, spending less time on setting up the main components and benefitting from the security, observability, type-safety and local development built into the plugin.
|
|
11
|
+
|
|
12
|
+
## Configure your AI Assistant
|
|
13
|
+
|
|
14
|
+
:::tip[Project-level configuration is automatic]
|
|
15
|
+
Workspaces created with the Nx Plugin for AWS preset already include project-level MCP configuration for common coding agents (Claude Code, Cursor, Kiro, Gemini CLI, GitHub Copilot and OpenAI Codex). Any agent working inside the workspace can use the MCP server without further setup. The steps below configure the MCP server globally for use across all of your projects.
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
<Tabs syncKey="ai-assistant">
|
|
19
|
+
<TabItem label="Kiro">
|
|
20
|
+
The Nx Plugin for AWS ships as a [Kiro Power](https://kiro.dev/docs/powers/) that bundles the MCP server with steering documentation and workflow guides.
|
|
21
|
+
|
|
22
|
+
<Steps>
|
|
23
|
+
|
|
24
|
+
1. Open the Powers panel in Kiro and click **Add power from GitHub**
|
|
25
|
+
2. Enter the following URL:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
https://github.com/awslabs/nx-plugin-for-aws/tree/main/powers/nx-plugin-for-aws
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. Click **Install**
|
|
32
|
+
|
|
33
|
+
</Steps>
|
|
34
|
+
|
|
35
|
+
Kiro automatically configures the MCP server — no additional setup required.
|
|
36
|
+
|
|
37
|
+
</TabItem>
|
|
38
|
+
<TabItem label="Kiro CLI">
|
|
39
|
+
Run the following command:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
kiro-cli mcp add \
|
|
43
|
+
--name nx-plugin-for-aws \
|
|
44
|
+
--scope global \
|
|
45
|
+
--command npx \
|
|
46
|
+
--args "-y,@aws/nx-plugin-mcp"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
See the [Kiro CLI MCP docs](https://kiro.dev/docs/cli/mcp/) for more details.
|
|
50
|
+
|
|
51
|
+
</TabItem>
|
|
52
|
+
<TabItem label="Claude Code">
|
|
53
|
+
The Nx Plugin for AWS is distributed as a [Claude Code plugin](https://code.claude.com/docs/en/plugins) that bundles a [Skill](https://code.claude.com/docs/en/skills) with the MCP server.
|
|
54
|
+
|
|
55
|
+
Run the following commands inside Claude Code, one at a time:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
/plugin marketplace add awslabs/nx-plugin-for-aws
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/plugin install nx-plugin-for-aws@nx-plugin-for-aws
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Then run `/reload-plugins` to activate the plugin.
|
|
66
|
+
|
|
67
|
+
</TabItem>
|
|
68
|
+
<TabItem label="Cursor">
|
|
69
|
+
Add the following to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your project):
|
|
70
|
+
|
|
71
|
+
<Snippet name="mcp/config" />
|
|
72
|
+
|
|
73
|
+
See the [Cursor MCP docs](https://cursor.com/docs/mcp) for more details.
|
|
74
|
+
|
|
75
|
+
</TabItem>
|
|
76
|
+
<TabItem label="Codex">
|
|
77
|
+
Add the following to `~/.codex/config.toml`:
|
|
78
|
+
|
|
79
|
+
```toml
|
|
80
|
+
[mcp_servers.nx-plugin-for-aws]
|
|
81
|
+
command = "npx"
|
|
82
|
+
args = ["-y", "@aws/nx-plugin-mcp"]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
See the [Codex config docs](https://developers.openai.com/codex/config-reference) for more details.
|
|
86
|
+
|
|
87
|
+
</TabItem>
|
|
88
|
+
<TabItem label="Other">
|
|
89
|
+
Most MCP-compatible assistants use a JSON configuration file. Add the following entry:
|
|
90
|
+
|
|
91
|
+
<Snippet name="mcp/config" />
|
|
92
|
+
|
|
93
|
+
If you have issues such as `ENOENT npx`, replace the command with the full path to `npx` (find it with `which npx`).
|
|
94
|
+
|
|
95
|
+
For assistant-specific documentation:
|
|
96
|
+
|
|
97
|
+
<Snippet name="mcp/assistant-docs" />
|
|
98
|
+
|
|
99
|
+
</TabItem>
|
|
100
|
+
</Tabs>
|
|
101
|
+
|
|
102
|
+
## Start Vibe Coding
|
|
103
|
+
|
|
104
|
+
Ask your AI Assistant to build something using the `nx-plugin-for-aws`! It will typically create a workspace, scaffold with the applicable generators, then fill in the business logic.
|
|
105
|
+
|
|
106
|
+
Try a prompt like:
|
|
107
|
+
|
|
108
|
+
> _"Build a multi-agent application using the Nx Plugin for AWS. I want a React frontend that talks to a backend orchestrator agent which delegates to specialised research and writing agents."_
|
|
109
|
+
|
|
110
|
+
Or for a smaller starting point:
|
|
111
|
+
|
|
112
|
+
> _"Use the Nx Plugin for AWS to scaffold a React website backed by a tRPC API, with Cognito auth and CDK infrastructure."_
|
|
113
|
+
|
|
114
|
+
## Build your own MCP Server
|
|
115
|
+
|
|
116
|
+
Check out the <Link path="/guides/ts-mcp-server">`ts#mcp-server` generator guide</Link> for details about building your own MCP Server.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Concepts
|
|
3
|
+
description: Key concepts.
|
|
4
|
+
---
|
|
5
|
+
import Link from '@components/link.astro';
|
|
6
|
+
import FrameworkLogos from '@components/framework-logos.astro';
|
|
7
|
+
|
|
8
|
+
The `@aws/nx-plugin` is an [Nx](https://nx.dev/) plugin that provides a toolkit for building and deploying full-stack applications on AWS. It gives you a collection of [Generators](#generators) which scaffold best-practice application code _and_ the infrastructure to deploy it — type-safe, locally runnable, and deployable from the start, getting you closer to production.
|
|
9
|
+
|
|
10
|
+
Rather than starting from a blank page, you (or your AI agent) pick the components you need — APIs, websites, authentication, AI agents, infrastructure — provide a few configuration options, and the plugin generates best-practice starter code. It even wires projects together for you (including updating existing files via AST transforms) to produce type-safe clients between your frontend and backend.
|
|
11
|
+
|
|
12
|
+
## Built on Nx and its generators
|
|
13
|
+
|
|
14
|
+
[Nx](https://nx.dev) is a smart build framework for managing monorepos. It is language agnostic, letting TypeScript, Python, infrastructure and more live and build together in a single workspace. Its build system uses caching and dependency graph analysis to only rebuild what changed and run tasks in parallel, keeping testing, linting and building fast as your workspace grows.
|
|
15
|
+
|
|
16
|
+
Every piece of functionality in the `@aws/nx-plugin` is delivered as an Nx [Generator](https://nx.dev/features/generate-code) — automated scaffolding that produces consistent code structures from predefined templates. Generators can be invoked via the [Nx CLI](https://nx.dev/features/generate-code#invoke-generators), the [Nx Console IDE plugin](https://nx.dev/getting-started/editor-setup), or by your AI assistant through the <Link path="/get_started/building-with-ai">Nx Plugin for AWS MCP Server</Link>.
|
|
17
|
+
|
|
18
|
+
Because every component is a generator, you only add what you need, when you need it. Start with an API, add a website later, connect them when you're ready — each step is a single command.
|
|
19
|
+
|
|
20
|
+
## Build with proven frameworks
|
|
21
|
+
|
|
22
|
+
The `@aws/nx-plugin` deliberately avoids building custom abstractions on top of the tools you already know. Instead of inventing bespoke frameworks, runtimes or wrappers, it scaffolds idiomatic code using established, widely-adopted open-source projects. This means your existing skills carry over directly, you can rely on the official documentation for each framework, and you're never locked into a layer that only this plugin understands.
|
|
23
|
+
|
|
24
|
+
The generated code stands on the shoulders of best-in-class frameworks, including:
|
|
25
|
+
|
|
26
|
+
<FrameworkLogos />
|
|
27
|
+
|
|
28
|
+
The plugin's value is in how these pieces are configured and connected together for AWS — not in replacing them.
|
|
29
|
+
|
|
30
|
+
## Open for modification
|
|
31
|
+
|
|
32
|
+
All generated code is _your_ code. The `@aws/nx-plugin` is a build-time tool, not a runtime dependency — once a generator has run, the plugin is no longer in the picture. You can read every file it produced, commit it, and change it however you like.
|
|
33
|
+
|
|
34
|
+
This means:
|
|
35
|
+
|
|
36
|
+
- **No escape hatches.** There's no proprietary configuration surface to learn or wrestle with when you need to do something the generator didn't anticipate. You edit the generated code directly, the same way you would edit any code you wrote yourself.
|
|
37
|
+
- **No new layers of abstraction.** Generators emit plain, idiomatic code for the underlying frameworks. There's no wrapper API or magic indirection sitting between you and React, tRPC, FastAPI, CDK or any of the other tools — what you see is what runs.
|
|
38
|
+
- **The plugin isn't a dependency.** It generates code and steps out of the way. Your application doesn't import or rely on `@aws/nx-plugin` at runtime, so you're never blocked by it and never locked in.
|
|
39
|
+
|
|
40
|
+
If you don't like something in the generated code, you are free to modify it. Generators give you a head start, not a cage.
|
|
41
|
+
|
|
42
|
+
## In step with improvements
|
|
43
|
+
|
|
44
|
+
Owning your code usually comes at a cost: the moment you start editing a scaffold, you're cut off from the fixes and improvements made upstream. Adopting them again means reading a changelog, regenerating, and reconciling a diff by hand. <Link path="/get_started/upgrading">Migrations</Link> are how the `@aws/nx-plugin` works to keep that from happening.
|
|
45
|
+
|
|
46
|
+
Releases ship migrations alongside them, aiming to bring the code earlier generators produced into step with the improvements we've made since. When we fix a bug, harden a security default or refine a generated pattern, running `nx migrate` applies that change to your code, in place — instead of leaving you to spot it in a changelog and port it across yourself.
|
|
47
|
+
|
|
48
|
+
In practice:
|
|
49
|
+
|
|
50
|
+
- **Upgrading is automated, not a re-adoption exercise.** A workspace generated months ago can move forward with the plugin rather than drifting further from it.
|
|
51
|
+
- **Customisations are pattern-matched, not overwritten.** Migrations check that a file still matches the shape the generator produced. Where it has diverged beyond what they can safely update, they leave your code alone and report the manual follow-up instead.
|
|
52
|
+
- **Some changes arrive as agent prompts.** Where the right edit depends on what you've built, the migration is a prompt your AI coding agent applies rather than a codemod.
|
|
53
|
+
- **Upgrades are opt-in.** Nothing in your workspace changes until you choose to run `nx migrate`.
|
|
54
|
+
|
|
55
|
+
Migrations narrow the gap rather than close it: how far your code has moved decides how much they can do, and some steps will still need your hands.
|
|
56
|
+
|
|
57
|
+
## Minimal dependencies
|
|
58
|
+
|
|
59
|
+
The `@aws/nx-plugin` strives to keep the number of global dependencies to a minimum. What you need to get started boils down to which generators you invoke.
|
|
60
|
+
|
|
61
|
+
As an example, any TypeScript-based generator will only require [Node](https://nodejs.org/en/download) to be installed. For Python-based projects, [UV](https://docs.astral.sh/uv/) is the only requirement.
|
|
62
|
+
|
|
63
|
+
## Type safety
|
|
64
|
+
|
|
65
|
+
The `@aws/nx-plugin` employs type-safety to simplify the developer experience via IDE completions, while also eliminating runtime errors which would otherwise only surface in a non type-safe implementation. As such, all components that are vended are type-safe by default.
|
|
66
|
+
|
|
67
|
+
Type safety flows across project boundaries: when you connect a website to an API, the generated client shares types with the backend, so a change to an API contract surfaces as a compile-time error in your frontend rather than a bug in production. Refactor with confidence.
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Add to an Existing Project
|
|
3
|
+
description: How to adopt @aws/nx-plugin in an existing Nx workspace or non-Nx monorepo.
|
|
4
|
+
---
|
|
5
|
+
import { Steps, Aside, FileTree } from '@astrojs/starlight/components';
|
|
6
|
+
import Link from '@components/link.astro';
|
|
7
|
+
import Snippet from '@components/snippet.astro';
|
|
8
|
+
import Drawer from '@components/drawer.astro';
|
|
9
|
+
import NxCommands from '@components/nx-commands.astro';
|
|
10
|
+
import NxInitCommand from '@components/nx-init-command.astro';
|
|
11
|
+
import TsConfigBaseCompilerOptions from '@components/tsconfig-base-compiler-options.astro';
|
|
12
|
+
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
13
|
+
|
|
14
|
+
Not every project starts with `pnpm create @aws/nx-workspace`. If you already have an [Nx workspace](https://nx.dev) — or a monorepo you can add Nx to — you can adopt `@aws/nx-plugin` incrementally without recreating your project.
|
|
15
|
+
|
|
16
|
+
<Aside type="tip">
|
|
17
|
+
You can use your agentic coding tool of choice to add the plugin for you, using the <Link path="get_started/building-with-ai">MCP server</Link>. Try the prompt:
|
|
18
|
+
|
|
19
|
+
> Add the Nx Plugin for AWS to this project.
|
|
20
|
+
</Aside>
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
<Snippet name="prerequisites" />
|
|
25
|
+
|
|
26
|
+
<Aside type="caution" title="Before you start">
|
|
27
|
+
Save and commit all in-progress work first, so the changes made at each step can be reviewed — and reverted — at any point.
|
|
28
|
+
</Aside>
|
|
29
|
+
|
|
30
|
+
## Adding Nx to a non-Nx project
|
|
31
|
+
|
|
32
|
+
If your project doesn't use Nx yet, add it first with [`nx init`](https://nx.dev/recipes/adopting-nx/adding-to-existing-project). This is a step Nx itself owns; the plugin builds on top of a working Nx workspace. It works on a plain package, an npm/pnpm/yarn/bun workspace, a Turborepo or a Lerna monorepo:
|
|
33
|
+
|
|
34
|
+
<NxInitCommand />
|
|
35
|
+
|
|
36
|
+
Follow the prompts to add Nx to your workspace. For more details refer to the [Nx Documentation](https://nx.dev/recipes/adopting-nx/adding-to-existing-project).
|
|
37
|
+
|
|
38
|
+
<Aside type="note" title="pnpm workspaces">
|
|
39
|
+
pnpm only runs install scripts for allow-listed packages, and `nx` needs its install script — without it, the install `nx init` performs can fail, leaving a `set this to true or false` placeholder in `pnpm-workspace.yaml`. Allow-list it before running `nx init`:
|
|
40
|
+
|
|
41
|
+
```yaml title="pnpm-workspace.yaml"
|
|
42
|
+
allowBuilds:
|
|
43
|
+
- nx
|
|
44
|
+
```
|
|
45
|
+
</Aside>
|
|
46
|
+
|
|
47
|
+
### Non-Node projects (Python, Go, Java, Rust, …)
|
|
48
|
+
|
|
49
|
+
Nx and the plugin are distributed as npm packages, so a project with no Node.js tooling needs a minimal root `package.json` before `nx init` can do anything useful:
|
|
50
|
+
|
|
51
|
+
```json title="package.json"
|
|
52
|
+
{
|
|
53
|
+
"name": "my-project",
|
|
54
|
+
"private": true,
|
|
55
|
+
"type": "module"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Create that file, then run `nx init` and [add the plugin](#adding-the-plugin) as usual. Your existing language tooling is untouched — Nx projects generated by the plugin (including <Link path="guides/py-project">Python projects</Link>) live alongside your existing code, and you can wire your existing build into Nx incrementally.
|
|
60
|
+
|
|
61
|
+
To bring your existing projects under Nx, you have a few options depending on the language:
|
|
62
|
+
|
|
63
|
+
- **Languages with an official Nx plugin** — [Java (Gradle or Maven)](https://nx.dev/docs/technologies/java/introduction) and [.NET](https://nx.dev/docs/technologies/dotnet/introduction) have dedicated plugins that infer your projects' tasks automatically. Add the relevant one, e.g. `nx add @nx/gradle`, `nx add @nx/maven` or `nx add @nx/dotnet`.
|
|
64
|
+
- **Languages with a community plugin** — for example [Go](https://nx.dev/plugin-registry) (`@nx-go/nx-go`) or [Rust](https://nx.dev/plugin-registry) (`@monodon/rust`). Browse the [Nx Plugin Registry](https://nx.dev/plugin-registry) for others.
|
|
65
|
+
- **Any other language** — add a `project.json` to each project and define its targets to run your existing build commands, so `nx build <project>` (and `nx run-many`) drive them. See the <Link path="guides/workspace">workspace guide</Link> for how `project.json` and targets are set up.
|
|
66
|
+
|
|
67
|
+
### Single-package projects
|
|
68
|
+
|
|
69
|
+
The plugin is designed for monorepos — it generates each project into its own directory under `packages/`. If you're starting from a **single-package project** (one `package.json` at the root with your source directly beneath it, no workspaces), move your existing package into `packages/` before adopting the plugin so your project sits alongside the ones the plugin generates:
|
|
70
|
+
|
|
71
|
+
<Steps>
|
|
72
|
+
|
|
73
|
+
1. Create a `packages/<your-package>/` directory and move your source, `package.json` and `tsconfig.json` into it.
|
|
74
|
+
2. Create a new root `package.json` that acts as the workspace manifest rather than a project itself:
|
|
75
|
+
|
|
76
|
+
```json title="package.json"
|
|
77
|
+
{
|
|
78
|
+
"name": "<your-workspace>",
|
|
79
|
+
"private": true,
|
|
80
|
+
"type": "module"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. Declare the workspace so your package manager discovers projects under `packages/`. For `pnpm`, add a `pnpm-workspace.yaml`:
|
|
85
|
+
|
|
86
|
+
```yaml title="pnpm-workspace.yaml"
|
|
87
|
+
packages:
|
|
88
|
+
- packages/*
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For `npm`/`yarn`/`bun`, add a `workspaces` field to the root `package.json` instead:
|
|
92
|
+
|
|
93
|
+
```json title="package.json"
|
|
94
|
+
{
|
|
95
|
+
"workspaces": ["packages/*"]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
4. Run `nx init` (if you haven't), then [add the plugin](#adding-the-plugin).
|
|
100
|
+
|
|
101
|
+
</Steps>
|
|
102
|
+
|
|
103
|
+
<Aside type="note" title="Package manager">
|
|
104
|
+
The plugin's projects are generated under a `packages/` directory. `pnpm` reads workspace globs from `pnpm-workspace.yaml`; other package managers read the `workspaces` field of the root `package.json` — `init` updates whichever your workspace uses.
|
|
105
|
+
</Aside>
|
|
106
|
+
|
|
107
|
+
## Adding the plugin
|
|
108
|
+
|
|
109
|
+
Use [`nx add`](https://nx.dev/nx-api/nx/documents/add), which installs the plugin at a version compatible with your Nx installation and then runs its `init` generator to configure your workspace:
|
|
110
|
+
|
|
111
|
+
<NxCommands commands={['add @aws/nx-plugin']} />
|
|
112
|
+
|
|
113
|
+
Once it completes, your workspace is ready — choose the generators you need and start generating projects.
|
|
114
|
+
|
|
115
|
+
### What this generator configures
|
|
116
|
+
|
|
117
|
+
Adding the plugin makes the deterministic changes a workspace needs to run the plugin's generators. It preserves your workspace's module format: a workspace whose root `package.json` has `type: "module"` stays ESM, anything else stays CommonJS, and generated code follows suit. It does not overwrite existing files, and you may need to make some manual changes following this step depending on your existing configuration.
|
|
118
|
+
|
|
119
|
+
It creates or updates the following files:
|
|
120
|
+
|
|
121
|
+
<FileTree>
|
|
122
|
+
- aws-nx-plugin.config.mts records your chosen IaC provider (CDK or Terraform) and container engine; generators read `iac.provider` from here
|
|
123
|
+
- nx.json registers the sync generators (`@nx/js:typescript-sync` and `@aws/nx-plugin:ts#sync`) on the `compile` target so TypeScript project references stay in sync
|
|
124
|
+
- tsconfig.json a root TypeScript config referencing your workspace's projects, which Nx's TypeScript sync keeps up to date
|
|
125
|
+
- tsconfig.base.json the shared compiler options the plugin's TypeScript projects extend (see below for what it carries)
|
|
126
|
+
- pnpm-workspace.yaml (pnpm only) allow-lists the build scripts the plugin's dependencies need (`@swc/core`, `esbuild`, `nx`, `sharp`)
|
|
127
|
+
- package.json convenience scripts for common tasks, plus the `@aws/nx-plugin`, `@aws/nx-plugin-mcp`, `nx`, `@nx/js`, `@nx/workspace`, `typescript` and Biome dev dependencies
|
|
128
|
+
- biome.json default Biome formatter and linter configuration
|
|
129
|
+
- .mcp.json configures the MCP server for supported coding agents unless disabled (also .cursor/, .kiro/, .gemini/, .vscode/ and .codex/ equivalents). It runs the workspace's own `@aws/nx-plugin-mcp`, so the server always matches the version installed in your workspace
|
|
130
|
+
</FileTree>
|
|
131
|
+
|
|
132
|
+
The <Link path="get_started/building-with-ai">MCP server</Link> configuration can be disabled with `--mcp=false`.
|
|
133
|
+
|
|
134
|
+
<Drawer title="tsconfig.base.json" trigger="Click here to see the compiler options a created tsconfig.base.json carries.">
|
|
135
|
+
The plugin's TypeScript projects rely on these compiler options. If a `tsconfig.base.json` already exists it is left as-is, so if you keep your own these are the options to align with:
|
|
136
|
+
|
|
137
|
+
<TsConfigBaseCompilerOptions />
|
|
138
|
+
</Drawer>
|
|
139
|
+
|
|
140
|
+
### Options
|
|
141
|
+
|
|
142
|
+
<GeneratorParameters generator="init" />
|
|
143
|
+
|
|
144
|
+
## Troubleshooting
|
|
145
|
+
|
|
146
|
+
#### `nx build <project>` no longer works for an existing TypeScript library
|
|
147
|
+
|
|
148
|
+
The first `ts#project` run configures the `@nx/js/typescript` plugin to infer the TypeScript build target as `compile` (the plugin reserves `build` for orchestrating `lint`, `compile` and `test`). Existing libraries relying on the inferred `build` target are inferred as `compile` too — run `nx run <project>:compile`, or use `nx run-many --target build,compile`. Libraries with an explicit `build` target in their `project.json` are unaffected.
|
|
149
|
+
|
|
150
|
+
#### `The workspace is out of sync`
|
|
151
|
+
|
|
152
|
+
TypeScript project references need syncing. `init` registers the sync generators; run:
|
|
153
|
+
|
|
154
|
+
<NxCommands commands={['sync']} />
|
|
155
|
+
|
|
156
|
+
#### `ERR_PNPM_IGNORED_BUILDS` during install
|
|
157
|
+
|
|
158
|
+
pnpm skips install scripts for packages that aren't allow-listed. `init` allow-lists the ones the plugin's tooling needs (`@swc/core`, `esbuild`, `nx`, `sharp`) in `pnpm-workspace.yaml`, but the block can fire during `nx add @aws/nx-plugin` itself — before `init` has run. Run `pnpm approve-builds` and approve the listed packages (or add them under `allowBuilds:`), then re-run the install.
|
|
159
|
+
|
|
160
|
+
#### `nx sync` hangs, or `plugin worker ... exited before the connection was established`
|
|
161
|
+
|
|
162
|
+
If two different `nx` versions are present in the same node_modules tree (run `npm ls nx` to confirm), their plugin-worker IPC deadlocks. The `init` generator pins the root `nx` devDependency to the version the plugin's own `@nx/*` packages resolve, but a later install of another `@nx/*` package at a different patch version can reintroduce the mismatch. Align every `nx` and `@nx/*` entry in your root `package.json` to a single version and reinstall.
|
|
163
|
+
|
|
164
|
+
#### `ts.readConfigFile is not a function`
|
|
165
|
+
|
|
166
|
+
Your workspace has TypeScript 7 installed, which [Nx does not yet support](https://nx.dev/docs/technologies/typescript/guides/typescript-7) — Nx's plugins rely on TypeScript's in-process compiler API, which TypeScript 7 no longer provides. Pin `typescript` in your root `package.json` to the version the plugin uses (the `init` generator installs a compatible version) and reinstall.
|
|
167
|
+
|
|
168
|
+
#### `Recursive task invocation detected`
|
|
169
|
+
|
|
170
|
+
Your **root** `package.json` is registered as an Nx project (it has an `"nx"` key, which `nx init` adds for a single-package repo) *and* carries a `build` script of `nx run-many --target build`. Nx then infers a `build` target on the root that calls itself. Move your source into `packages/<your-package>/` so the root becomes a workspace manifest rather than a project — see [Single-package projects](#single-package-projects). (Nx's own standalone presets avoid this by setting `"nx": { "includedScripts": [] }` on the root package; you can do the same as a quicker alternative.)
|
|
171
|
+
|
|
172
|
+
#### TypeScript errors in your **existing** projects after adding the plugin (`TS6059`, `TS7016`, `TS5011`, `NG4006`)
|
|
173
|
+
|
|
174
|
+
The plugin's own generated projects carry the TypeScript settings they need in their per-project `tsconfig.lib.json`, so they build regardless of your `tsconfig.base.json`. These errors show up instead in a **pre-existing project of yours** that inherits a `tsconfig.base.json` `init` created (with `composite`/`emitDeclarationOnly`/`nodenext`) but isn't compatible with those settings — for example, the Angular compiler rejects `emitDeclarationOnly` (`NG4006`), or a project that sets `outDir` without a `rootDir` now needs one (`TS5011`). Add per-project `tsconfig` overrides re-declaring the conflicting options for those projects (e.g. `"rootDir": "src"`), or point the plugin's projects and your projects at separate base configs.
|
|
175
|
+
|
|
176
|
+
`init` never rewrites an existing `tsconfig.base.json`, precisely so it can't silently break the projects that inherit from it — resolving these mismatches is a decision only you can make for your codebase.
|
|
177
|
+
|
|
178
|
+
<Aside type="note" title="ESM and CommonJS">
|
|
179
|
+
The module format is workspace-wide, read from the root `package.json` `type` field: `type: "module"` means ESM, anything else (including no `type` field) means CommonJS. `init` preserves whichever your workspace uses, and the plugin's TypeScript generators emit matching code. If you later want to switch, change the root `type` — but that's a migration of your existing code, not something `init` does for you.
|
|
180
|
+
</Aside>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Graph Builder
|
|
3
|
+
description: Design your workspace visually, then copy the commands that scaffold it.
|
|
4
|
+
# The builder needs the full content width, which the table of contents column
|
|
5
|
+
# would otherwise take.
|
|
6
|
+
tableOfContents: false
|
|
7
|
+
---
|
|
8
|
+
import Link from '@components/link.astro';
|
|
9
|
+
import GraphBuilder from '@components/graph-builder.astro';
|
|
10
|
+
|
|
11
|
+
Sketch the projects your workspace needs and the connections between them, and the builder generates the commands that scaffold exactly what you drew. Copy them, run them, and you have a working workspace.
|
|
12
|
+
|
|
13
|
+
Drag components from the palette onto the canvas, drag from a component's right edge to another to connect them, and edit each component's properties on the right. The generated commands at the bottom update with every change — hit **Copy** to take the whole script.
|
|
14
|
+
|
|
15
|
+
<GraphBuilder />
|
|
16
|
+
|
|
17
|
+
## How it works
|
|
18
|
+
|
|
19
|
+
Each component on the canvas maps to a generator, and each connection to the <Link path="guides/connection">connection generator</Link>. The commands are emitted in dependency order: the workspace first, then the projects, then the components they host, then the connections wiring them together.
|
|
20
|
+
|
|
21
|
+
A website always gets <Link path="guides/react-website-auth">Cognito authentication</Link> added straight after it, since `ts#website` leaves that to a follow-up generator.
|
|
22
|
+
|
|
23
|
+
An `infra` project is added at the end — <Link path="guides/typescript-infrastructure">`ts#infra`</Link> or <Link path="guides/terraform-project">`terraform#project`</Link>, matching your IaC choice. Every generated project vends constructs for it to instantiate, so this is what you deploy. Because it owns that name, no component on the canvas can be called `infra`.
|
|
24
|
+
|
|
25
|
+
Use **Vertical** / **Horizontal** in the toolbar to swap which way the graph flows — the connection points move to the top and bottom edges of each component, and the layout is transposed to match.
|
|
26
|
+
|
|
27
|
+
Drag the canvas background to pan around, and drag a component to reposition it. Shift-click to select several components and move them as a group. Click a connection to select it, then press <kbd>Delete</kbd> to remove it (or use the ✕ on the connection itself).
|
|
28
|
+
|
|
29
|
+
The palette lists every project and component type that can take part in a connection, and you can only draw the connections the plugin supports — so a graph that validates is a graph that scaffolds.
|
|
30
|
+
|
|
31
|
+
Three rules are worth knowing:
|
|
32
|
+
|
|
33
|
+
- **Components share a host project.** An agent and an MCP server are added _to_ a project rather than being projects of their own. Give them the same host project name to put them in one project, or different names for one project each.
|
|
34
|
+
- **Some connections constrain their endpoints.** Connecting an agent to another agent requires the target to use the `a2a` protocol, for instance. Where a property setting would break a connection you have drawn, the builder says so against the component and the connection.
|
|
35
|
+
- **Drawing a connection can adjust the target.** Connecting a website to an agent switches that agent to the `ag-ui` protocol, and connecting an agent to another agent switches the target to `a2a` — the protocols those connections are built on. A property you have set yourself is never changed.
|
|
36
|
+
|
|
37
|
+
:::tip[Prefer to build with AI?]
|
|
38
|
+
The plugin ships an MCP server, so your coding agent can scaffold and connect projects for you. See <Link path="get_started/building-with-ai">Building with AI</Link>.
|
|
39
|
+
:::
|