How vaibhavbytebuddy/javaidebackend works
Project type and purpose
• This is a Spring Boot–based backend microservice named “javaIDEBackend.”
• Its purpose is to serve as the server side of an online Java IDE: it exposes REST endpoints for editing/storing code files and for compiling/executing Java code, then returns execution results.
File structure
• Top‐level artifacts:
• pom.xml/mvnw → Maven build
• DockerFile → containerization
• src/main/java/com/java/ide/... → Java code organized by layer
• Layer directories under src/main/java/com/java/ide:
• config → CORS settings, execution‐engine settings
• controller → REST controllers (EditorController, ExecutionController, Test)
• service → business logic (JavaExecutionService)
• repository → persistence (FileRepository)
• model → domain objects (CodeFile, ExecutionResult)
• src/main/resources: application.properties (DB, port, execution‐engine configuration), data.sql (DB seed)
• Test folder mirrors the main app structure for unit/integration tests.
README
• README simply identifies the project as “javaIDEBackend.”
• No architecture details, so we infer architecture from code.
a. Main components
1. API Layer (REST Controllers)
• EditorController
• ExecutionController
2. Service Layer
• JavaExecutionService (+ ExecutionConfig)
3. Persistence Layer
• FileRepository → relational DB (configured via application.properties and seeded from data.sql)
4. External/Infrastructure Components
• Underlying Java process or sandbox invoked by JavaExecutionService
• Docker container packaging the Spring Boot JAR
• (Optional) API client/front‑end (e.g. web IDE UI)
b. Relationships & interactions
1. Client/UI sends HTTP requests → Controller
2. Controller calls Service for business logic
3. Service may
• Read/write CodeFile via FileRepository → DB
• Spawn/communicate with Java compiler/runtime (ExecutionConfig) → get stdout/stderr
4. Service builds ExecutionResult → returns to Controller → HTTP response to client
c. Architectural patterns & principles
• Standard layered (Controller → Service → Repository)
• Configuration isolation via dedicated config classes
• Separation of concerns: REST API vs. business logic vs. data access
• Containerized deployment (Docker)
d. Key technologies
• Java 11+
• Spring Boot (Web, Data JPA)
• Maven
• Embedded relational DB (H2 or other)
• External Java process invocation for code execution
• Docker