How kumagaihirokiss/protospace-b works
This repository is a single Spring Boot monolith that serves a server-rendered web app for managing users, prototypes, and comments. It is packaged as a runnable JAR on Java 21 and is designed to run against PostgreSQL, with schema evolution handled by Flyway.
The main architectural style is MVC:
• Browser requests hit Spring MVC controllers.
• Controllers bind request data into form objects and invoke persistence/auth helpers.
• Domain data is loaded from the database through repository abstractions.
• Responses are rendered with Thymeleaf templates rather than a separate frontend app.
The presentation layer is in src/main/resources/templates. It is split by feature:
• prototypes/ for listing, detail, create, and edit screens
• users/ for login, signup, and user detail screens
• fragments/ for reusable header and footer markup
Static CSS and image assets live under src/main/resources/static, so UI styling is fully server-side rendered and asset-based.
The web/controller layer is feature-oriented:
• PrototypeController handles prototype browsing and CRUD-style interactions.
• CommentController manages comment submission.
• UserController handles account-related flows such as sign-up, login, and user profile views.
This layer is the main boundary between HTTP requests and application logic.
Request validation is separated into dedicated form objects and validation groups:
• UserForm
• CommentForm
• ValidationOrder, ValidationPriority1, ValidationPriority2
This suggests multi-step or prioritized validation rules, likely for signup and posting flows, keeping input validation out of the controllers and entities.
The domain/persistence model is centered on three entities:
• UserEntity
• PrototypeEntity
• CommentEntity
These represent the app’s core business data and likely form the main relational model: users author prototypes, and prototypes receive comments.
Data access is organized through repository interfaces:
• UserRepository
• PrototypeRepository
• CommentRepository
These repositories are the abstraction point between controllers/services and the database. The project dependency list mentions MyBatis, while the file tree shows repository-style persistence and SQL migrations, so the repository boundary is the key persistence seam in the architecture.
Schema management is externalized in Flyway migrations under src/main/resources/db/migration:
• users table
• prototype table
• comment table
• foreign key addition linking prototypes to users
This makes the database structure explicit and versioned, which is important for diagramming the persistence layer as a first-class subsystem rather than an implicit runtime concern.
Authentication and authorization are handled by a separate security slice:
• SecurityConfig defines the security rules and login flow.
• CustomUserDetail adapts application users to Spring Security’s user model.
• UserAuthenticationService supports authentication-related lookup/logic.
This indicates the app has authenticated and anonymous user boundaries, with login/signup integrated into the same monolith.
application.properties and application-prod.properties suggest environment-specific configuration, likely covering database connection, security/session settings, and runtime profiles. The presence of a Dockerfile indicates the app is intended to be containerized for deployment.
From a data-flow perspective, the most important paths are:
• Prototype browsing: HTTP request → controller → repository → PostgreSQL → Thymeleaf view
• Signup/login: HTTP request → controller → form validation → auth/service layer → user repository → security context/session
• Comment posting: HTTP request → controller → comment form validation → repository → database → updated prototype detail view
The only test artifact shown is a Spring Boot application test, so the repo currently appears centered on application-level integration/runtime structure rather than a large unit-test suite.
Main entry points: ProtospaceApplication.java Protospace · PrototypeController.java Prototype Ctrl · CommentController.java Comment Ctrl · UserController.java User Ctrl
Components 21
App Core
Spring Boot entrypoint and runtime wiring.
- Protospace · Application bootstrap and runtime entrypoint.
protospace/src/main/java/in/tech_camp/protospace/ProtospaceApplication.java
Web Layer
MVC controllers and server-rendered views.
- Prototype Ctrl · Handles prototype browsing and CRUD-style interactions.
protospace/src/main/java/in/tech_camp/protospace/controller/PrototypeController.java - Comment Ctrl · Handles comment submission flows.
protospace/src/main/java/in/tech_camp/protospace/controller/CommentController.java - User Ctrl · Handles signup, login, and user profile views.
protospace/src/main/java/in/tech_camp/protospace/controller/UserController.java - Prototype Views · Templates for listing, detail, create, and edit screens.
protospace/src/main/resources/templates/prototypes - User Views · Templates for login, signup, and user detail screens.
protospace/src/main/resources/templates/users
Domain Model
Forms, entities, and validation boundaries.
- User Form · Request binding and validation input for user flows.
protospace/src/main/java/in/tech_camp/protospace/form/UserForm.java - Comment Form · Request binding and validation input for comments.
protospace/src/main/java/in/tech_camp/protospace/form/CommentForm.java - Validation Rules · Prioritized validation ordering for multi-step input checks.
protospace/src/main/java/in/tech_camp/protospace/validation/ValidationOrder.java - User Entity · Core user record stored in the database.
protospace/src/main/java/in/tech_camp/protospace/entity/UserEntity.java - Prototype Entity · Core prototype record stored in the database.
protospace/src/main/java/in/tech_camp/protospace/entity/PrototypeEntity.java - Comment Entity · Core comment record stored in the database.
protospace/src/main/java/in/tech_camp/protospace/entity/CommentEntity.java
Persistence
Repositories and database migrations.
- User Repo · Persistence boundary for user data access.
protospace/src/main/java/in/tech_camp/protospace/repository/UserRepository.java - Prototype Repo · Persistence boundary for prototype data access.
protospace/src/main/java/in/tech_camp/protospace/repository/PrototypeRepository.java - Comment Repo · Persistence boundary for comment data access.
protospace/src/main/java/in/tech_camp/protospace/repository/CommentRepository.java - Flyway Migrations · Versioned database schema evolution scripts.
protospace/src/main/resources/db/migration
Security
Authentication and user identity integration.
- Security Config · Defines authentication, authorization, and login flow.
protospace/src/main/java/in/tech_camp/protospace/SecurityConfig.java - User Detail · Adapts application users to Spring Security's user model.
protospace/src/main/java/in/tech_camp/protospace/custom_user/CustomUserDetail.java - Auth Service · Supports authentication-related user lookup and logic.
protospace/src/main/java/in/tech_camp/protospace/service/UserAuthenticationService.java
UI Assets
Static styling and reusable template fragments.
- Fragments · Reusable header and footer markup.
protospace/src/main/resources/templates/fragments - Static Assets · Server-side UI styling and image assets.
protospace/src/main/resources/static
Connections 29
- Protospace → Security Config: wires · Bootstraps application security configuration.
- Protospace → Prototype Ctrl: hosts · Runs MVC request handling.
- Protospace → Comment Ctrl: hosts · Runs MVC request handling.
- Protospace → User Ctrl: hosts · Runs MVC request handling.
- Security Config → User Detail: uses · Loads authenticated user identity.
- Security Config → Auth Service: delegates · Relies on auth lookup and logic.
- User Ctrl → User Form: binds · Collects request data into forms.
- User Ctrl → Validation Rules: applies · Uses prioritized validation rules.
- Prototype Ctrl → Prototype Repo: reads/writes · Loads and persists prototypes.
- Prototype Ctrl → User Repo: reads · Resolves users for prototype-related flows.
- Comment Ctrl → Comment Form: binds · Collects comment submission data.
- Comment Ctrl → Comment Repo: writes · Persists new comments.
- Comment Ctrl → Validation Rules: applies · Uses validation for comment input.
- Prototype Repo → Prototype Entity: maps · Persists prototype records.
- Prototype Repo → User Entity: joins · Associates prototypes with authors.
- Comment Repo → Comment Entity: maps · Persists comment records.
- User Repo → User Entity: maps · Persists user records.
- Auth Service → User Repo: queries · Looks up users during authentication.
- User Detail → User Entity: adapts · Wraps application user data.
- Prototype Entity → Comment Entity: related · Prototypes receive comments.
- Prototype Ctrl → Prototype Views: renders · Serves prototype screens.
- User Ctrl → User Views: renders · Serves account screens.
- Prototype Views → Fragments: includes · Reuses shared header/footer markup.
- User Views → Fragments: includes · Reuses shared header/footer markup.
- Prototype Views → Static Assets: uses · Consumes CSS and image assets.
- User Views → Static Assets: uses · Consumes CSS and image assets.
- Flyway Migrations → User Entity: creates · Defines the users table.
- Flyway Migrations → Prototype Entity: creates · Defines the prototype table.
- Flyway Migrations → Comment Entity: creates · Defines the comment table.