# sunbird-all/all-orchestration-service architecture

> Architecture diagram of the GitHub repository sunbird-all/all-orchestration-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sunbird-all/all-orchestration-service
- Repository: https://github.com/sunbird-all/all-orchestration-service

## Overview

##### Project type and purpose
- This is a backend orchestration service written in Node.js/TypeScript.
- It exposes REST APIs (via Express in index.ts) and coordinates data access across two persistence layers: MongoDB and a relational database.
- It’s packaged as a single container (Dockerfile + docker-compose), but internally split into two logical modules (mongo_module and sql_module).

##### File structure
- Top-level:
- index.ts – the Express app entry point
- Dockerfile / docker-compose.yml – container build & orchestration
- package.json, tsconfig.json, ESLint, GitHub workflows
- src/common – shared utilities: cacheManager, generic CRUD, HTTP Exception & Response wrappers
- src/mongo_module – domain models under mongoose, and modules organized by entity: each with its router, controller, service
- src/sql_module – relational schema definitions, data.config.ts, and modules (router/controller/service) parallel to mongo_module

##### README for additional insights
- Very minimal; confirms that “start server” runs nodemon on index.ts.

##### Final checklist for the principal software engineer
- Modules under one supernode labeled “Orchestration Service.”
- Internal layering (Router → Controller → Service → Model) twice—once for each data store.
- Docker build & compose context: one container for the service, two for DBs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    direction TB
    Client["Client"]:::external

    subgraph "Orchestration Service"
        direction TB
        Express["Express App\nindex.ts"]:::api
        Common["Common Utilities"]:::common
        Express-->Common

        Express-->MongoModule
        Express-->SQLModule

        subgraph "Mongo Module"
            direction TB
            M_IDX["modules/index.ts"]:::mongoModule

            subgraph "Models"
                direction TB
                AM["adaptiveLearning.ts"]:::mongoModel
                BM["baseline_assess.ts"]:::mongoModel
                EM["emisLessonMaster.ts"]:::mongoModel
                LPM["learnerProgress.ts"]:::mongoModel
                LES["lesson.ts"]:::mongoModel
                MS["mozhigalScoreTracker.ts"]:::mongoModel
                PTR["pointer.ts"]:::mongoModel
                USR["user.ts"]:::mongoModel
            end

            subgraph "Modules (R→C→S)"
                direction TB
                R1["adaptive_learning.router.ts"]:::mongoRouter
                C1["adaptive_learning.controller.ts"]:::mongoController
                S1["adaptive_learning.service.ts"]:::mongoService
                R1-->C1-->S1-->AM

                R2["baseline.router.ts"]:::mongoRouter
                C2["baseline.controller.ts"]:::mongoController
                S2["baseline.service.ts"]:::mongoService
                R2-->C2-->S2-->BM
            end
            M_IDX-->R1
            M_IDX-->R2
        end

        subgraph "SQL Module"
            direction TB
            S_IDX["index.ts"]:::sqlModule

            subgraph "Schema"
                direction TB
                LMS["learnerProgress.ts"]:::sqlSchema
                LSN["lesson.ts"]:::sqlSchema
                PTS["point.ts"]:::sqlSchema
                USQL["user.ts"]:::sqlSchema
            end

            subgraph "Modules (R→C→S)"
                direction TB
                QR1["learner_progress.router.ts"]:::sqlRouter
                QC1["learner_progress.controller.ts"]:::sqlController
                QS1["learner_progress.service.ts"]:::sqlService
                QR1-->QC1-->QS1-->LMS
            end
            S_IDX-->QR1
        end
    end

    subgraph "Infrastructure"
        direction TB
        ServiceContainer["Orchestration Service Container"]:::container
        MongoDB["MongoDB"]:::db
        SQLDB["SQL DB"]:::db
        ServiceContainer-->MongoDB
        ServiceContainer-->SQLDB
        DockerCompose["docker-compose.yml"]:::infra
        Dockerfile["Dockerfile"]:::infra
        ServiceContainer-->DockerCompose
        ServiceContainer-->Dockerfile
    end

    Client-->Express

    click Express "https://github.com/sunbird-all/all-orchestration-service/blob/main/index.ts"
    click Common "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/common/cacheManager.ts"
    click Common "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/common/crud.ts"
    click Common "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/common/http.Exception/http.Exception.ts"
    click Common "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/common/http.Response/http.Response.ts"
    click AM "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/adaptiveLearning.ts"
    click BM "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/baseline_assess.ts"
    click EM "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/emisLessonMaster.ts"
    click LPM "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/learnerProgress.ts"
    click LES "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/lesson.ts"
    click MS "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/mozhigalScoreTracker.ts"
    click PTR "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/pointer.ts"
    click USR "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/models/user.ts"
    click R1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/adaptiveLearning/adaptive_learning.router.ts"
    click C1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/adaptiveLearning/adaptive_learning.controller.ts"
    click S1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/adaptiveLearning/adaptive_learning.service.ts"
    click R2 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/baseline_assessment/baseline.router.ts"
    click C2 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/baseline_assessment/baseline.controller.ts"
    click S2 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/baseline_assessment/baseline.service.ts"
    click M_IDX "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/mongo_module/modules/index.ts"
    click S_IDX "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/index.ts"
    click LMS "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/schema/learnerProgress.ts"
    click LSN "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/schema/lesson.ts"
    click PTS "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/schema/point.ts"
    click USQL "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/schema/user.ts"
    click QR1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/module/learner_progress_Module/learner_progress.router.ts"
    click QC1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/module/learner_progress_Module/learner_progress.controller.ts"
    click QS1 "https://github.com/sunbird-all/all-orchestration-service/blob/main/src/sql_module/module/learner_progress_Module/learner_progress.service.ts"
    click Dockerfile "https://github.com/sunbird-all/all-orchestration-service/tree/main/Dockerfile"
    click DockerCompose "https://github.com/sunbird-all/all-orchestration-service/blob/main/docker-compose.yml"

    classDef external fill:#bbf,stroke:#333
    classDef api fill:#bbdef0,stroke:#333
    classDef common fill:#d1c4e9,stroke:#333
    classDef mongo fill:#c8e6c9,stroke:#333
    classDef sql fill:#ffe0b2,stroke:#333
    classDef container fill:#cfd8dc,stroke:#333,stroke-dasharray: 5 5
    classDef db fill:#eceff1,stroke:#333,stroke-dasharray: 2 2
    classDef infra fill:#f0f4c3,stroke:#333
    classDef mongoModel fill:#a5d6a7,stroke:#333
    classDef mongoRouter fill:#81c784,stroke:#333
    classDef mongoController fill:#66bb6a,stroke:#333
    classDef mongoService fill:#4caf50,stroke:#333
    classDef mongoModule fill:#b9f6ca,stroke:#333
    classDef sqlModule fill:#ffe082,stroke:#333
    classDef sqlSchema fill:#ffcc80,stroke:#333
    classDef sqlRouter fill:#ffb74d,stroke:#333
    classDef sqlController fill:#ff9800,stroke:#333
    classDef sqlService fill:#fb8c00,stroke:#333
```
