Back to Bricks

Follow System

Social

Social graph functionality. Allow users to follow each other, list followers, and see who they are following.

socialfollowconnectionsnetworkAuth Required
Backend:
prisma/schema.prismajavascript
1model Follow {
2 id String @id @default(uuid())
3 followerId String
4 followingId String
5 createdAt DateTime @default(now())
6}

Paste Guide

Copy files to:

prisma/schema.prisma (append models)repositories/follow.repo.jscontrollers/followController.jsroutes/followRoutes.js

Add to server.js:

app.use('/api/follow', require('./routes/followRoutes'));

Stack

PrismaExpress

Test Examples

curl -X POST http://localhost:5000/api/follow \
  -H "Authorization: Bearer TOKEN" \
  -d '{"targetUserId": "id_here"}'
curl -X DELETE http://localhost:5000/api/follow/target_id \
  -H "Authorization: Bearer TOKEN"