How nahdaicue/portfolio-spring_boot works
1. Overall shape
- This is a Spring Boot backend organized as a layered monolith.
- The main runtime entry point is PortfolioApplication, with configuration in src/main/resources/application.properties.
2. HTTP/API layer
- Incoming requests are handled by five controllers:
- AuthController
- UserController
- ProfileController
- ProjectController
- PortfolioController
- These controllers are the boundary between external clients and the application’s internal service layer.
3. Service layer
- Business logic is split into domain-focused services:
- AuthService for authentication and registration flow
- UserService
- ProfileService
- ProjectService
- PortfolioService
- Each has an interface plus Impl implementation, which makes the domain boundary explicit and keeps controllers thin.
4. Persistence layer
- Data access is handled by Spring Data repositories:
- UserRepository
- ProfileRepository
- ProjectRepository
- These repositories likely persist to a relational database through JPA, with entities mapped in entitys/.
5. Domain model
- The core persistent entities are:
- User
- Role
- Profile
- Project
- User and Role indicate authorization is role-based, while Profile and Project model portfolio content.
6. DTO boundary
- The API does not appear to expose entities directly; it uses DTOs in separate packages:
- user DTOs for create/update/password change/read
- profile DTOs for create/update/read
- project DTOs
- portfolio DTOs
- This suggests a deliberate separation between external request/response shapes and internal persistence models.
7. Mapping layer
- Mapper classes (UserMapper, ProfileMapper, ProjectMapper) convert between DTOs and entities.
- This gives a clean boundary: controllers deal in DTOs, services work with domain objects, and mapping is centralized instead of duplicated.
8. Security subsystem
- Security is a distinct subsystem under security/:
- SecurityConfig defines the security policy
- JwtAuthenticationFilter intercepts requests
- JwtService handles token creation/validation
- ApplicationConfig and CorsConfig provide supporting security configuration
- The presence of JWT classes indicates stateless authentication rather than server sessions.
9. Authentication flow
- AuthController works with LoginRequest, RegisterRequest, and AuthResponse.
- The request path is likely: client submits credentials → AuthService validates/creates user → JwtService generates token → token is returned and then used on subsequent requests through the filter.
10. Cross-cutting request flow
- Typical flow through the application is:
- external client → controller → service → repository → database
- and back through mapper/DTO conversion to the API response
- Security runs alongside this flow, enforcing authentication before protected controllers/services are reached.
11. Configuration and environment
- application.properties is the main externalized configuration point for things like server settings, datasource, and security-related properties.
- The repository includes Maven wrapper files, so the project is built with Maven and is portable across environments.
12. Testing
- There is a basic Spring Boot test entry point at PortfolioApplicationTests.
- That suggests the test suite currently includes at least application-context startup validation, with room for additional unit or integration tests.
13. Architecture boundaries to draw
- If you are diagramming it, the clearest boundaries are:
- Client/API boundary: controllers + auth endpoints
- Application/business boundary: service interfaces/implementations
- Data boundary: repositories + entities
- Security boundary: JWT filter/config/service around all protected requests
- Transformation boundary: DTOs and mappers separating API models from persistence models
Main entry points: AuthService.java AuthService · UserService.java UserService · ProfileService.java ProfileService · ProjectService.java ProjectService
Components 31
API layer
HTTP entrypoints and request/response contracts
- AuthController · Authentication and registration endpoints
src/main/java/com/nahuelcuello/portfolio/controller/AuthController.java - UserController · User management endpoints
src/main/java/com/nahuelcuello/portfolio/controller/UserController.java - ProfileController · Profile endpoints
src/main/java/com/nahuelcuello/portfolio/controller/ProfileController.java - ProjectController · Project endpoints
src/main/java/com/nahuelcuello/portfolio/controller/ProjectController.java - PortfolioController · Portfolio summary endpoints
src/main/java/com/nahuelcuello/portfolio/controller/PortfolioController.java - UserDTOs · Create, update, password, and read shapes
src/main/java/com/nahuelcuello/portfolio/DTO/userDTO - ProfileDTOs · Create, update, and read shapes
src/main/java/com/nahuelcuello/portfolio/DTO/profileDTO - ProjectDTO · Project response shape
src/main/java/com/nahuelcuello/portfolio/DTO/projectDTO/ProjectDTO.java - PortfolioDTO · Portfolio response shape
src/main/java/com/nahuelcuello/portfolio/DTO/portfolioDTO/PortfolioDTO.java - Auth payloads · Login, register, and auth response shapes
src/main/java/com/nahuelcuello/portfolio/security/auth
Application layer
Business services and orchestration
- UserService · User use cases
src/main/java/com/nahuelcuello/portfolio/services/userService/UserService.java - ProfileService · Profile use cases
src/main/java/com/nahuelcuello/portfolio/services/profileService/ProfileService.java - ProjectService · Project use cases
src/main/java/com/nahuelcuello/portfolio/services/projectService/ProjectService.java - PortfolioService · Portfolio composition use cases
src/main/java/com/nahuelcuello/portfolio/services/portfolioService/PortfolioService.java - UserMapper · Maps user DTOs and entities
src/main/java/com/nahuelcuello/portfolio/mapper/UserMapper.java - ProfileMapper · Maps profile DTOs and entities
src/main/java/com/nahuelcuello/portfolio/mapper/ProfileMapper.java - ProjectMapper · Maps project DTOs and entities
src/main/java/com/nahuelcuello/portfolio/mapper/ProjectMapper.java
Data layer
Persistence and domain entities
- UserRepository · Persists users
src/main/java/com/nahuelcuello/portfolio/repository/UserRepository.java - ProfileRepository · Persists profiles
src/main/java/com/nahuelcuello/portfolio/repository/ProfileRepository.java - ProjectRepository · Persists projects
src/main/java/com/nahuelcuello/portfolio/repository/ProjectRepository.java - User · Account and identity model
src/main/java/com/nahuelcuello/portfolio/entitys/User.java - Role · Authorization role model
src/main/java/com/nahuelcuello/portfolio/entitys/Role.java - Profile · Public profile model
src/main/java/com/nahuelcuello/portfolio/entitys/Profile.java - Project · Portfolio project model
src/main/java/com/nahuelcuello/portfolio/entitys/Project.java
Security
JWT authentication and request protection
- AuthService · Validates login and registration
src/main/java/com/nahuelcuello/portfolio/security/service/AuthService.java - JwtService · Creates and validates JWTs
src/main/java/com/nahuelcuello/portfolio/security/service/JwtService.java - JwtFilter · Protects requests using JWT auth
src/main/java/com/nahuelcuello/portfolio/security/jwt/JwtAuthenticationFilter.java - SecurityConfig · Defines access policy and filter chain
src/main/java/com/nahuelcuello/portfolio/security/SecurityConfig.java
Support
Configuration, bootstrapping, and shared infrastructure
- PortfolioApp · Main application bootstrap
src/main/java/com/nahuelcuello/portfolio/PortfolioApplication.java - App config · Application and CORS support config
src/main/java/com/nahuelcuello/portfolio/security/config - application.properties · Externalized Spring configuration
src/main/resources/application.properties
Connections 32
- PortfolioApp → SecurityConfig: loads · Bootstraps the security setup
- PortfolioApp → App config: loads · Starts application with supporting config
- AuthController → AuthService: uses · Delegates authentication flow
- AuthController → Auth payloads: accepts/returns · Uses login, register, and auth response payloads
- UserController → UserService: uses · Delegates user operations
- UserController → UserDTOs: accepts/returns · Uses user request and response DTOs
- ProfileController → ProfileService: uses · Delegates profile operations
- ProfileController → ProfileDTOs: accepts/returns · Uses profile request and response DTOs
- ProjectController → ProjectService: uses · Delegates project operations
- ProjectController → ProjectDTO: returns · Uses project response DTOs
- PortfolioController → PortfolioService: uses · Builds portfolio views
- PortfolioController → PortfolioDTO: returns · Uses portfolio response DTOs
- AuthService → JwtService: issues tokens · Creates JWTs after auth succeeds
- JwtFilter → JwtService: validates · Parses and validates bearer tokens
- SecurityConfig → JwtFilter: registers · Adds JWT filter to the security chain
- UserService → UserRepository: persists · Reads and writes users
- ProfileService → ProfileRepository: persists · Reads and writes profiles
- ProjectService → ProjectRepository: persists · Reads and writes projects
- UserService → UserMapper: maps · Converts between user DTOs and entity
- ProfileService → ProfileMapper: maps · Converts between profile DTOs and entity
- ProjectService → ProjectMapper: maps · Converts between project DTOs and entity
- UserMapper → User: targets · Maps into user domain objects
- UserMapper → UserDTOs: targets · Maps into user API shapes
- ProfileMapper → Profile: targets · Maps into profile domain objects
- ProfileMapper → ProfileDTOs: targets · Maps into profile API shapes
- ProjectMapper → Project: targets · Maps into project domain objects
- ProjectMapper → ProjectDTO: targets · Maps into project API shapes
- User → Role: relates to · User authorization is role-based
- AuthService → UserRepository: creates users · Registration flow stores new accounts
- AuthService → User: authenticates · Loads user identity during login
- application.properties → SecurityConfig: supports · Provides externalized runtime settings
- application.properties → App config: supports · Feeds datasource and app settings