@aws/nx-plugin-mcp 1.0.0-rc.2 → 1.0.0-rc.21

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 (70) hide show
  1. package/bin/aws-nx-mcp.js +5919 -4776
  2. package/docs/guides/agentcore-gateway.mdx +240 -0
  3. package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
  4. package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
  5. package/docs/guides/connection/py-agent-a2a.mdx +8 -5
  6. package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
  7. package/docs/guides/connection/py-agent-gateway.mdx +161 -0
  8. package/docs/guides/connection/py-agent-mcp.mdx +7 -4
  9. package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
  10. package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
  11. package/docs/guides/connection/react-smithy.mdx +1 -1
  12. package/docs/guides/connection/react-trpc.mdx +1 -1
  13. package/docs/guides/connection/smithy-dynamodb.mdx +68 -0
  14. package/docs/guides/connection/smithy-rdb.mdx +1 -1
  15. package/docs/guides/connection/trpc-dynamodb.mdx +62 -0
  16. package/docs/guides/connection/trpc-rdb.mdx +1 -1
  17. package/docs/guides/connection/ts-agent-a2a.mdx +8 -5
  18. package/docs/guides/connection/ts-agent-dynamodb.mdx +128 -0
  19. package/docs/guides/connection/ts-agent-gateway.mdx +152 -0
  20. package/docs/guides/connection/ts-agent-mcp.mdx +7 -4
  21. package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +125 -0
  22. package/docs/guides/connection.mdx +89 -0
  23. package/docs/guides/docker-bundling.mdx +13 -7
  24. package/docs/guides/fastapi.mdx +213 -3
  25. package/docs/guides/license.mdx +264 -109
  26. package/docs/guides/local-development.mdx +76 -0
  27. package/docs/guides/nx-generator.mdx +5 -0
  28. package/docs/guides/py-agent.mdx +42 -3
  29. package/docs/guides/py-dynamodb.mdx +449 -0
  30. package/docs/guides/py-mcp-server.mdx +5 -1
  31. package/docs/guides/react-website-auth.mdx +15 -0
  32. package/docs/guides/react-website.mdx +12 -4
  33. package/docs/guides/trpc.mdx +8 -8
  34. package/docs/guides/ts-agent.mdx +40 -2
  35. package/docs/guides/ts-dynamodb.mdx +158 -0
  36. package/docs/guides/ts-mcp-server.mdx +5 -1
  37. package/docs/guides/ts-rdb.mdx +58 -10
  38. package/docs/guides/ts-smithy-api.mdx +148 -3
  39. package/docs/guides/typescript-project.mdx +5 -10
  40. package/docs/guides/workspace.mdx +8 -2
  41. package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
  42. package/docs/snippets/api/waf-configuration.mdx +1 -1
  43. package/docs/snippets/connection/dynamodb-local-development.mdx +7 -0
  44. package/docs/snippets/connection/lambda-dynamodb-access.mdx +80 -0
  45. package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
  46. package/docs/snippets/dynamodb/deploying-table.mdx +171 -0
  47. package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
  48. package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
  49. package/docs/snippets/dynamodb/serve-local-start.mdx +13 -0
  50. package/docs/snippets/dynamodb/serve-local-windows.mdx +15 -0
  51. package/docs/snippets/mcp/config.mdx +1 -1
  52. package/docs/snippets/required-prerequisites.mdx +1 -1
  53. package/generators.json +100 -1
  54. package/package.json +1 -1
  55. package/src/agentcore-gateway/gateway-connection/schema.json +26 -0
  56. package/src/agentcore-gateway/mcp-connection/schema.json +26 -0
  57. package/src/agentcore-gateway/schema.json +65 -0
  58. package/src/license/schema.json +6 -0
  59. package/src/preset/schema.json +5 -0
  60. package/src/py/agent/gateway-connection/schema.json +26 -0
  61. package/src/py/dynamodb/agent-connection/schema.json +22 -0
  62. package/src/py/dynamodb/fast-api-connection/schema.json +18 -0
  63. package/src/py/dynamodb/mcp-server-connection/schema.json +22 -0
  64. package/src/py/dynamodb/schema.json +70 -0
  65. package/src/ts/agent/gateway-connection/schema.json +26 -0
  66. package/src/ts/dynamodb/agent-connection/schema.json +22 -0
  67. package/src/ts/dynamodb/mcp-server-connection/schema.json +22 -0
  68. package/src/ts/dynamodb/schema.json +70 -0
  69. package/src/ts/dynamodb/smithy-connection/schema.json +18 -0
  70. package/src/ts/dynamodb/trpc-connection/schema.json +18 -0
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Python Agent to DynamoDB
3
+ description: Connect a Python Agent to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#agent
6
+ targetType: py#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import Infrastructure from '@components/infrastructure.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+
14
+ The `connection` generator wires a <Link path="guides/py-agent">Python Agent</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
15
+
16
+ ## Prerequisites
17
+
18
+ Before using this generator, ensure you have:
19
+
20
+ 1. A <Link path="guides/py-agent">`py#agent`</Link> project
21
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
22
+
23
+ ## Usage
24
+
25
+ ### Run the Generator
26
+
27
+ <RunGenerator generator="connection" />
28
+
29
+ Select your Agent project as the source and your DynamoDB project as the target. If the project contains multiple agent components, specify `sourceComponent` to disambiguate.
30
+
31
+ ### Options
32
+
33
+ <GeneratorParameters generator="connection" />
34
+
35
+ ## Generator Output
36
+
37
+ The generator updates the agent's `<agent-name>-serve-local` target in `project.json` to depend on the DynamoDB project's `serve-local` target, and adds the DynamoDB package as a workspace dependency. No source files are modified.
38
+
39
+ ## Using DynamoDB in Agents
40
+
41
+ Import entity classes from the DynamoDB package and use them inside your agent tools:
42
+
43
+ ```python title="packages/my_project/my_project/my_agent/agent.py"
44
+ from my_scope.my_table.entities.example import ExampleModel
45
+ from strands import tool
46
+
47
+ @tool
48
+ def list_examples() -> list:
49
+ """List all example items."""
50
+ return [item.attribute_values for item in ExampleModel.scan()]
51
+ ```
52
+
53
+ ## Infrastructure
54
+
55
+ To allow the agent's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
56
+
57
+ <Infrastructure>
58
+ <Fragment slot="cdk">
59
+
60
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
61
+ import { MyTable } from ':my-scope/common-constructs';
62
+
63
+ const table = new MyTable(this, 'Table');
64
+ const myAgent = new MyAgent(this, 'MyAgent');
65
+
66
+ table.grantReadWriteData(myAgent);
67
+ ```
68
+
69
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the agent's execution role.
70
+ </Fragment>
71
+ <Fragment slot="terraform">
72
+
73
+ ```hcl title="packages/infra/src/main.tf"
74
+ module "my_table" {
75
+ source = "../../common/terraform/src/app/dynamodb/my-table"
76
+ }
77
+
78
+ resource "aws_iam_role_policy" "dynamodb_access" {
79
+ role = module.my_agent.lambda_role_name
80
+
81
+ policy = jsonencode({
82
+ Version = "2012-10-17"
83
+ Statement = [
84
+ {
85
+ Effect = "Allow"
86
+ Action = [
87
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
88
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
89
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
90
+ ]
91
+ Resource = [
92
+ module.my_table.table_arn,
93
+ "${module.my_table.table_arn}/index/*",
94
+ ]
95
+ },
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "kms:Encrypt",
100
+ "kms:Decrypt",
101
+ "kms:ReEncrypt*",
102
+ "kms:GenerateDataKey*",
103
+ "kms:DescribeKey"
104
+ ]
105
+ Resource = [module.my_table.kms_key_arn]
106
+ },
107
+ ]
108
+ })
109
+ }
110
+ ```
111
+ </Fragment>
112
+ </Infrastructure>
113
+
114
+ ## Local Development
115
+
116
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -0,0 +1,161 @@
1
+ ---
2
+ title: Python Agent to Gateway
3
+ description: Connect a Python Agent to an AgentCore Gateway
4
+ when:
5
+ sourceType: py#agent
6
+ targetType: agentcore-gateway
7
+ ---
8
+ import { FileTree } from '@astrojs/starlight/components';
9
+ import Link from '@components/link.astro';
10
+ import RunGenerator from '@components/run-generator.astro';
11
+ import GeneratorParameters from '@components/generator-parameters.astro';
12
+ import NxCommands from '@components/nx-commands.astro';
13
+ import Infrastructure from '@components/infrastructure.astro';
14
+
15
+ The `connection` generator can connect your <Link path="guides/py-agent">Python Agent</Link> to an <Link path="guides/agentcore-gateway">AgentCore Gateway</Link>.
16
+
17
+ The generator wires the agent so it authenticates to the Gateway with IAM SigV4 (via `httpx` request signing) when deployed, and connects to the local gateway started by the Gateway project when running locally.
18
+
19
+ ## Prerequisites
20
+
21
+ Before using this generator, ensure you have:
22
+
23
+ 1. A Python project with a <Link path="guides/py-agent">Agent</Link> component (`infra: agentcore`)
24
+ 2. A <Link path="guides/agentcore-gateway">`agentcore-gateway`</Link> project
25
+
26
+ ## Usage
27
+
28
+ ### Run the Generator
29
+
30
+ <RunGenerator generator="connection" />
31
+
32
+ Select the agent project as the source and the Gateway project as the target.
33
+
34
+ ### Options
35
+
36
+ <GeneratorParameters generator="connection" />
37
+
38
+ ## Generator Output
39
+
40
+ The generator emits shared core-gateway modules into your `agent_connection` Python project, plus a per-Gateway wrapper, and modifies your agent:
41
+
42
+ <FileTree>
43
+
44
+ - packages/common/agent\_connection
45
+ - \<scope>\_agent\_connection
46
+ - core/
47
+ - agentcore\_endpoints.py Framework-agnostic ARN/URL resolution
48
+ - agentcore\_gateway\_mcp\_transport.py Framework-agnostic Gateway MCP transport
49
+ - agentcore\_gateway\_mcp\_client\_strands.py Strands MCP client for the deployed Gateway
50
+ - auth/ Framework-agnostic SigV4 / session-forwarding `httpx.Auth`
51
+ - app/
52
+ - \<gateway\_snake>\_client\_strands.py Per-Gateway Strands client wrapper
53
+ - \_\_init\_\_.py Re-exports the Gateway client
54
+
55
+ </FileTree>
56
+
57
+ Additionally, the generator:
58
+
59
+ - Modifies your agent's `agent.py` to import the Gateway client, enter it via a `with` block, and register its tools in `tools`
60
+ - Adds `agent_connection` as a workspace dependency of the agent
61
+ - Wires the agent's `<agent>-serve-local` target to depend on the Gateway's `<gateway>-serve-local` aggregator
62
+
63
+ ## Using the connected Gateway
64
+
65
+ The generator transforms your agent's `agent.py` to use the Gateway client:
66
+
67
+ ```python title="packages/example/example/my_agent/agent.py" {4,8,9-13}
68
+ from contextlib import contextmanager
69
+ from strands import Agent
70
+
71
+ from my_scope_agent_connection import MyGatewayClientStrands
72
+
73
+ @contextmanager
74
+ def get_agent():
75
+ my_gateway = MyGatewayClientStrands.create()
76
+ with (
77
+ my_gateway,
78
+ ):
79
+ yield Agent(
80
+ system_prompt="...",
81
+ tools=[*my_gateway.list_tools_sync()],
82
+ )
83
+ ```
84
+
85
+ `MyGatewayClientStrands.create()` returns a single context-manageable client whose `list_tools_sync()` yields every tool available through the Gateway:
86
+
87
+ - **Deployed mode** (`SERVE_LOCAL` unset): a single `MCPClient` pointed at the Gateway's MCP endpoint, SigV4-signed.
88
+ - **Local mode** (`SERVE_LOCAL=true`): a plain-HTTP `MCPClient` pointed at the local gateway started by the Gateway project's `serve-local` target.
89
+
90
+ The session ID is propagated to downstream MCP servers automatically via the `X-Amzn-Bedrock-AgentCore-Runtime-Session-Id` header.
91
+
92
+ ## Infrastructure
93
+
94
+ After running the generator you must grant the agent permission to invoke the Gateway.
95
+
96
+ <Infrastructure>
97
+ <Fragment slot="cdk">
98
+ ```ts title="packages/infra/src/stacks/application-stack.ts" {5}
99
+ const gateway = new MyGateway(this, 'MyGateway');
100
+ const myAgent = new MyAgent(this, 'MyAgent');
101
+
102
+ // Grant the agent permissions to invoke the Gateway
103
+ gateway.grantInvokeAccess(myAgent);
104
+ ```
105
+
106
+ The Gateway URL is automatically registered in the `agentcore.gateways.<ClassName>` namespace of <Link path="guides/runtime-config">Runtime Configuration</Link> by the generated CDK construct, so the agent can discover it at runtime.
107
+ </Fragment>
108
+ <Fragment slot="terraform">
109
+ ```hcl title="packages/infra/src/main.tf" {12-24}
110
+ module "my_gateway" {
111
+ source = "../../common/terraform/src/app/gateways/my-gateway"
112
+ }
113
+
114
+ module "my_agent" {
115
+ source = "../../common/terraform/src/app/agents/my-agent"
116
+ }
117
+
118
+ # Grant the agent permission to invoke the Gateway
119
+ resource "aws_iam_policy" "agent_invoke_gateway" {
120
+ name = "AgentInvokeGatewayPolicy"
121
+ policy = jsonencode({
122
+ Version = "2012-10-17"
123
+ Statement = [{
124
+ Effect = "Allow"
125
+ Action = "bedrock-agentcore:InvokeGateway"
126
+ Resource = module.my_gateway.gateway_arn
127
+ }]
128
+ })
129
+ }
130
+
131
+ resource "aws_iam_role_policy_attachment" "agent_invoke_gateway" {
132
+ role = module.my_agent.agent_core_runtime_role_arn
133
+ policy_arn = aws_iam_policy.agent_invoke_gateway.arn
134
+ }
135
+ ```
136
+
137
+ The Gateway URL is automatically registered in the `agentcore.gateways.<ClassName>` namespace of <Link path="guides/runtime-config">Runtime Configuration</Link> by the generated Terraform module, so the agent can discover it at runtime.
138
+ </Fragment>
139
+ </Infrastructure>
140
+
141
+ ## Local Development
142
+
143
+ The generator configures the agent's `serve-local` target to:
144
+
145
+ 1. Start the connected Gateway's local gateway and every attached MCP server
146
+ 2. Set `SERVE_LOCAL=true` so the generated client points at the local gateway instead of the deployed Gateway
147
+
148
+ Run the agent locally with:
149
+
150
+ <NxCommands commands={["<agent-name>-serve-local <project-name>"]} />
151
+
152
+ To run the agent locally **against the deployed Gateway** instead (for example, to exercise Cedar policies), use the agent's `serve` target. Without `SERVE_LOCAL` set, the client resolves the deployed Gateway URL from runtime configuration and SigV4-signs requests with your local AWS credentials:
153
+
154
+ <NxCommands commands={["<agent-name>-serve <project-name>"]} />
155
+
156
+ ### Local fidelity
157
+
158
+ The local gateway stands in for the deployed Gateway, so:
159
+
160
+ - **No Cedar policy evaluation.** Every tool is visible to the agent regardless of policies. Use the `serve` target to exercise policies against the deployed Gateway.
161
+ - **Tool-name prefixing is preserved.** Each local MCP server's tools are exposed as `<target-name>___<tool-name>`, matching what the deployed Gateway emits. This keeps the agent's system prompt and the Cedar action names you reference consistent across local and deployed runs.
@@ -48,9 +48,12 @@ The generator creates a shared `agent_connection` Python project at `packages/co
48
48
  - \<scope>\_agent\_connection
