CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

spring-boot-development

This guide describes the Orbit application’s single-module Maven layout, including Java packages, resources, and where to place new files. It also records architecture and naming conventions, database migration rules, infrastructure layout, and Maven commands.

Quality

77%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./.cursor/skills/spring-boot-development/SKILL.md
SKILL.md
Quality
Evals
Security

Role: Skill — Orbit package-by-layer layout

Backend Folder Structure — Orbit

When to use: Locating or creating Java/resources files in the Orbit app. Architecture: Single Maven module, package-by-layer under com.orbit.
Never: hexagonal/ports-and-adapters, package-by-feature trees, Gradle.


1. Project Metadata

PropertyValue
FrameworkSpring Boot 3.x
Java Version21
Build ToolMaven (single module — not Gradle)
DBPostgreSQL 16
MigrationsFlyway
MappingManual {Feature}Mapper now; MapStruct later (ADR-0005)
Schema designSkill schema-design → entity + Flyway
SecuritySpring Security + JWT / OAuth2 (later)
DocsSpringDoc OpenAPI
BoilerplateLombok (Lombok-first — see .claude/rules/lombok.md / ADR-0004)
PackagingJAR + Docker
Base packagecom.orbit

2. Top-Level Layout

orbit-production-ready-system/
├── .claude/                         # AI platform (agents, skills, rules, …)
├── .mvn/                            # Maven wrapper
├── docker/                          # Compose layers (Postgres, Redis, …)
├── docs/
├── platform/                        # Terraform / infra
├── src/
│   ├── main/
│   │   ├── java/com/orbit/          # ← Application root package
│   │   └── resources/               # Config, Flyway, templates
│   └── test/
│       └── java/com/orbit/
├── pom.xml                          # Single Maven module
├── mvnw / mvnw.cmd
├── CLAUDE.md
├── AGENTS.md
└── README.md

3. Java Source Tree — com.orbit

Package-by-layer (flat) only. Features are type name prefixes, not packages.

com.orbit/
│
├── OrbitApplication.java               # @SpringBootApplication
│
├── common/                              # ── Cross-Cutting Concerns ──
│   ├── dto/                             # Shared API response contracts
│   │   ├── ApiResponse.java
│   │   ├── ErrorResponse.java
│   │   └── PageResponse.java
│   ├── exception/
│   │   ├── BusinessException.java
│   │   ├── GlobalExceptionHandler.java
│   │   └── ResourceNotFoundException.java
│   ├── filters/
│   │   ├── CorrelationIdFilter.java
│   │   └── RequestLoggingFilter.java
│   ├── security/
│   │   ├── AuthenticationFilter.java
│   │   ├── TokenProvider.java
│   │   └── AuthProperties.java
│   ├── types/
│   └── utils/
│
├── config/
│   ├── AppConfig.java
│   ├── SecurityConfig.java
│   ├── OpenApiConfig.java
│   └── {Feature}Config.java
│
├── controller/
│   ├── {Feature}Controller.java
│   └── ...
│
├── dto/
│   ├── {Feature}Request.java
│   ├── {Feature}Response.java
│   └── {feature}/                       # optional when a feature has many DTOs
│       ├── {Feature}Request.java
│       └── {Feature}Response.java
│
├── entity/
│   └── {Entity}.java
│
├── enums/
│   └── {DomainConcept}.java
│
├── exception/
│   └── {Condition}Exception.java
│
├── mapper/
│   └── {Feature}Mapper.java
│
├── repository/
│   └── {Entity}Repository.java
│
├── scheduler/
│   └── {Purpose}Scheduler.java
│
└── service/
    ├── {Feature}Service.java            # Interface (controllers inject this)
    ├── impl/                            # Implementation layer (required)
    │   └── {Feature}ServiceImpl.java    # @Service — never referenced from controllers
    └── {subsystem}/                     # Strategy-based subsystems only
        ├── {Strategy}Interface.java
        └── provider/
            └── {Implementation}.java

Service layer rule: interfaces in com.orbit.service; implementations in com.orbit.service.impl. Controllers depend on interfaces only.

Forbidden packages: domain, application, infrastructure, port, adapter, feature-root trees like order.controller / order.service.


4. Resources Directory

src/main/resources/
├── application.yml                      # or application.yaml
├── application-{profile}.yml            # profile overrides (local, staging, prod)
├── db/
│   └── migration/
│       ├── V001__{description}.sql
│       └── ...
├── templates/                           # email / HTML templates (when needed)
└── META-INF/
    └── additional-spring-configuration-metadata.json

5. Where to Put New Files

