Skip to main content

Backend Module Map

This document maps key backend directories to ownership of concerns.

Core Runtime

  • src/server.ts: app bootstrap entrypoint.
  • src/server/registerGraphQL.ts: GraphQL registration and execution instrumentation.
  • src/server/registerWebApp.ts: app route registration and middleware.
  • src/config.ts: environment/configuration loading.

Data / GraphQL

  • src/data/schema.ts: root GraphQL schema assembly.
  • src/data/queries/**: read-side resolver logic.
  • src/data/mutations/**: write-side resolver logic.
  • src/data/types/**: GraphQL object types and transformation helpers.
  • src/data/permissions.ts: access control gate definitions.

Application Layer

  • src/application/services/**: use-case services.
  • src/application/repositories/**: repository contracts used by services/resolvers.

Infrastructure Layer

  • src/infrastructure/prisma/PrismaUnitOfWork.ts: transaction-scoped repository composition.
  • src/infrastructure/prisma/repositories/**: Prisma-backed repository implementations.

Workflow Engine

  • src/core/workflow/BaseWorkflow.ts: generic workflow behavior.
  • src/core/workflow/ReservationWorkflow.ts: reservation state machine and transitions.
  • src/core/workflow/DocumentApprovalWorkflow.ts: document approval state machine.
  • src/core/workflow/WorkflowDispatcher.ts: workflow routing and execution entrypoint.
  • src/core/workflow/notificationConfig.ts: action/status notification matrix.

Payments

  • src/core/payment/**: payment orchestration, payouts, refunds, date blocking helpers.
  • src/libs/payment/stripe/**: Stripe API-specific helpers.
  • src/libs/payment/paymob/**: Paymob types and integration helpers.
  • src/libs/payment/paypal/**: PayPal helpers/routes.

Messaging and Notifications

  • src/core/email/**: templates, modules, rendering, and send pipeline.
  • src/core/socket/**: socket routes and send helpers.
  • src/core/pushNotifications/**: push notification formatting/split logic.
  • src/libs/pushNotificationRoutes.ts: push notification HTTP route wiring.

Support Modules

  • src/core/cron/**: scheduled jobs.
  • src/core/auth/**: auth provider routes and token logic.
  • src/core/listing/**: listing readiness/domain helpers.
  • src/helpers/**: utility functions used across layers.
  • src/libs/**: middleware, auth helpers, integration wrappers.

Generated Documentation

  • Workflows and notification docs are generated by:
    • scripts/generate-workflow-docs.ts
    • scripts/generateNotificationReadme.ts
  • TypeScript API docs are generated by:
    • typedoc.json
    • script: yarn workspace @adamondo/backend generate:docs:api