49
49
  - \_\_init\_\_.py Re-exports per-connection clients
50
50
  - core
51
- - agentcore\_mcp\_client.py Core AgentCore MCP client
51
+ - agentcore\_endpoints.py Framework-agnostic ARN/URL resolution
52
+ - agentcore\_mcp\_transport.py Framework-agnostic MCP transport
53
+ - agentcore\_mcp\_client\_strands.py Strands MCP client wrapping the transport
54
+ - auth/ Framework-agnostic SigV4 / session-forwarding `httpx.Auth`
52
55
  - app
53
- - \<mcp\_server\_name>\_client.py Per-connection client for each MCP server
56
+ - \<mcp\_server\_name>\_client\_strands.py Per-connection Strands client for each MCP server
54
57
 
55
58
  </FileTree>
56
59
 
@@ -67,11 +70,11 @@ The generator transforms your agent's `agent.py` to use the MCP server's tools:
67
70
  from contextlib import contextmanager
68
71
  from strands import Agent
69
72
 
70
- from my_scope_agent_connection import MyMcpServerClient
73
+ from my_scope_agent_connection import MyMcpServerClientStrands
71
74
 
72
75
  @contextmanager
73
76
  def get_agent(session_id: str):
74
- my_mcp_server = MyMcpServerClient.create(session_id=session_id)
77
+ my_mcp_server = MyMcpServerClientStrands.create(session_id=session_id)
75
78
  with (
76
79
  my_mcp_server,
77
80
  ):
