How gothinkster/spring-boot-realworld-example-app works
Project type and purpose
• This is a backend‐only service implementing the RealWorld API spec.
• It exposes both REST (Spring MVC controllers) and GraphQL (Netflix DGS) adapters over the same domain.
• It uses Spring Boot, MyBatis (Data Mapper pattern), DDD layering, CQRS (separate read/write models), JWT security, and an embedded SQLite/H2 database.
File structure
• Top-level layers under src/main/java/io/spring:
1. api → REST controllers (ArticleApi, UsersApi, etc.)
2. graphql → GraphQL resolvers, mutations, data fetchers
3. application → High-level use-case services (QueryService, CommandService, DTOs, paging utilities)
4. core → Domain entities, repositories (interfaces), services (authorization, JWT)
5. infrastructure → MyBatis mappers & read services, repository implementations, JWT service, DB type handlers
• Config files:
• WebSecurityConfig.java, JwtTokenFilter.java
• MyBatisConfig.java
• application.properties
• Build and deployment:
• Gradle wrapper, Docker build image via Spring Boot plugin
README for additional insights
• Emphasis on DDD: “api” and “graphql” as adapters, “application” as use‐cases, “core” as business model, “infrastructure” as technical details.
• CQRS: read models (QueryService + MyBatis read mappers) vs write models (CommandService + Repository).
• GraphQL schema in resources/schema/schema.graphqls using Netflix DGS.