feat: wire convex data foundations

This commit is contained in:
2026-06-04 10:30:05 +02:00
parent df7a955736
commit 011e35cb17
62 changed files with 6335 additions and 14 deletions

View File

@@ -1,9 +1,10 @@
---
id: TASK-2
title: Wire Convex data and storage foundations
status: To Do
status: In Progress
assignee: []
created_date: '2026-06-03 19:12'
updated_date: '2026-06-04 07:55'
labels:
- mvp
- backend
@@ -24,19 +25,28 @@ Configure Convex Cloud for the MVP and define the core persistence model for cam
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Convex is connected to the Next.js app with generated types available
- [ ] #2 Core tables exist for campaigns, leads, audits, outreach, blacklist, run logs, and settings metadata
- [ ] #3 Convex File Storage is ready for desktop and mobile screenshots
- [ ] #4 Run-status and error-log concepts are represented so background jobs are observable
- [ ] #5 No API keys or secrets are stored in user-editable database records
- [x] #1 Convex is connected to the Next.js app with generated types available
- [x] #2 Core tables exist for campaigns, leads, audits, outreach, blacklist, run logs, and settings metadata
- [x] #3 Convex File Storage is ready for desktop and mobile screenshots
- [x] #4 Run-status and error-log concepts are represented so background jobs are observable
- [x] #5 No API keys or secrets are stored in user-editable database records
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Add Convex project configuration and connect it to the app.
2. Define schemas for Campaign, Lead, Audit, Outreach, BlacklistEntry, and AgentRun.
3. Add storage conventions for screenshot files and audit assets.
4. Add basic queries/mutations for creating and reading core records.
5. Verify Convex generation and typechecking work locally.
1. Preserve existing Convex env/setup and install the Convex package if missing.
2. Use TDD for shared Convex domain constants and secret-key guards.
3. Define the Convex schema, indexes, storage metadata, and bounded functions.
4. Wire the Next.js App Router root through a Convex client provider.
5. Verify with pnpm test, pnpm lint, Convex generation, and pnpm build.
6. Check acceptance criteria after verification, but do not mark Done until user confirmation.
<!-- SECTION:PLAN:END -->
## Implementation Notes
<!-- SECTION:NOTES:BEGIN -->
Started implementation on branch codex-task-2-convex-foundations. Existing .env.local Convex values and generated AI guidance will be preserved.
Verified TASK-2 acceptance criteria with pnpm test, pnpm lint, pnpm exec convex codegen --dry-run --typecheck enable, pnpm dlx convex dev --once, and pnpm build. Subagent spec review found no compliance issues. Code-quality review findings were addressed for slug uniqueness, safe settings listing, structured payloads, normalized list limits, generated lint ignores, and Convex tsconfig. Residual risk: public Convex functions remain unauthenticated until TASK-3 adds Better Auth, so deployment should remain internal/non-public until auth is wired.
<!-- SECTION:NOTES:END -->