Home
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/project/model/Project.java
- src/main/java/org/example/coding_convention/project/service/ProjectService.java
- src/main/java/org/example/coding_convention/project/controller/ProjectController.java
- src/main/java/org/example/coding_convention/file/model/Files.java
- src/main/java/org/example/coding_convention/project_member/model/ProjectMember.java
- src/main/java/org/example/coding_convention/chat/model/Chats.java
PhanesEditor-BE is the backend system for a web-based collaborative code editor. Its primary purpose is to facilitate real-time collaboration on coding projects, allowing multiple users to work within a unified environment. The system manages the lifecycle of projects, including member access control, file management, and real-time communication through WebSockets for both code synchronization and integrated chat.
The architecture is built on Spring Boot and follows a RESTful approach for project and member management, while utilizing Spring WebSocket for low-latency features. Data persistence is handled via MariaDB using Spring Data JPA, ensuring structured relationships between users, projects, and collaborative assets.
Sources: README.md:1-15, README.md:65-75
Core System Architecture
The system utilizes a split communication strategy. Standard administrative tasks (CRUD operations) are handled via a REST API, while collaborative features utilize a dedicated WebSocket structure. Access control is centralized around the "Project Member" concept, ensuring that only authorized participants can interact with project-specific resources.
Data Model and Relationships
The database schema reflects a hierarchical structure where projects serve as the container for files, chats, and members.
The diagram illustrates the core entity relationships where projects are the central nexus for collaboration.
Sources: src/main/resources/data.sql:35-132, src/main/java/org/example/coding_convention/project/model/Project.java:23-55
Project Management
Project management involves creating, searching, and detailing collaborative environments. Every project is associated with a primary programming language (JAVASCRIPT, JAVA, PYTHON, or C) and tracks popularity through a like-count mechanism.
Key Components
| Component | Responsibility |
|---|---|
ProjectController | Handles HTTP endpoints for project creation, listing, and searching. |
ProjectService | Implements business logic for project persistence and member initialization. |
ProjectQueryRepository | Utilizes Querydsl for advanced filtering by name, email, or language. |
Project Creation Flow
When a project is created, the system automatically assigns the creator as an ADMIN and adds specified colleagues as USER members.
This flow ensures that access control is established immediately upon project initialization.
Sources: src/main/java/org/example/coding_convention/project/service/ProjectService.java:34-63, src/main/java/org/example/coding_convention/project/controller/ProjectController.java:32-40
Collaborative Features
The system enables real-time interaction through two primary channels: file synchronization and communication.
Real-time File Synchronization
Files are categorized as either DIRECTORY or FILE. Metadata including file_path and URL (often pointing to S3 storage) are stored in the database. Real-time updates utilize the EditorDto to track specific ranges of code changes and cursor/mouse positions.
Integrated Chat
Communication is scoped to the project level. Messages are linked to both a user and a project, ensuring that chat logs remain relevant to the specific collaboration context.
| Feature | Technical Implementation |
|---|---|
| Authentication | JWT-based "bearerAuth" defined in Swagger. |
| Messaging | Project-specific WebSocket channels. |
| File Storage | Hybrid metadata in DB, actual contents via S3 or local storage. |
Sources: README.md:43-55, src/main/java/org/example/coding_convention/file/model/Files.java:39-65, src/main/java/org/example/coding_convention/config/SwaggerConfig.java:18-28
Access Control Logic
Access is strictly governed by the ProjectMember status.
The sequence demonstrates how WebSocket connections are validated against the membership database.
Sources: README.md:48-63, src/main/java/org/example/coding_convention/project_member/model/ProjectMember.java:17-38
Summary
PhanesEditor-BE provides a robust foundation for collaborative coding by integrating traditional project management with real-time synchronization. By enforcing project-based membership for all WebSocket activities, it ensures a secure and organized environment for development teams to communicate and code simultaneously.
Sources: README.md:80-95