# ashujha301/coderank architecture

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

- Interactive diagram: https://gitdiagram.com/ashujha301/coderank
- Repository: https://github.com/ashujha301/coderank

## Overview

##### Project Type and Purpose
- It provides a React/Redux single-page frontend, a set of Node.js microservices (API Gateway + Code Execution service), language-specific compiler containers (C++, Java, Python, Node.js), and persistence via MongoDB (plus AWS integrations).

##### File Structure Analysis
- **client/** folder
- React (Vite) app with Redux for state (auth, editor)
- Components: language selector, code editor, login/register, home
- Dockerfile for containerizing the frontend
- **server/api-gateway/**
- Exposes user-facing REST endpoints (auth, code submission)
- Controllers → Routes → Services → Models (Mongoose schemas)
- Middleware for JWT auth
- Config for AWS (S3/Auth?) and MongoDB
- **server/codeExecution/**
- Handles code execution requests forwarded by the API Gateway
- Similar structure: routes, controllers, models, auth-check middleware
- Likely spawns language containers or communicates with them
- **server/\*-compiler/**
- Four language containers (C++, Java, Node.js, Python) each with their own Dockerfile
- Likely used by codeExecution service to compile/execute snippets safely
- **docker-compose.yml**
- Orchestrates multi-container setup: frontend, api-gateway, codeExecution, language containers, MongoDB, possibly a reverse proxy

##### README Insights
- Name “CodeRank” implies ranking or assessment but file tree shows editor + execution

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User
    User["User Browser"]:::user

    %% Frontend
    subgraph "Frontend Container"
        FE["React/Redux SPA"]:::frontend
    end

    %% API Gateway
    subgraph "API Gateway Service"
        API["API Gateway"]:::api
    end

    %% Code Execution
    subgraph "Code Execution Service"
        CODE["Code Execution"]:::execution
    end

    %% Compiler Containers
    subgraph "Compiler Containers"
        CPP["C++ Compiler"]:::compiler
        JAVA["Java Compiler"]:::compiler
        NODEC["Node.js Compiler"]:::compiler
        PY["Python Compiler"]:::compiler
    end

    %% Database
    DB["MongoDB"]:::db

    %% AWS
    AWS["AWS Services (S3, Cognito)"]:::aws

    %% Orchestration
    DC["Docker Compose"]:::config

    %% Connections
    User -->|"HTTP/WebSocket"| FE
    FE -->|"REST API"| API
    API -->|"MongoDB Driver"| DB
    API -->|"Internal HTTP/RPC"| CODE
    CODE -->|"Docker API"| CPP
    CODE -->|"Docker API"| JAVA
    CODE -->|"Docker API"| NODEC
    CODE -->|"Docker API"| PY
    CODE -->|"MongoDB Driver"| DB
    API -->|"AWS SDK"| AWS
    CODE -->|"AWS SDK"| AWS
    DC --- FE
    DC --- API
    DC --- CODE
    DC --- CPP
    DC --- JAVA
    DC --- NODEC
    DC --- PY
    DC --- DB

    %% Click Events
    click FE "https://github.com/ashujha301/coderank/tree/main/client/"
    click API "https://github.com/ashujha301/coderank/tree/main/server/api-gateway/"
    click CODE "https://github.com/ashujha301/coderank/tree/main/server/codeExecution/"
    click CPP "https://github.com/ashujha301/coderank/tree/main/server/cpp-compiler/Dockerfile"
    click JAVA "https://github.com/ashujha301/coderank/tree/main/server/java-compiler/Dockerfile"
    click NODEC "https://github.com/ashujha301/coderank/tree/main/server/nodejs-compiler/Dockerfile"
    click PY "https://github.com/ashujha301/coderank/tree/main/server/python-compiler/Dockerfile"
    click DC "https://github.com/ashujha301/coderank/blob/main/docker-compose.yml"

    %% Styles
    classDef user fill:#CDE,stroke:#000,color:#000
    classDef frontend fill:#DDEBFF,stroke:#0366d6,color:#0366d6
    classDef api fill:#DFFFE0,stroke:#228B22,color:#228B22
    classDef execution fill:#FFE4B5,stroke:#FF8C00,color:#FF8C00
    classDef compiler fill:#FFD2D2,stroke:#FF0000,color:#FF0000
    classDef db fill:#E0E0E0,stroke:#696969,color:#000
    classDef aws fill:#F0F0F0,stroke:#888888,color:#000
    classDef config fill:#FCF4DC,stroke:#D2691E,color:#000
```
