# yacs-rcos/yacs architecture

> Architecture diagram of the GitHub repository yacs-rcos/yacs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yacs-rcos/yacs
- Repository: https://github.com/yacs-rcos/yacs

## Overview

##### High-Level Architecture Components

a) Frontend Layer:
- Web Application (Angular-based, in /web directory)
- User Interface Components (courses, schedules, departments views)

b) Backend Services:
- Core API Service (Ruby on Rails, in /core directory)
- Users Service (authentication/authorization)
- Notifications Service
- MALG (data aggregation service)

c) Data Pipeline Components:
- Multiple Adapters (RPI, NYU, etc.)
- Pipeline Processors

##### Key Relationships to Highlight

- Client-Server communication between web frontend and core API
- Data flow from external sources through pipelines to core
- Event-driven communication between services
- Database interactions
- Authentication flows

##### Detailed Component Breakdown

For each major component, include:

Frontend (Web):
- Components hierarchy (header, course list, schedule view)
- State management
- API client integration

Core API:
- Controllers (v5 and v6 API versions)
- Model relationships (Course, Section, School, Term)
- Resource handlers
- Cache layer

Pipeline System:
- Source adapters
- Data transformers
- Event publishers/subscribers

##### Implementation Details

Specific technical implementations:
- Docker containers and composition
- Nginx reverse proxy
- Redis for caching
- PostgreSQL database
- Kafka/Event streaming
- API versioning (v5/v6)

##### Additional Elements

Include:
- API endpoints grouping
- Security boundaries
- Scaling components
- Monitoring points

- Microservices architecture
- Event-driven communication
- Data pipeline flexibility
- API versioning strategy
- Service independence

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make YACS unique, such as its modular pipeline system and multi-school support capability.

This system design should help developers understand both the high-level architecture and the specific implementation details that make YACS a comprehensive course scheduling platform.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        WEB["Web Application"]:::frontend
        COMP["UI Components"]:::frontend
        SRV["Frontend Services"]:::frontend
        MOD["Frontend Models"]:::frontend
        WEB --> COMP
        WEB --> SRV
        WEB --> MOD
    end

    subgraph "API Services"
        CORE["Core API Service"]:::service
        V5["API v5"]:::api
        V6["API v6"]:::api
        CORE_MOD["Core Models"]:::model
        CORE --> V5
        CORE --> V6
        CORE --> CORE_MOD
    end

    subgraph "Supporting Services"
        USERS["Users Service"]:::service
        AUTH["Authentication"]:::service
        NOTIF["Notifications Service"]:::service
        MALG["MALG Service"]:::service
        USERS --> AUTH
    end

    subgraph "Data Pipeline"
        RPI["RPI Pipeline"]:::pipeline
        NYU["NYU Pipeline"]:::pipeline
        ADAPT["Adapters"]:::pipeline
        RPI --> ADAPT
        NYU --> ADAPT
    end

    subgraph "Infrastructure"
        NGINX["Nginx Proxy"]:::infra
        DB[(PostgreSQL)]:::db
        REDIS[(Redis Cache)]:::cache
        KAFKA[("Event Stream")]:::queue
    end

    WEB --> NGINX
    NGINX --> CORE
    NGINX --> USERS
    NGINX --> NOTIF
    CORE --> DB
    CORE --> REDIS
    MALG --> KAFKA
    NOTIF --> KAFKA
    ADAPT --> MALG

    %% Component Mappings
    click WEB "https://github.com/YACS-RCOS/yacs/tree/master/web"
    click COMP "https://github.com/YACS-RCOS/yacs/tree/master/web/src/app/components"
    click SRV "https://github.com/YACS-RCOS/yacs/tree/master/web/src/app/services"
    click MOD "https://github.com/YACS-RCOS/yacs/tree/master/web/src/app/models"
    click CORE "https://github.com/YACS-RCOS/yacs/tree/master/core"
    click V5 "https://github.com/YACS-RCOS/yacs/tree/master/core/app/controllers/api/v5"
    click V6 "https://github.com/YACS-RCOS/yacs/tree/master/core/app/controllers/api/v6"
    click CORE_MOD "https://github.com/YACS-RCOS/yacs/tree/master/core/app/models"
    click USERS "https://github.com/YACS-RCOS/yacs/tree/master/users"
    click AUTH "https://github.com/YACS-RCOS/yacs/blob/master/users/app/controllers/users/sessions_controller.rb"
    click NOTIF "https://github.com/YACS-RCOS/yacs/tree/master/notifications/app"
    click MALG "https://github.com/YACS-RCOS/yacs/blob/master/malg/app.rb"
    click RPI "https://github.com/YACS-RCOS/yacs/tree/master/pipelines/rpi"
    click NYU "https://github.com/YACS-RCOS/yacs/tree/master/pipelines/nyu"
    click ADAPT "https://github.com/YACS-RCOS/yacs/tree/master/pipelines/rpi/adapters"
    click NGINX "https://github.com/YACS-RCOS/yacs/tree/master/nginx"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef model fill:#e74c3c,stroke:#c0392b,color:white
    classDef pipeline fill:#f1c40f,stroke:#f39c12,color:black
    classDef infra fill:#34495e,stroke:#2c3e50,color:white
    classDef db fill:#8e44ad,stroke:#703688,color:white
    classDef cache fill:#e67e22,stroke:#d35400,color:white
    classDef queue fill:#1abc9c,stroke:#16a085,color:white
```
