# esa513/onlinejudge architecture

> Architecture diagram of the GitHub repository esa513/onlinejudge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/esa513/onlinejudge
- Repository: https://github.com/esa513/onlinejudge

## Overview

##### Main Components

a. Frontend (OnlineJudgeFE):
- Components for:
- User Interface
- Code Editor
- Problem Viewer
- Submission Interface
- Results Display

b. Backend (OnlineJudgeBE):
- Components for:
- API Gateway
- Authentication Service
- Problem Service
- Judge Engine
- Submission Handler
- Results Processor

c. Deployment (OnlineJudgeDeploy):
- Components for:
- Docker Containers
- Load Balancer
- Code Execution Environment
- Security Sandbox

##### Component Relationships

- User → Frontend → Backend flow
- Backend → Judge Engine → Results flow
- Deployment infrastructure supporting both frontend and backend
- Security boundaries between components

##### Critical Elements to Highlight

a. Security Layer:
- Isolation between user input and code execution
- Sandboxed environments

b. Scalability Components:
- Load balancers
- Distributed judge workers
- Cache layers

c. Core Services:
- Problem management
- User management
- Submission processing
- Results handling

##### Additional Details

Annotations for:
- Technology stack used (if known)
- Security measures
- Scaling capabilities
- Monitoring points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef judge fill:#ffe6cc,stroke:#d79b00
    classDef infra fill:#f5f5f5,stroke:#666666
    classDef security fill:#f8cecc,stroke:#b85450

    %% Frontend Layer
    subgraph FrontendLayer["Frontend Layer"]
        UI["User Interface"]:::frontend
        CodeEditor["Code Editor"]:::frontend
        ProblemViewer["Problem Viewer"]:::frontend
        SubmissionInterface["Submission Interface"]:::frontend
        ResultsDisplay["Results Display"]:::frontend
    end

    %% Backend Layer
    subgraph BackendLayer["Backend Layer"]
        APIGateway["API Gateway"]:::backend
        AuthService["Authentication Service"]:::backend
        ProblemService["Problem Service"]:::backend
        JudgeEngine["Judge Engine"]:::judge
        SubmissionHandler["Submission Handler"]:::backend
        ResultsProcessor["Results Processor"]:::backend
    end

    %% Infrastructure Layer
    subgraph InfraLayer["Infrastructure Layer"]
        Docker["Docker Containers"]:::infra
        LoadBalancer["Load Balancer"]:::infra
        ExecEnv["Code Execution Environment"]:::infra
        SecuritySandbox["Security Sandbox"]:::security
    end

    %% Relationships
    UI --> APIGateway
    CodeEditor --> SubmissionInterface
    ProblemViewer --> ProblemService
    SubmissionInterface --> SubmissionHandler
    SubmissionHandler --> JudgeEngine
    JudgeEngine --> ExecEnv
    ExecEnv --> SecuritySandbox
    JudgeEngine --> ResultsProcessor
    ResultsProcessor --> ResultsDisplay
    LoadBalancer --> APIGateway
    Docker --> ExecEnv

    %% Click Events
    click FrontendLayer "https://github.com/esa513/OnlineJudge/tree/master/OnlineJudgeFE"
    click BackendLayer "https://github.com/esa513/OnlineJudge/tree/master/OnlineJudgeBE"
    click InfraLayer "https://github.com/esa513/OnlineJudge/tree/master/OnlineJudgeDeploy"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Judge["Judge Component"]:::judge
        Infrastructure["Infrastructure Component"]:::infra
        Security["Security Component"]:::security
    end
```
