Repository navigation
Architecture Overview
Mason Batchelor edited this page Mar 6, 2026
·
1 revision
The backend is organized into four strict layers:
api → application → core ← infrastructure
HTTP controllers (REST) and GraphQL DGS components. Thin adapters with no business logic. Controllers validate input, delegate to application services, and format responses.
CQRS services split into command (write) and query (read) paths:
- ArticleCommandService — creates and updates articles
- ArticleQueryService — fetches articles with pagination (offset and cursor)
- UserService — user registration and profile updates
- ProfileQueryService — user profiles with follow state
Domain entities and repository interfaces. Zero framework dependencies. This layer defines:
-
User,Article,Comment,Tagentities -
UserRepository,ArticleRepository,CommentRepositoryinterfaces -
FollowRelation,ArticleFavoritevalue objects
Technical implementations:
- MyBatis repository implementations
-
DefaultJwtService— JWT signing and parsing -
NaiveEncryptService— password hashing - MyBatis type handlers (
DateTimeHandler)
Reads and writes are separated:
- Write path: Controllers → CommandService → Core Repository Interface → MyBatis Implementation
- Read path: Controllers → QueryService → MyBatis XML Mappers (direct SQL)
The read path bypasses domain entities entirely, querying directly into *Data DTOs for performance.
- Client sends
Authorization: Token <jwt>header -
JwtTokenFilterextracts and validates the token viaJwtService - User is loaded from
UserRepositoryand set inSecurityContextHolder -
WebSecurityConfigdefines which routes require authentication