How frozsgy/ceng453-project works
Project type and purpose
• This is a full-stack multiplayer card game application with two Maven sub-modules:
• client – a JavaFX desktop client implementing MVC (FXML views + Controllers), game logic (Strategy pattern for AI), state management, HTTP and socket services.
• server – a Spring Boot REST + socket server providing authentication (JWT + Spring Security), game and player APIs, real-time multiplayer via sockets, persistence (JPA repositories), and email utilities for password reset.
File structure
• Top‐level: client/, server/, wiki/
• client/:
• src/main/java/group10/client: Application entry (UiApplication), StageInitializer, package breakdown: constants, controller (UI event handling), model & entity (data transfer objects & domain entities), logic (AiStrategy + GameLogic), service (HTTPService, SocketClient/Server), state (session + scoreboard storage), utility.
• resources: FXML views, application.yml, static assets.
• server/:
• src/main/java/group10/server: ServerApplication entry; config (JWTAuthorizationFilter, WebSecurityConfig, DataLoader), controller (GameController, PlayerController), service (GameService, MatchService, PlayerService), repository (JPA repos), entity, DTO models, util (EmailComposer).
• resources: application.yml, Postman collection, Swagger doc.
README/wiki for insights
• Wiki pages describe AI strategies, database design, security, design patterns, tests.
• Server README describes API endpoints and configuration.
Main components & interactions
a. Components
• Client Application (UI Layer, Controllers, Logic & AI, State Management, HTTPService, SocketClient)
• Server Application (Spring Boot, JWT Auth Filter, REST Controllers, Socket Server, Service Layer, Repository Layer)
• Database (e.g., MySQL/PostgreSQL via JPA)
• External Email/SMS Service (for password reset codes)
• Optional Static CDN (for client assets, if deployed)
b. Relationships/Data flow
1. UI (FXML + Controllers) ↔ Logic & State ↔ HTTPService → REST API endpoints → Controllers → Services → Repositories → Database
2. HTTPService ↔ Authentication endpoints (login, register, password reset) using JWT
3. SocketClient ↔ SocketServer → real-time game events routed via GameService & MatchService
4. Services → EmailComposer → External SMTP for sending reset codes
c. Architectural patterns & design principles
• Client: MVC (Views, Controllers, Model), Strategy pattern for AI levels, Singleton or in-memory Storage for session/scoreboard, Dependency Injection via FXML & PropertiesLoader
• Server: Layered architecture (Controller → Service → Repository), DTO pattern, JWT-based stateless auth, Filter chain for security, SpringFox/Swagger for API docs, DataLoader for seeding
d. Key technologies/frameworks
• Client: Java 11+, JavaFX, Maven Wrapper, FXML, HTTP & Socket I/O, Jackson/Gson (if used), YAML config
• Server: Spring Boot, Spring Web, Spring Security, JWT, Spring Data JPA, Hibernate, Swagger (SpringFox), Maven, Postman collection