Skip to content

HocTapAZ Service Responsibility Matrix

Status: canonical responsibility map for Go microservices

This document is the source of truth for service ownership. Frontend apps call only api-gateway or an approved BFF. Services own their own databases and must not read each other's databases.

The current Go platform intentionally splits attempt-service out of the broader exam domain and analytics-service out of operational/admin reporting. They are canonical service rows for implementation and dispatch, even though earlier high-level sketches grouped attempts under exam and dashboards under admin/operations.

Canonical Map

ServiceCurrent implementationOwnsMain APIs/workflowsDoes not own
api-gatewayservices/api-gatewaypublic entrypoint, route state, JWT verification, CORS, request IDs, rate limits, reverse proxy, docs/openapi surface/api/*, /v1/routes, route rehearsal, auth/header adaptersbusiness writes, service DBs, payment, IAM credential/session, or profile storage
bff-serviceservices/bff-service foundationfrontend-specific aggregation, dashboard composition, and bounded owner-service composition previews without primary DBweb/admin screen shells, source status, route metadata, weak-topic dispatch previewcanonical domain writes, replacing owner services, hiding domain logic
iam-serviceservices/iam-serviceaccounts, credentials, sessions, refresh tokens, JWT/JWKS, roles, permissions, org membership for access control, invites, auth/security auditregister/login/logout/refresh/me, role/permission APIs, permission check, membership access contextavatar/profile details, subscription, wallet, payment, learning data
profile-serviceservices/profile-serviceeducation profiles, display fields, avatar, phone, DOB, gender, student/teacher/parent/staff metadata, parent-child read models, teacher KYC storage/review, public profile viewsprofile create/read/update, role-specific profile views, public profile, parent-recipient resolve, teacher KYC self-service/admin reviewlogin, password, JWT, roles, permissions, payment, usage quota
organization-serviceservices/school-service aliasschools, centers, campuses, org units, tenant metadata, academic-year calendar/configuration, tenant resolve/validate; member rows only as IAM-synchronized read models with ordering/tombstonesorganization/unit CRUD, future academic-year lifecycle, tenant validation, member read/metadata adapterslogin, profile details, subscriptions, class content, permission-bearing organization membership writes
classroom-serviceservices/classroom-serviceclassrooms, class members, teacher assignments, classroom progress/read modelsclass CRUD, join, student/member management, progress summariesaccount creation, question source of truth, exam grading
course-serviceservices/course-servicecourses, modules/sections, lessons, course materials metadata, enrollments, progressauthoring, public course catalog, student course/progress APIsquestion bank, exam attempts, file bytes, wallet purchases
question-serviceservices/question-bank-service aliasquestions, answers, solutions, versions, tags, taxonomy refs, question type definitionsquestion CRUD/read projections, type definitions, AI classify apply, import ingestexam sessions, attempt scoring, import parser state
exam-serviceservices/exam-serviceexams, sections, exam question snapshots, publish workflow, access links, assignmentsexam authoring, publish, snapshot APIssource question editing, answer attempts, parser/import state
attempt-serviceservices/attempt-serviceattempt sessions, attempt-owned question snapshots, answers, grading, events, resultsstart/save/submit/events/resultexam authoring, live question reads, profile/org source of truth
file-serviceservices/document-service aliasfiles, media assets, object metadata, signed URLs, teaching documents, actor-scoped import-source assetsupload/presign, media metadata/content, owner-scoped OCR/MathType source upload and internal readparsing document content, credit charging, question persistence
import-serviceservices/docx-import-service aliasimport jobs, DOCX/PDF/OCR parse orchestration, preview/drafts, review state, approval saga checkpointsDOCX fast jobs, owner-scoped OCR/MathType job create/reprocess, events/SSE, review save, approve to question/exam, explicit usage preflight/consume callscanonical questions after approval, file object store, quota policy/counters, wallet ledger
formula-docx-serviceruntimes/go-formula-docx runtime behind docx-import-service; do not create services/formula-docx-service unless a later ADR promotes itDOCX/formula/table conversion runtime and parser metricsinternal parse/convert endpoints through import adaptersimport review, question/exam writes, payment/quota, public frontend routes
ai-serviceservices/ai-classifier-service aliasAI provider adapters, AI requests/jobs, prompt context, model usage, AI resultsclassify/generate/explain/grade foundations, provider settingsquota decisions, wallet debits, canonical question/exam writes outside explicit APIs
billing-serviceservices/billing-service foundationplans, prices, subscriptions, invoices, plan entitlementsplan catalog, subscription lifecycle, invoice state, payment-outcome activationprovider webhooks, wallet ledger, usage counters, identity/profile
wallet-serviceservices/wallet-service foundationAZ Credits, wallet balances, immutable ledger, grants/debits/refundsbalance, debit/credit/refund, ledger readsubscription lifecycle, provider reconciliation, login/profile
usage-service (entitlement-service alias)services/usage-service foundationfeature gates, usage counters, quota periods, limit overrides, materialized billing entitlementsentitlement sync, entitlement lookup, check/consume quota, counter listing/reset, override upsertmoney movement, subscription lifecycle, AI/import/file/question execution, payment webhooks
payment-serviceservices/payment-service foundationpayment orders, provider transactions, webhooks, reconcile/idempotencycreate payment order, webhook ingest, reconcilesubscription activation without billing, wallet source of truth
notification-serviceservices/notification-servicenotifications, templates, preferences, delivery/read/delete state, notification events, provider delivery orchestration and attemptsinbox, templates, preferences, parent alerts, event fanout, provider dispatch/retry/DLQuser lookup, parent-student resolution, OTP issuance/verification, provider secrets, audit logs
search-serviceservices/search-service foundationrebuildable search indexes, sync checkpoints, projection replay receipts and version tombstonesindex document upsert/delete, full-text search, filters, source sync state, replay-safe copied projection changescanonical business data, public route rules, owner-service writes
audit-serviceservices/audit-service foundationcompliance/security append-only event history, source idempotency, retention/legal-hold metadata, legacy audit projection/backfill targetappend/list audit events, security event queriesdomain decisions, feature maintenance, public admin audit compatibility until a route migration is proven
analytics-serviceservices/analytics-servicedashboards, result/progress/mastery projections, weak topicsanalytics results, event snapshots, summariescanonical exam/attempt/course/question/profile data
admin-serviceservices/admin-servicefeature maintenance, admin read models, moderation/ops controls, current public/admin audit compatibilityfeature maintenance, admin audit list/create compatibility, operational dashboard APIswallet/payment ledger, IAM credentials, profile storage, compliance-grade audit ledger

Deprecated Compatibility Scaffold

ScaffoldCurrent implementationPurposeMust not own
user-serviceservices/user-serviceDeprecated compatibility scaffold for temporary profile routes while IAM/Profile cutover evidence is completed. Use docs/agents/service-tasks/user-service-retirement.md for quarantine/removal work only.New identity/profile work, credentials, roles, permissions, payments, learning data, or any canonical service ownership.

MVP Sequence

  1. Gateway/BFF, IAM, Profile, Organization, Classroom.
  2. Question, Exam, Attempt, File, Import, Formula DOCX, Search.
  3. AI, Billing, Wallet, Usage, Payment.
  4. Notification, Audit, Admin, Analytics.

Domain Groups

DomainCanonical services
Entry/APIapi-gateway, bff-service
Identityiam-service
User/Profileprofile-service
School/Organizationorganization-service, classroom-service
Learning Contentcourse-service, file-service
Question/Exam Runtimequestion-service, exam-service, attempt-service
Document AI Importimport-service, formula-docx-service, ai-service
Monetizationbilling-service, wallet-service, usage-service, payment-service
Operationsnotification-service, search-service, audit-service, admin-service, analytics-service

Boundary Rules

  • Frontend never calls service hostnames directly.
  • auth-service is not a Go-platform service boundary. /api/auth* and /v1/auth* are compatibility namespaces backed by iam-service; do not create an auth-service task pack, API doc, OpenAPI contract, deployment, or runtime directory.
  • Do not create duplicate implementation directories for alias names: organization-service uses services/school-service, question-service uses services/question-bank-service, file-service uses services/document-service, import-service uses services/docx-import-service, and ai-service uses services/ai-classifier-service.
  • Every service task must cite legacy evidence or explicitly state there is no legacy equivalent.
  • Gateway adapters can shape responses but cannot hide business logic that belongs in a service.
  • AZ Credits and subscriptions must use Billing/Wallet/Usage/Payment service boundaries; do not add them to IAM/Profile.
  • Import creates draft/preview state. Approved questions become question-service state through an explicit API.
  • DOCX Question Bank approval may call usage-service for the reviewed questions entitlement, using an approval-owned idempotency key after Question Bank ingest. It never owns a usage counter or wallet ledger; legacy parity does not add an AZ Credit debit to this approval path.
  • Browser OCR/MathType uploads pass through a non-default Gateway route to file-service, receive only an opaque sourceAssetId, and are reopened by import-service with exact organization, actor, purpose, and source-kind checks. Neither service exposes source object keys to the frontend.
  • Exam and attempt store snapshots by value; they do not join the question DB.

Go-platform documentation is generated from repository Markdown.