Skip to content

feat!: migrate to pnpm workspaces monorepo with Aurora DSQL and Drizzle ORM#126

Draft
konokenj wants to merge 6 commits intomainfrom
dev/v3
Draft

feat!: migrate to pnpm workspaces monorepo with Aurora DSQL and Drizzle ORM#126
konokenj wants to merge 6 commits intomainfrom
dev/v3

Conversation

@konokenj
Copy link
Contributor

WIP: pnpm workspaces monorepo + Aurora DSQL + Drizzle ORM migration.

Closes #98, closes #91.

See .kiro/specs/pnpm-workspaces/plan.md for full design.

…le ORM

Replace the single-package npm project with a pnpm workspaces monorepo,
migrate from Aurora Serverless v2 + Prisma to Aurora DSQL + Drizzle ORM,
and replace ESLint + Prettier with oxlint + oxfmt.

Architecture:
- apps/webapp (Next.js), apps/async-job (Lambda), apps/cdk (CDK infra)
- packages/db (Drizzle schema, DSQL client, migration runner)
- packages/shared-types (job payload Zod schemas)

Database:
- Aurora DSQL with IAM auth (no VPC, no NAT, no Bastion)
- Drizzle ORM with relations() for joins (no FK, DSQL constraint)
- Custom migration runner: hash verification, 1 DDL/tx, DSQL SQL validation
- dsql-migrator CDK Construct: Docker Lambda + CDK Trigger for deploy-time migration

Tooling:
- oxlint with type-aware linting (oxlint-tsgolint) replaces ESLint + tsc --noEmit
- oxfmt with .oxfmtrc.json matching original .prettierrc (singleQuote, printWidth 120)
- shamefully-hoist removed; missing implicit deps made explicit

Docker:
- All Dockerfiles use pnpm install (no --filter) for strict mode compatibility
- esbuild bundles to .mjs (Lambda ESM requirement)
- IgnoreMode.DOCKER on all Docker assets to read root .dockerignore
- Verified: all 3 images build and respond to Lambda RIE invocations

Refs: #98, #91, discussion #94
…gration

- Fix client.ts: use Proxy for lazy db singleton to prevent crash when
  getPool is imported without DSQL_ENDPOINT set (e.g. migration CLI)
- Fix migrate script: add --env-file=.env to load DSQL credentials
- Document VPC ENI cleanup workaround in migration guide for v2→v3
  update scenario where Lambda ENIs block security group deletion
Replace the flat checklist with 8 incremental stages (12a-12h):
static checks → build → local Docker build → local migration →
local dev server e2e → cdk deploy → deployed e2e → Lambda migration.

Each stage catches a different class of bugs that later stages cannot
surface efficiently. Documents known issues (VPC ENI cleanup) at the
stage where they manifest.
…heck

- Add drizzle-kit as devDependency with drizzle.config.ts
- Add check-dsql-compat.ts validator (runs after generate)
- Add 'generate' pnpm script: drizzle-kit generate && check
- Initialize drizzle-kit snapshot from existing 0001_initial.sql
- Document schema change workflow in AGENTS.md
check-dsql-compat.ts now auto-fixes:
- statement-breakpoint → blank lines (runner splits on \n\n)
- CREATE INDEX → CREATE INDEX ASYNC
- Removes REFERENCES / FOREIGN KEY lines

Still errors on unfixable patterns: ALTER COLUMN TYPE, DROP COLUMN, SERIAL.
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.

pnpm workspaces でモノレポ化 Use Aurora DSQL instead of Aurora Serverless v2

1 participant