# zunohoang/neptune-oj architecture

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

- Interactive diagram: https://gitdiagram.com/zunohoang/neptune-oj
- Repository: https://github.com/zunohoang/neptune-oj

## Overview

##### Project Components
- Frontend: The NeptuneOJ-Client directory clearly indicates a ReactJS-based web application that users interact with.
- Backend: The NeptuneOJ-Server directory is dedicated to the Spring Boot backend. Additionally, there is a .java directory which might include shared or lower-level Java code used by the backend.
- Database: As detailed in the README, PostgreSQL is used as the primary data store.
- Caching/Message Bus: Redis is used both as a cache and a message broker.
- Containerization & Deployment: Docker support is included, so the architecture should factor in containerized components.
- (Optional) Version Control & Submodules: The .gitmodules file indicates that there might be external dependencies or linked repositories that should be considered in dependency mappings.

##### Relationships and Data Flow
- The Backend communicates with PostgreSQL for persistent data and with Redis for caching and queuing.
- Docker as an overarching layer depicting how these components are containerized and orchestrated.
- Optionally, if there are external dependencies (as hinted by the .gitmodules file), indicate how these integrate into the overall system.

##### Incorporate Architectural Patterns and Technologies
- The separation between frontend and backend should be highlighted as a key architectural decision.
- MVC-like setup on the backend, where Spring Boot handles routing, business logic, and data persistence.
- Detail the asynchronous communication or caching strategies using Redis.
- Containerization strategy using Docker which ensures consistent deployment environments.

##### Final Recommendations
- Be very detailed—don’t hesitate to split the system into as many individual components as possible. For example, in addition to just "Frontend" and "Backend", break the backend into API, business logic, persistence, and asynchronous processing components.
- How Docker ties these components together by showing the containerized deployment scenario.
- Inter-component communications such as REST API calls or queue-based event handling.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    %% Docker Containerization Layer
    subgraph "Docker Containerization"
        D_CLIENT["NeptuneOJ Client (ReactJS)"]
        D_SERVER["NeptuneOJ Server (Spring Boot)"]
    end

    %% External Services
    subgraph "External Services"
        DB["PostgreSQL Database"]
        REDIS["Redis Cache/Message Broker"]
        GIT["External Dependencies (.gitmodules)"]
    end

    %% Backend Internal Components
    subgraph "Backend Internal Components"
        API["API Controllers"]
        SERVICE["Business Logic (Service Layer)"]
        DATA["Data Access Layer"]
        JUDGE["Judging Engine"]
        SHARED["Shared Java Code (.java)"]
    end

    %% Connections between Frontend and Backend
    D_CLIENT -->|"HTTP_Requests"| D_SERVER
    D_SERVER -->|"routesTo"| API
    API -->|"forwardsTo"| SERVICE
    SERVICE -->|"accesses"| DATA
    SERVICE -->|"triggers"| JUDGE
    D_SERVER -->|"integrates"| SHARED

    %% Connections to external services
    SERVICE -->|"usesRedis"| REDIS
    DATA -->|"queries"| DB

    %% Docker container relationship illustration
    D_CLIENT ---|"containerized"| D_SERVER

    %% External dependency relationship
    D_SERVER ---|"incorporates"| GIT

    %% Click Events for component mapping
    click D_CLIENT "https://github.com/zunohoang/neptune-oj/tree/main/NeptuneOJ-Client"
    click D_SERVER "https://github.com/zunohoang/neptune-oj/tree/main/NeptuneOJ-Server"
    click SHARED "https://github.com/zunohoang/neptune-oj/blob/main/.java"
    click GIT "https://github.com/zunohoang/neptune-oj/blob/main/.gitmodules"

    %% Styling classes
    classDef frontend fill:#ccf,stroke:#000,stroke-width:2px;
    classDef backend fill:#cfc,stroke:#000,stroke-width:2px;
    classDef external fill:#fcf,stroke:#000,stroke-width:2px;
    classDef container fill:#cff,stroke:#000,stroke-width:2px;

    %% Assign classes to nodes
    class D_CLIENT frontend;
    class D_SERVER backend;
    class API backend;
    class SERVICE backend;
    class DATA backend;
    class JUDGE backend;
    class SHARED backend;
    class DB external;
    class REDIS external;
    class GIT external;
```
