Repository navigation
refactor(api): repository layer + minimal domain extraction - #9
Merged
Merged
Conversation
Repository ports + Drizzle adapters for apps/api (no domain layer yet). Executor pattern preserves the one-transaction outbox write and RLS scoping. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8 tasks: Executor foundation + one repository (port + Drizzle adapter) per module, services keep withTenant/logic, boundary-verification sweep. Refactor under the existing green integration suite (no new tests). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ue object Extract the genuinely-pure domain bits into a framework-free apps/api/src/domain/ (no NestJS, no Drizzle): buildSubmissionReceivedEvent/rebuildRetryEvent (outbox payloads), canRetryDelivery (retry rule), and an EndpointSecret value object. Services call these instead of inlining; they keep owning transactions + HTTP errors. Adds pure unit tests (nothing to mock). No behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructures
apps/apiinto clean layers — no behavior change (pure structural refactor verified against the existing integration suite).Repository layer (ports + Drizzle adapters)
Executortype +poolExecutor()in@eventform/db— a Drizzle handle that's tx-bound for atomic work or pool-bound for anonymous reads.drizzle-ormis now imported only in*.repository.drizzle.tsadapters — no service imports it.Executor— honest signatures, no RLS foot-gun.Minimal domain layer (framework-free, no entities/mappers)
apps/api/src/domain/:buildSubmissionReceivedEvent/rebuildRetryEvent(outbox payloads),canRetryDelivery(retry rule), and anEndpointSecretvalue object.Design decisions
submit(submission + N deliveries + N outbox) and deliveriesretry(delivery update + outbox insert) each stay in onewithTenanttransaction.withTenant(SET LOCAL app.tenant_id); the anonymous published-form read runs on the pool so public-read policies apply.left inline on purpose.
Spec + implementation plan included under
docs/superpowers/.Test plan
pnpm --filter @eventform/db test→ 12/12pnpm --filter @eventform/api test→ 68/68 (62 integration + 6 new pure domain unit tests)db+api); domain layer verified free of NestJS/Drizzle/pg🤖 Generated with Claude Code