Getting Started & Setup
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- src/main/resources/data.sql
- src/main/java/org/example/coding_convention/config/SwaggerConfig.java
- gradlew.bat
- src/main/java/org/example/coding_convention/CodingConventionApplication.java
- src/main/java/org/example/coding_convention/websocket/WebSocketController.java
- src/main/java/org/example/coding_convention/project/model/Project.java
PhanesEditor-BE is a Spring Boot-based backend service designed to support real-time collaborative code editing. It leverages WebSockets for live synchronization and REST APIs for project management, member control, and file handling. The system is architected to ensure that only authorized project members can access real-time features like chat and code editing.
This guide outlines the environment requirements, database initialization, and core configuration necessary to get the backend services operational.
Sources: README.md:1-25, CodingConventionApplication.java:1-13
Technical Stack & Environment
The project is built using the Java ecosystem with a focus on real-time communication and data persistence.
| Component | Technology | Description |
|---|---|---|
| Language | Java | Core programming language. |
| Framework | Spring Boot | Application framework for REST and WebSocket services. |
| WebSocket | Spring WebSocket | Used for real-time chat and code synchronization. |
| Persistence | Spring Data JPA | ORM for database interactions. |
| Database | MariaDB | Primary relational database for project, member, and file management. |
| Documentation | Swagger (OpenAPI v3) | API documentation and testing interface. |
Sources: README.md:80-92, SwaggerConfig.java:15-30
Project Initialization
1. Build and Execution
The project includes a Gradle wrapper for consistent builds across different environments. On Windows environments, the gradlew.bat script is used to bootstrap the Gradle environment and execute tasks.
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
Sources: gradlew.bat:1-90
2. Database Schema Setup
The application uses a database named project with utf8mb4 encoding. The initialization script sets up the core tables required for user management, project collaboration, and real-time activities.
The diagram above illustrates the relational structure of the system as defined in the initialization SQL.
Core Tables:
- users: Stores identity, credentials, and platform information (LOCAL, GOOGLE, KAKAO).
- project: Stores project metadata and the primary programming language (JAVASCRIPT, JAVA, PYTHON, C).
- project_member: Maps users to projects with specific roles (ADMIN, USER).
- files: Tracks file names, paths, and S3 URLs for project assets.
- chats: Stores real-time message history for specific project rooms.
Sources: data.sql:1-130, Project.java:36-40, ProjectMember.java:23-25
Core Configurations
API Documentation (Swagger)
The project is configured with Swagger for API exploration. It uses Bearer Authentication (JWT) for secured endpoints.
- Title: Phanes API
- Version: v1
- Security Scheme: JWT Bearer Auth
Sources: SwaggerConfig.java:15-30
Real-Time Communication (WebSocket)
The application handles real-time traffic through two primary message mapping routes. These routes utilize destination variables to isolate traffic by project "rooms".
| Message Mapping | Destination Variable | Purpose |
|---|---|---|
/chat/{roomId} | roomId | Relays chat messages to /topic/chat/{roomId}. |
/editor/{roomId} | roomId | Synchronizes code changes to /topic/editor/{roomId}. |
Sources: WebSocketController.java:21-31
System Architecture Overview
The backend separates standard CRUD operations from real-time event handling to ensure scalability and clear separation of concerns.
The architecture leverages REST for stateful management and WebSockets for stateless, low-latency event broadcasting. Access control is enforced by verifying project membership before allowing users to join WebSocket rooms or modify project files.
Sources: README.md:100-115, WebSocketController.java:15-32
Summary
To get started with PhanesEditor-BE, developers must initialize the MariaDB instance using the provided data.sql script and build the application using the Gradle wrapper. The system is then accessible via REST endpoints for project setup, while real-time collaboration is handled through the dedicated WebSocket controller. Configuration for security and API documentation is pre-set to use JWT-based authentication.
Sources: README.md:120-130, data.sql:1-10