@@ -0,0 +1,56 @@
1
+ ---
2
+ title: FastAPI to DynamoDB
3
+ description: Connect a FastAPI to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#fast-api
6
+ targetType: py#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import Snippet from '@components/snippet.astro';
12
+
13
+ The `connection` generator wires a <Link path="guides/fastapi">FastAPI</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
14
+
15
+ ## Prerequisites
16
+
17
+ Before using this generator, ensure you have:
18
+
19
+ 1. A <Link path="guides/fastapi">`py#fast-api`</Link> project
20
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
21
+
22
+ ## Usage
23
+
24
+ ### Run the Generator
25
+
26
+ <RunGenerator generator="connection" />
27
+
28
+ Select your FastAPI project as the source and your DynamoDB project as the target.
29
+
30
+ ### Options
31
+
32
+ <GeneratorParameters generator="connection" />
33
+
34
+ ## Generator Output
35
+
36
+ The generator updates the FastAPI's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target, and adds the DynamoDB package as a workspace dependency. No source files are modified.
37
+
38
+ ## Using DynamoDB in Route Handlers
39
+
40
+ Import entity classes from the DynamoDB package and use them inside your route handlers:
41
+
42
+ ```python title="packages/my_api/my_api/api.py"
43
+ from my_scope.my_table.entities.example import ExampleModel
44
+
45
+ @app.get("/examples")
46
+ def list_examples():
47
+ return list(ExampleModel.scan())
48
+ ```
49
+
50
+ ## Infrastructure
51
+
52
+ <Snippet name="connection/lambda-dynamodb-access" />
53
+
54
+ ## Local Development
55
+
56
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: Python MCP Server to DynamoDB
3
+ description: Connect a Python MCP Server to a Python DynamoDB project
4
+ when:
5
+ sourceType: py#mcp-server
6
+ targetType: py#dynamodb
7
+ ---
8
+ import Link from '@components/link.astro';
9
+ import RunGenerator from '@components/run-generator.astro';
10
+ import GeneratorParameters from '@components/generator-parameters.astro';
11
+ import Infrastructure from '@components/infrastructure.astro';
12
+ import Snippet from '@components/snippet.astro';
13
+
14
+ The `connection` generator wires a <Link path="guides/py-mcp-server">Python MCP Server</Link> to a <Link path="guides/py-dynamodb">Python DynamoDB</Link> project, configuring local development so both start together automatically.
15
+
16
+ ## Prerequisites
17
+
18
+ Before using this generator, ensure you have:
19
+
20
+ 1. A <Link path="guides/py-mcp-server">`py#mcp-server`</Link> project
21
+ 2. A <Link path="guides/py-dynamodb">`py#dynamodb`</Link> project
22
+
23
+ ## Usage
24
+
25
+ ### Run the Generator
26
+
27
+ <RunGenerator generator="connection" />
28
+
29
+ Select your MCP server project as the source and your DynamoDB project as the target. If the project contains multiple MCP server components, specify `sourceComponent` to disambiguate.
30
+
31
+ ### Options
32
+
33
+ <GeneratorParameters generator="connection" />
34
+
35
+ ## Generator Output
36
+
37
+ 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, and adds the DynamoDB package as a workspace dependency. No source files are modified.
38
+
39
+ ## Using DynamoDB in Tools
40
+
41
+ Import entity classes from the DynamoDB package and use them inside your MCP server tools:
42
+
43
+ ```python title="packages/my_project/my_project/my_mcp_server/server.py"
44
+ from my_scope.my_table.entities.example import ExampleModel
45
+
46
+ @mcp.tool()
47
+ def list_examples() -> str:
48
+ """List all example items."""
49
+ items = list(ExampleModel.scan())
50
+ return str([item.attribute_values for item in items])
51
+ ```
52
+
53
+ ## Infrastructure
54
+
55
+ To allow the MCP server's Lambda function to access the DynamoDB table, grant the necessary permissions in your infrastructure.
56
+
57
+ <Infrastructure>
58
+ <Fragment slot="cdk">
59
+
60
+ ```ts title="packages/infra/src/stacks/application-stack.ts"
61
+ import { MyTable } from ':my-scope/common-constructs';
62
+
63
+ const table = new MyTable(this, 'Table');
64
+ const myMcpServer = new MyMcpServer(this, 'MyMcpServer');
65
+
66
+ table.grantReadWriteData(myMcpServer);
67
+ ```
68
+
69
+ `grantReadWriteData` grants both the DynamoDB and KMS permissions to the MCP server's execution role.
70
+ </Fragment>
71
+ <Fragment slot="terraform">
72
+
73
+ ```hcl title="packages/infra/src/main.tf"
74
+ module "my_table" {
75
+ source = "../../common/terraform/src/app/dynamodb/my-table"
76
+ }
77
+
78
+ resource "aws_iam_role_policy" "dynamodb_access" {
79
+ role = module.my_mcp_server.lambda_role_name
80
+
81
+ policy = jsonencode({
82
+ Version = "2012-10-17"
83
+ Statement = [
84
+ {
85
+ Effect = "Allow"
86
+ Action = [
87
+ "dynamodb:GetItem", "dynamodb:PutItem", "dynamodb:UpdateItem",
88
+ "dynamodb:DeleteItem", "dynamodb:Query", "dynamodb:Scan",
89
+ "dynamodb:BatchGetItem", "dynamodb:BatchWriteItem",
90
+ ]
91
+ Resource = [
92
+ module.my_table.table_arn,
93
+ "${module.my_table.table_arn}/index/*",
94
+ ]
95
+ },
96
+ {
97
+ Effect = "Allow"
98
+ Action = [
99
+ "kms:Encrypt",
100
+ "kms:Decrypt",
101
+ "kms:ReEncrypt*",
102
+ "kms:GenerateDataKey*",
103
+ "kms:DescribeKey"
104
+ ]
105
+ Resource = [module.my_table.kms_key_arn]
106
+ },
107
+ ]
108
+ })
109
+ }
110
+ ```
111
+ </Fragment>
112
+ </Infrastructure>
113
+
114
+ ## Local Development
115
+
116
+ <Snippet name="connection/py-dynamodb-local-development" />
@@ -21,7 +21,7 @@ The `connection` generator provides a way to quickly integrate your React websit
21
21
  Before using this generator, ensure your React application has:
