Skip to content

Brain

Brain

Responsibility

Brain is the NestJS service for generation records, character metadata, provider integrations, queue-backed generation workflows, and Prisma-owned data in the fennec schema.

Runtime

Brain runs as a NestJS HTTP and gRPC service. It exposes a gRPC microservice consumed by sirloin through the generated Brain client and calls round over gRPC for model-serving work.

Primary Source Paths

  • apps/brain/src/modules/
  • apps/brain/src/generated/
  • apps/brain/prisma/schema.prisma

Contracts And Generated References

  • Brain gRPC server setup lives in apps/brain/src/main.ts.
  • Round generated client code lives under apps/brain/src/generated/round/.
  • Sirloin consumes Brain through apps/sirloin/pkg/brain-client/.

Generation and provider decisions live under docs/src/content/docs/decisions/ as they are migrated.

Operations

Brain uses BullMQ/Redis for async generation workflows and PostgreSQL via Prisma for the fennec schema.

Local Commands

  • cd apps/brain && pnpm lint
  • cd apps/brain && pnpm tsc
  • cd apps/brain && pnpm test
  • cd apps/brain && pnpm start:dev