What You're CreatingWhere It Goes
New REST endpointcontroller/{Feature}Controller.java
Request / Response DTOdto/{Feature}Request.java or dto/{feature}/
JPA entityentity/{Entity}.java
Enumenums/{EnumName}.java
DB migrationresources/db/migration/V{NNN}__{description}.sql
Repositoryrepository/{Entity}Repository.java
Service interfaceservice/{Feature}Service.java
Service implementationservice/impl/{Feature}ServiceImpl.java
Mappermapper/{Feature}Mapper.java
Spring configurationconfig/{Name}Config.java
Feature exceptionexception/{Name}Exception.java
Shared DTO / errorscommon/dto/, common/exception/
Servlet filtercommon/filters/{Name}Filter.java
Auth infrastructurecommon/security/
Scheduled jobscheduler/{Name}Scheduler.java
Strategy interfaceservice/{subsystem}/{Strategy}Interface.java
Strategy implementationservice/{subsystem}/provider/{Implementation}.java
Email / HTML templateresources/templates/{name}.html

6. Feature Inventory (Phase 2+)

Features exist as named types across layers, not as Maven/Gradle modules:

FeatureControllerServiceEntity (examples)Notes
Auth✅AuthUser, TokenPhase 1/2
User✅UserUser
Product✅ProductProduct
Inventory✅InventoryStockItem
Order✅OrderOrder, OrderLine
Payment✅PaymentPayment
Notification✅Notification—
Analytics✅Analytics—

7. Key Design Patterns

PatternWhere Applied
Layered architecturecontroller → service (iface) → repository; impls in service.impl
DDDAggregate roots, domain events (in-process first)
Interface SegregationService interfaces in service/, @Service impls in service/impl/
Strategyservice/{subsystem}/{Interface} → provider/{Implementation}
FactoryStrategy factories or complex aggregate construction when needed
Global Error Handlercommon/exception/GlobalExceptionHandler
Filter ChainCorrelation ID → logging → auth
DTO MappingManual {Feature}Mapper in mapper/ for entity→DTO (ADR-0005); MapStruct deferred; create path stays in service; entities never returned as JSON
Embeddable VOsSingle-field VOs @Embeddable + @AttributeOverride on aggregate — no AttributeConverter (ADR-0005)
Lombok (first)Beans @RequiredArgsConstructor/@Slf4j; aggregates major entity set; VOs/DTOs @Data+@Builder — lombok.md / ADR-0004

8. Naming Conventions

TypePatternExample
Controller{Feature}ControllerOrderController
Service Interface{Feature}ServiceOrderService
Service Impl{Feature}ServiceImplOrderServiceImpl
Repository{Entity}RepositoryOrderRepository
Entity{DomainNoun}Order
Request DTO{Feature}Request / {Action}RequestOrderRequest, LoginRequest
Response DTO{Feature}ResponseOrderResponse
Mapper{Feature}Mapper (manual; MapStruct later)UserMapper
Enum{DomainConcept}OrderStatus, PaymentType
Exception{Condition}ExceptionResourceNotFoundException
Filter{Purpose}FilterCorrelationIdFilter
Config{Concern}ConfigSecurityConfig
Scheduler{Purpose}SchedulerCleanupScheduler
Flyway MigrationV{NNN}__{snake_case_desc}.sqlV001__create_orders_table.sql

9. Migration Naming Rules

V{NNN}__{description_in_snake_case}.sql
  • NNN = zero-padded 3-digit sequential number
  • Double underscore __ between version and description
  • Description uses snake_case
  • Pick the next unused V{NNN} after existing files under db/migration/

10. Docker & Infrastructure

orbit-production-ready-system/
├── Dockerfile                       # Multi-stage build (when added)
├── docker/
│   ├── compose.yml                  # Entry compose file
│   ├── compose.base.yml             # Shared base services
│   └── compose.layer*.yml           # Layered infra (data, messaging, …)
└── platform/terraform/              # Cloud infra (not app runtime)

Local infra runs via Compose under docker/ (Postgres required for the app; Redis/Kafka as layers land). Do not put app business packages under docker/ or platform/.


11. Build commands (Maven)

./mvnw verify          # test + package
./mvnw spring-boot:run # local run (needs Compose Postgres)
./mvnw -DskipTests package

Never introduce Gradle wrappers or build.gradle for the app.

Repository

chandrakanthbalaraman/spring-boot-microservices

Path

.cursor/skills/spring-boot-development/SKILL.md

Last updated
First committed
Purpose
DevelopmentAPI developmentDatabase managementInfrastructureDevOps
Form
Reference
Commands
mvnwmvnw verifymvnw spring-boot:runmvnw package

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.