22
22
 
23
23
  1. A `main.tsx` file that renders your application
24
- 2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#smithy-api` generator</Link>)
24
+ 2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#api` generator</Link> with `--framework=smithy`)
25
25
  3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
26
26
 
27
27
  <details>
@@ -175,7 +175,7 @@ Subscriptions are only supported when the tRPC API uses `rest-lambda` (REST API)
175
175
 
176
176
  When connecting to a REST API tRPC backend, the generated client is automatically configured with a `splitLink` that routes subscription operations through `httpSubscriptionLink` (using SSE) and regular queries/mutations through `httpLink`. This means subscriptions work out of the box with no additional configuration.
177
177
 
178
- For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc">`ts#trpc-api` generator guide</Link>.
178
+ For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc">tRPC API generator guide</Link>.
179
179
 
180
180
  #### Using the useSubscription Hook
181
181
 
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Smithy API to DynamoDB
3
+ description: Connect a Smithy API to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: smithy
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import { FileTree } from '@astrojs/starlight/components';
9
+ import Link from '@components/link.astro';
10
+ import RunGenerator from '@components/run-generator.astro';
11
+ import GeneratorParameters from '@components/generator-parameters.astro';
12
+ import NxCommands from '@components/nx-commands.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your Smithy API backend project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your Smithy API's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Operations
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your operation implementations:
43
+
44
+ ```ts title="packages/api/src/operations/list-examples.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import {
47
+ ListExamplesOperationInput,
48
+ ListExamplesOperationOutput,
49
+ } from '../generated/ssdk/index.js';
50
+ import { ServiceContext } from '../context.js';
51
+
52
+ export const listExamples = async (
53
+ _input: ListExamplesOperationInput,
54
+ _ctx: ServiceContext,
55
+ ): Promise<ListExamplesOperationOutput> => {
56
+ const entity = await createExampleEntity();
57
+ const result = await entity.scan.go();
58
+ return { items: result.data };
59
+ };
60
+ ```
61
+
62
+ ## Infrastructure
63
+
64
+ <Snippet name="connection/lambda-dynamodb-access" />
65
+
66
+ ## Local Development
67
+
68
+ <Snippet name="connection/dynamodb-local-development" />
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API<
18
18
 
