Skip to content

User management Service

Francois edited this page Mar 8, 2026 · 1 revision

Users Service (Profiles + Friends)

Brief overview of the Users service

Architecture

Layered architecture:

Request -> Routes -> Controllers -> Services -> Data (Prisma)

Responsibilities

  • Routes: endpoint declaration + schema binding (Zod)
  • Controllers: HTTP orchestration (request/response, events)
  • Services: business rules, validation, conflict checks
  • Data layer: Prisma persistence + upload file write

Cross-service flow

  • Gateway validates JWT and injects x-user-id / x-user-name.
  • Users service reads those headers in preHandler.
  • Profile lifecycle events are pushed to Redis stream user.events (USER_CREATED, USER_UPDATED, USER_DELETED).

Dependencies

Core runtime

  • fastify
  • fastify-type-provider-zod
  • zod
  • @prisma/client
  • @fastify/multipart
  • file-type
  • ioredis

API

Public base path through gateway: /api/users Resources : profiles, users cf Doc

Tests

Current test coverage exists at 3 levels: controllers (with injection of http request), unit tests for service and data layers.

Shared Core Topic (@transcendence/core)

Purpose

Using shared core avoids type/schema drift between services and keeps error handling consistent.

What is shared

  • DTO and schema contracts: profile/friend payloads and response schemas, reused by frontend
  • Error model: AppError + ERR_DEFS
  • Common constants: log actions/resources, event names

๐Ÿ—๏ธ Architecture

๐ŸŒ Web Technologies

Backend

Frontend

๐Ÿ”ง Core Technologies

๐Ÿ” Security

โ›“๏ธ Blockchain

๐Ÿ› ๏ธ Dev Tools & Quality


๐Ÿ“ Page model

Clone this wiki locally