ServiceCortex

Developer Documentation

Architecture, API contracts, and contribution guidelines for ServiceCortex

Developer Documentation

Welcome to the ServiceCortex developer documentation. This is the internal reference for engineers building and maintaining the platform.

ServiceCortex is a Level 4 Modular Monolith built with Hexagonal Architecture on NestJS. The system comprises 30 domain modules, 147,831 lines of TypeScript, and a hybrid API strategy using GraphQL, REST, and WebSocket.

What you will find here

Quick orientation

LayerPurposeExample
apps/apiNestJS backend — all business logicsrc/jobs/flows/job.flow.ts
apps/webNext.js primary frontendDashboard, CRM, scheduling UI
apps/portalNext.js client portalClient-facing document signing, payments
apps/marketingNext.js marketing sitePublic pages, lead capture
apps/docsFumadocs documentation siteThis site
packages/api-contractsShared types, error codes, Zod schemasJobsErrorCode, CreateJobInput
packages/authz-coreAuthorization enginePermission definitions, role resolution
packages/pricing-corePricing evaluation engineFormula parsing, pricing rules
packages/shared-typesCross-package TypeScript typesShared interfaces
packages/shared-utilsCross-package utilitiesCommon helpers

Key numbers

  • 30 Level 4 modules with hexagonal architecture
  • 134 flow files (use case orchestrators)
  • 85 repository adapters
  • 60 domain policies (pure business rules)
  • 68 HTTP controllers
  • 35 GraphQL resolvers
  • 15 event listeners

If you are onboarding, read the Architecture Overview first, then the Backend Constitution. Those two documents explain every decision in the codebase.

On this page