Skip to content
Flows
Add Activity Feed Feature
App Builder60-90 minutes
0/6 steps0%

Step 1 of 6

Define Activity data model

Create a durable schema for storing activity events

💡

App uses Node.js/Express backend with Prisma ORM and PostgreSQL. Existing Prisma schema already has a User model.

Prompt capsule

In the project's prisma/schema.prisma file, add a new model named Activity with the following exact fields and attributes: 1. id Int @id @default(autoincrement()) 2. userId Int // foreign key to User.id 3. type String // short descriptor of the action (e.g., "post_created") 4. payload Json // any additional data needed for the UI 5. createdAt DateTime @default(now()) After defining the model, add a relation to the existing User model: `user User @relation(fields: [userId], references: [id], onDelete: Cascade)`. Run `npx prisma migrate dev --name add-activity-model` to generate and apply the migration. Finally, run `npx prisma generate` to refresh the client. Verify the migration SQL creates a table named "Activity" with the specified columns and foreign key.

Paste into Claude · Complete implementation prompt with explicit requirements

Expected after this step

prisma/schema.prisma contains a complete Activity model, a migration file exists, `prisma migrate dev` runs without error, and the PostgreSQL database has an Activity table.

Should not happen

  • AI returns a model definition but omits the foreign key or migration steps.
  • API code contains placeholder comments instead of real Express routes.
  • Activity creation is only logged to console, not persisted.
  • React component uses static mock data rather than calling the real endpoint.

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 a model definition but omits the foreign key or migration steps.
  • !API code contains placeholder comments instead of real Express routes.
  • !Activity creation is only logged to console, not persisted.
  • !React component uses static mock data rather than calling the real endpoint.
  • !Integration tests mock the database instead of exercising the real API.
  • !Self‑audit sections are missing or contain generic statements.

If the AI messes this up

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

The Activity model was not added or the migration failed. Re‑create the Activity model exactly as specified, ensure the foreign key to User is present, run `prisma migrate dev` with a proper name, and verify the table exists in PostgreSQL.

Your notes for this step