How jjinbbang-web/jjinbbang_be works
Project Type and Purpose
• From the file structure and minimal README (“GipNU_BE”), it’s clear this is a Spring Boot–based backend service (no separate “frontend” folder).
• It’s a modular monolith serving APIs for domains like Building, User, Map, and Common (reports, campuses, universities), plus global cross-cutting concerns (JWT auth, mailing, OCR, OpenAI, Slack, Google Sheets).
High-Level File Structure Analysis
• src/main/java/JJinBBang/app/domain/* : Four main bounded contexts—building, common, map, user—each with its own controller, service, repository, DTOs, entities, exceptions.
• src/main/java/JJinBBang/app/global/* : Cross-cutting modules—security, JWT, mail, OCR, OpenAI, Slack, Google Sheets, error handling, template responses, configuration classes.
• Configuration & infra: application.yml, S3Config, RedisConfig, QuerydslConfig, external-client wrappers (VWorldApiClientImpl).
• Persistence: Spring Data JPA repositories, QueryDSL custom repos, multiple Redis/In-Memory implementations for tokens and pending users.
• Testing: JUnit tests in src/test.
Key Architectural Patterns
• Layered architecture (Controllers → Services → Repositories → Database).
• Modular packaging by feature/domain (bounded contexts).
• External API clients abstracted behind interfaces (e.g., VWorldApiClient, OcrService, MailSendService).
• Cross-cutting concerns centralized under “global” (security filters, exception handlers, JWT, mail, OCR, OpenAI, Slack).
• Use of Spring’s dependency injection, configuration classes, and properties for external services.
A. External Clients & Services
• VWorld Map API
• OAuth2 providers (Google, Kakao, Naver)
• AWS S3 (for file uploads via S3Service)
• SMTP mail server (MailSendService)
• OCR provider (Clova OCR)
• OpenAI Verification API
• Google Sheets & Slack endpoints
B. Authentication & Security
• JWT generation & verification (JwtService, RefreshTokenRepository, JwtAuthenticationFilter)
• OAuth2 flow (CustomOAuth2UserService, AuthController)
• Security filters / handlers (VerificationStatusFilter, CustomAccessDeniedHandler)
C. API Layer
• HTTP entry points: Controllers in each domain (BuildingController, UsersController, MapController, CampusesController, etc.)
D. Business Logic Layer
• Services per domain (BuildingServiceImpl, UsersServiceImpl, MapServiceImpl, CampusesServiceImpl, etc.)
• Cross-cutting services (MailAuthService, OcrService, OpenaiVerificationService, SlackService, GoogleSheetsService)
E. Data Layer
• Spring Data JPA Repositories (e.g., BuildingsRepository, UsersRepository, ReportRepository)
• Custom QueryDSL repositories for complex queries
• Redis/In-Memory stores for pending users, email codes, refresh tokens
• Primary relational database (e.g., PostgreSQL or MySQL instance)
Relationships and Data Flow
1. HTTP requests → Security Filter Chain (JWT + OAuth2) → Controller
2. Controller invokes Service → Service may:
• Talk to Repository → Database
• Call external client bean → External API
• Publish or listen to application events (e.g., CertificateUploadEvent)
• Interact with Redis/In-Memory caches
3. Service returns DTO → Controller wraps in ResTemplate → HTTP response
4. Global exception handler (ControllerAdvice) intercepts and formats errors