Build the Real Home Experience
18 min read
Build the Home Data Queries
Build the Home Data Queries
Task
Create the server-side data needed by Home.
The Home view should be assembled from authenticated, user-owned records rather than a second copy of mock data.
Typical query groups include:
const [recentBooks, recentProgress, recentHighlights] =
await Promise.all([
prisma.book.findMany({
where: { userId: user.id },
orderBy: { updatedAt: "desc" },
take: 6,
}),
prisma.readingProgress.findMany({
where: { userId: user.id },
orderBy: { updatedAt: "desc" },
take: 6,
include: { book: true },
}),
prisma.highlight.findMany({
where: { userId: user.id },
orderBy: { createdAt: "desc" },
take: 6,
include: { book: true },
}),
]);
Adapt the relations to the actual Prisma schema.
Keep Home-specific query composition out of individual visual cards.
Test
Sign in with an account containing several Books and progress records.
Confirm Home receives only that user’s records.
Checkpoint
Home has a dedicated real-data boundary composed from the existing Readly models.