Phase 1: Foundation — CRM, contacts, team, import, agent flag, audit#1
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…remove default SVGs
Adds Prisma 7 with PostgreSQL, a docker-compose dev environment, and the PrismaClient singleton. Uses prisma.config.ts (Prisma 7 requirement) with pg adapter and dotenv for .env auto-loading. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds CI pipeline with Postgres service, Prisma 7 env handling (writes apps/web/.env before Prisma commands), lint, typecheck, unit tests, schema push, and Playwright E2E tests. Includes phase-1-foundation in push triggers to enable CI on this branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add full initial schema with Workspace, User (Role enum, soft-delete, unique email per workspace), Contact, Invitation, ImportBatch, and AuditEvent models. Migration includes a manually-appended partial unique index enforcing one owner per workspace (users_workspace_id_role_owner_idx). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Install next-auth@beta (v5), @auth/prisma-adapter, zod - Add Auth.js Prisma adapter tables (Account, Session, VerificationToken) with migration auth_tables - Configure Auth.js v5 with JWT session strategy and Credentials provider backed by Argon2id password verification - Add session type augmentation for role and workspaceId in next-auth.d.ts - Mount /api/auth/[...nextauth] route handler - Build login page using React 19 useActionState with server action Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add auth-gated (dashboard) route group with AppShell sidebar/header, LogoutButton client component, SessionProvider wrapper, contacts placeholder page, and e2e redirect test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds prisma/seed.ts that bootstraps the first workspace and owner account on a fresh DB, with idempotency guard. Seed config moved to prisma.config.ts (Prisma 7 style). Adds tsx devDependency to run the TypeScript seed script. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Expand Contact and ImportBatch from stubs to full models, add contacts_full migration with partial unique index enforcing one active contact per (workspace, owner, email), configure Vitest dotenv setup, and add contact uniqueness integration tests (2 passing). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements listContactsForUser, getContactForUser, softDeleteContact, and updateContact with owner/admin seeing all contacts, members seeing only their own. 3 unit tests verify visibility rules. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add contacts list page with role-scoped table, and detail page with inline edit form and soft-delete action (Task 12). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements createInvitation, acceptInvitation, revokeInvitation, and listInvitations with admin/owner role gating, token generation, expiry enforcement, and idempotency checks. All 5 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add parseImportFile() and ParsedRow type to lib/excel.ts, with header validation and empty-row filtering. Includes 4 unit tests (TDD). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Expand AuditEvent schema with action, entityType, entityId, payload columns - Add audit_full_columns migration - Implement performImport with own-duplicate skip, colleague-overlap warning, email/instagram validation, file SHA-256 hashing, and audit trail - Implement findPriorImportBatch for re-import detection - 6 unit tests covering all dedup and validation branches Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements activateAgent/deactivateAgent server functions using a serializable transaction with FOR UPDATE to prevent concurrent double-activation of the same influencer by different team members. Adds AgentToggle client component, /api/contacts/[id]/agent route, and replaces the read-only checkbox in the contacts list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds writeAudit helper and wires audit events into all mutations: contacts (updated/deleted), users (role_changed/deactivated), invitations (invited/joined/revoked), and auth (login/failed_login). Adds /audit admin page with actor/action filters and a coverage test verifying all 6 mutation action types are recorded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- globalSetup resets + re-seeds DB before every Playwright run (deterministic owner@test.com / test1234) - import-flow and invitation-flow e2e specs; all 4 tests pass - seed.ts honours ADMIN_INIT_PASSWORD env override - Multi-stage production Dockerfile (deps → builder → runner) - docker-compose.yml for production (separate from docker-compose.dev.yml) - .env.example gains DB_PASSWORD for production compose - README.md with quick-start, dev setup, and test instructions Co-Authored-By: Claude Sonnet 4.6 <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
Implements all 25 tasks of Phase 1 per the design spec and implementation plan.
What ships
Stack: Next.js 16 (App Router) + TypeScript + Tailwind + Prisma 7 + PostgreSQL 16 + Auth.js v5 (Argon2id) + Vitest + Playwright + GitHub Actions.
Core features:
8 UI screens: Login, Contacts list, Contact detail, Excel import, Import report, Team management, Invitation acceptance, Audit log.
Deploy: Multi-stage
Dockerfile+ productiondocker-compose.yml+.env.example+ README quickstart.Test plan
phase-1-foundation(lint, typecheck, unit tests, e2e)docker compose up -d→ log in with seeded owner → import sample Excel → verify report buckets → activate agent flag → check audit logOut of scope (future phases)
Phase 2: briefs + LLM-generated outreach emails + sending engine.
Phase 3: inbox polling + response classification + buckets.
Phase 4: closed-loop negotiation agent.
Phase 5: public-profile scraping for style adaptation.
Phase 6: Instagram DM channel.
Notable adaptations from plan
prisma.config.ts+@prisma/adapter-pgdriver-adapter pattern.useActionState(instead of deprecateduseFormState).AUTH_SECRET/AUTH_URL(wasNEXTAUTH_*).prisma migrate deployin CI (notdb push) so the manually-appended partial unique indexes apply.