19
19
  Before using this generator, ensure you have:
20
20
 
21
- 1. A <Link path="guides/ts-smithy-api">`ts#smithy-api`</Link> project (TypeScript backend)
21
+ 1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
22
22
  2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
23
23
 
24
24
  ## Usage
@@ -0,0 +1,62 @@
1
+ ---
2
+ title: tRPC API to DynamoDB
3
+ description: Connect a tRPC API to a TypeScript DynamoDB project
4
+ when:
5
+ sourceType: ts#trpc-api
6
+ targetType: ts#dynamodb
7
+ ---
8
+ import { FileTree } from '@astrojs/starlight/components';
9
+ import Link from '@components/link.astro';
10
+ import RunGenerator from '@components/run-generator.astro';
11
+ import GeneratorParameters from '@components/generator-parameters.astro';
12
+ import NxCommands from '@components/nx-commands.astro';
13
+ import Snippet from '@components/snippet.astro';
14
+
15
+ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
16
+
17
+ ## Prerequisites
18
+
19
+ Before using this generator, ensure you have:
20
+
21
+ 1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
22
+ 2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
23
+
24
+ ## Usage
25
+
26
+ ### Run the Generator
27
+
28
+ <RunGenerator generator="connection" />
29
+
30
+ Select your tRPC API project as the source and your DynamoDB project as the target.
31
+
32
+ ### Options
33
+
34
+ <GeneratorParameters generator="connection" />
35
+
36
+ ## Generator Output
37
+
38
+ The generator updates your tRPC API's `project.json` to add a dependency from its `serve-local` target to the DynamoDB project's `serve-local` target. No source files are modified.
39
+
40
+ ## Using DynamoDB in Procedures
41
+
42
+ Import entity factories from the DynamoDB package and use them inside your tRPC procedures:
43
+
44
+ ```ts title="packages/api/src/procedures/example.ts"
45
+ import { createExampleEntity } from ':my-scope/my-table';
46
+ import { publicProcedure } from '../init.js';
47
+
48
+ export const listExamples = publicProcedure
49
+ .query(async () => {
50
+ const entity = await createExampleEntity();
51
+ const result = await entity.scan.go();
52
+ return result.data;
53
+ });
54
+ ```
55
+
56
+ ## Infrastructure
57
+
58
+ <Snippet name="connection/lambda-dynamodb-access" />
59
+
60
+ ## Local Development
61
+
62
+ <Snippet name="connection/dynamodb-local-development" />
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a
18
18
 
19
19
  Before using this generator, ensure you have:
20
20
 
21
- 1. A <Link path="guides/trpc">`ts#trpc-api`</Link> project
21
+ 1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
22
22
  2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
23
23
 
24
24
  ## Usage