Prisma migrations
8
Project Detail
A modular GraphQL API server implementing a social networking backend: users, follow graph, posts with images, comments, reactions, notifications, direct/group messaging (chatrooms), and real-time subscriptions. Provides a single backend s...
Prisma migrations
8
DB models
11
GraphQL schema types (approx)
~50
Single source of truth (TypeScript types -> schema), tight integration with NestJS dependency injection and guards.
Trade-off: Faster developer experience and type-safety vs larger generated schema artifact; requires extra care to keep DTOs/resolvers performant (no schema stitching).
Strong TypeScript integration, migration history, and expressive relation modeling. Unique/index constraints (e.g., @@unique([postId, createdById])) encode idempotency rules.
Trade-off: Abstraction simplifies queries but can hide SQL optimizations; for complex reporting queries raw SQL or materialized views may be required.
Enables multi-instance deployment without in-process pubsub; Redis offers low-latency fan-out and familiar operational model.
Trade-off: Redis cluster adds operational cost; developer must ensure message topology and retention are managed; subscriber reconnection semantics must be hardened.
Provides a single backend service that manages social data (profiles, feed, chat, notifications) with realtime updates and strong type safety for clients.
Monolithic, modular NestJS application using an event-driven style internally (CQRS + EventEmitter) with external real-time delivery via Redis Pub/Sub and GraphQL Subscriptions.
Key measurable signals: Prisma migrations (8), DB models (11), GraphQL schema types (approx) (~50).
| Dimension | Selected Option | Impact | Compromise |
|---|---|---|---|
| API protocol | GraphQL (code-first) + websocket subscriptions | Strong typing, flexible client-driven queries, native realtime push | More complex server-side resolver performance concerns and over-fetching prevention must be managed |
| Data access | Prisma ORM on PostgreSQL | Type-safe queries, fast iteration, migrations versioned | Complex analytical queries may need raw SQL or separate OLAP store |
Add distributed tracing (OpenTelemetry) and metrics (Prometheus) to correlate GraphQL operations, DB queries, and Redis pub/sub latency.
Introduce a durable background job queue (e.g., BullMQ / Redis Streams) for side effects (email, push notifications, heavy denormalizations) to improve resiliency and allow retries with dead-lettering.