Skip to content

feat(ts#rdb): add relational database support#552

Open
AlexTo wants to merge 5 commits intoawslabs:mainfrom
AlexTo:ts-rdb
Open

feat(ts#rdb): add relational database support#552
AlexTo wants to merge 5 commits intoawslabs:mainfrom
AlexTo:ts-rdb

Conversation

@AlexTo
Copy link
Copy Markdown
Contributor

@AlexTo AlexTo commented Apr 6, 2026

Reason for this change

Currently, nx-plugin-for-aws provides generators for vending APIs, but it does not yet support generators for vending databases.
There are reference implementations available, such as the Prisma + Lambda CDK example:
https://github.com/aws-samples/prisma-lambda-cdk
However, adapting these examples to our framework comes with a few gotchas:

  • Ensuring the ORM client is automatically regenerated during the build process
  • Managing infrastructure required for database migrations
  • Enabling APIs to properly connect to RDB packages
  • Defining Nx targets that make it easy to work with one or multiple databases

Description of changes

  • Create a new ts#rdb generator to generate a Typescript database project
  • Provide documentation on how to use the generator

Description of how you validated changes

  • Unit tests
  • Manual testing
    • Generate an RDB package using CDK with Aurora PostgreSQL, along with a tRPC API package. Deploy it to AWS and verify that the resources are created correctly, migrations run successfully, and the API can connect to the database.
    • Generate an RDB package using CDK with Aurora MySQL, along with a tRPC API package. Deploy it to AWS and verify that the resources are created correctly, migrations run successfully, and the API can connect to the database.

Issue # (if applicable)

Closes #485 .

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.11111% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.38%. Comparing base (c152caa) to head (36e32f7).

Files with missing lines Patch % Lines
packages/nx-plugin/src/ts/rdb/generator.ts 93.33% 1 Missing and 1 partial ⚠️
...-plugin/src/utils/rdb-constructs/rdb-constructs.ts 86.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #552      +/-   ##
==========================================
+ Coverage   89.35%   89.38%   +0.02%     
==========================================
  Files          94       96       +2     
  Lines        3166     3211      +45     
  Branches      701      708       +7     
==========================================
+ Hits         2829     2870      +41     
- Misses        156      158       +2     
- Partials      181      183       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(ts#rdb): new generator to vend packages for relational database support

2 participants