Skip to content
Flows
Add Direct Messaging Feature
App Builder90-120 minutes
0/7 steps0%

Step 1 of 7

Design Message & Conversation Data Model

Create database structures to store chats and individual messages

💡

The app uses Prisma with a PostgreSQL database. Existing User model has id (UUID). Follow current project conventions for migrations and naming.

Prompt capsule

Write Prisma schema definitions for two new models: Conversation (id UUID primary key, participantAId UUID, participantBId UUID, createdAt timestamp, updatedAt timestamp) and Message (id UUID primary key, conversationId UUID foreign key, senderId UUID foreign key, content String, sentAt timestamp, read Boolean default false). Add necessary indexes for fast lookup (e.g., participant pair, conversationId). Provide the exact lines to insert into schema.prisma and a migration command (prisma migrate dev). Ensure the models reference the existing User model correctly and compile without errors.

Paste into Claude · Complete implementation prompt with explicit requirements

Expected after this step

schema.prisma contains Conversation and Message models; `prisma migrate dev` runs successfully; database tables are created.

Should not happen

  • AI returns placeholder schemas or TODO comments instead of real Prisma models.
  • Generated API routes lack proper authentication checks or return mock data.
  • UI component uses static sample messages rather than fetching from the API.
  • Missing migration for new fields (e.g., readAt) causing runtime errors.

Verify before continuing

Do not move on until every check is true. The complete button stays locked until then.

Do not continue if…

  • !AI returns placeholder schemas or TODO comments instead of real Prisma models.
  • !Generated API routes lack proper authentication checks or return mock data.
  • !UI component uses static sample messages rather than fetching from the API.
  • !Missing migration for new fields (e.g., readAt) causing runtime errors.
  • !Polling logic omitted or duplicates messages on each fetch.

If the AI messes this up

Use this when the AI fakes progress or breaks the feature. It forces a real fix.

The schema definitions were incomplete or contained placeholder comments. Regenerate the full Conversation and Message model blocks with all required fields, indexes, and foreign keys, and include a runnable `prisma migrate dev` command.

Your notes for this step