# jaiswaladi246/boardgame architecture

> Architecture diagram of the GitHub repository jaiswaladi246/boardgame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaiswaladi246/boardgame
- Repository: https://github.com/jaiswaladi246/boardgame

## Overview

1. **Overall shape**
   This is a server-rendered Spring Boot web application, not a JSON API. The main runtime flow is: browser request → Spring MVC controller → JDBC database access → Thymeleaf view rendering → HTML response.

2. **Core domain**
   The application centers on two business entities: **BoardGame** and **Review**. These live in `com.javaproject.beans` and represent the data passed between controllers, the database layer, and templates. `ErrorMessage` is used for error presentation.

3. **Web layer**
   `BoardGameController` and `HomeController` are the primary MVC entry points. They handle page navigation and user actions such as viewing board games/reviews, adding games, and adding or managing reviews. The app uses Thymeleaf templates rather than a frontend SPA.

4. **Data access boundary**
   `DatabaseAccess` is the persistence boundary for the application. It encapsulates JDBC-based interaction with the database, so controllers do not talk directly to SQL. This is the main separation between presentation logic and storage logic.

5. **Database model and initialization**
   The app uses an **H2 in-memory database**. `src/main/resources/schema.sql` defines the schema and seeds initial data, which matches the README’s default users and starting content. This means the app is designed to bootstrap itself on startup in a local/runtime database.

6. **Security model**
   `SecurityConfig` and `LoggingAccessDeniedHandler` enforce authentication and authorization. The security boundary splits the app into:
   - **public pages** for browsing board games and reviews
   - **user pages** for adding board games and reviews
   - **manager pages** for elevated review edit/delete capabilities

7. **Role-specific UI**
   The `templates/secured/user` and `templates/secured/manager` directories show role-based page variants. The app’s authorization model is reflected both in backend access control and in the page structure, so protected functionality is not just hidden in the UI; it is gated by Spring Security.

8. **View composition**
   Thymeleaf fragments under `templates/fragments` provide shared layout pieces like header, footer, and common links. This reduces duplication across pages such as `index`, `login`, `new-user`, `boardgame`, and `review`.

9. **Static assets**
   CSS, JavaScript, and images live under `src/main/resources/static`. These are the browser-facing assets that support the Thymeleaf pages, likely including styling, simple client-side behavior, and branding.

10. **Error handling**
    There is a dedicated permission-denied view under `templates/error`, which aligns with the custom access-denied handler. This indicates the app handles authorization failures as a first-class user experience rather than relying on default framework errors.

11. **Testing**
    Tests are split into application startup tests plus focused controller/database tests. That suggests the repo verifies both Spring context wiring and the behavior of the MVC/data-access layers.

12. **Delivery and deployment**
    The presence of a `Dockerfile`, `Jenkinsfile`, and `deployment-service.yaml` indicates the app is built for containerized delivery and automated deployment. README also mentions AWS EC2 as the hosting target, so the architecture includes a deployment pipeline and container/runtime boundary beyond the code itself.

Main entry points: [`src/main/java/com/javaproject/controllers/BoardGameController.java`](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/BoardGameController.java) (Game controller), [`src/main/java/com/javaproject/controllers/HomeController.java`](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/HomeController.java) (Home controller), [`src/main/java/com/javaproject/security/SecurityConfig.java`](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/security/SecurityConfig.java) (Security config), [`src/main/java/com/javaproject/database/DatabaseAccess.java`](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/database/DatabaseAccess.java) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_app(("App startup<br/>Spring Boot main"))
end

subgraph group_web["Web Layer"]
  node_home_controller["Home controller<br/>MVC controller"]
  node_boardgame_controller["Game controller<br/>MVC controller"]
end

subgraph group_domain["Domain"]
  node_boardgame_bean["BoardGame<br/>domain bean<br/>[BoardGame.java]"]
  node_review_bean["Review<br/>domain bean<br/>[Review.java]"]
  node_error_message["ErrorMessage<br/>view model<br/>[ErrorMessage.java]"]
end

subgraph group_data["Persistence"]
  node_db_access[("Database access<br/>JDBC boundary")]
  node_schema_sql["Schema seed<br/>DB init script<br/>[schema.sql]"]
end

subgraph group_security["Security"]
  node_security_config["Security config<br/>Spring Security"]
  node_access_denied_handler["Denied handler<br/>security handler"]
end

subgraph group_views["Views"]
  node_index_view["Home page<br/>thymeleaf view<br/>[index.html]"]
  node_boardgame_view["Board game page<br/>thymeleaf view<br/>[boardgame.html]"]
  node_review_view["Review page<br/>thymeleaf view<br/>[review.html]"]
  node_login_view["Login page<br/>thymeleaf view<br/>[login.html]"]
  node_fragments["Fragments"]
  node_secured_views["Secured pages<br/>role views"]
  node_error_view["Denied page<br/>thymeleaf view"]
  node_static_assets["Static assets<br/>web assets"]
end

subgraph group_ops["Delivery"]
  node_delivery{{"Delivery pipeline<br/>build/deploy"}}
end

node_app -->|"wires MVC"| node_home_controller
node_app -->|"wires MVC"| node_boardgame_controller
node_home_controller -->|"renders"| node_index_view
node_home_controller -->|"renders"| node_login_view
node_boardgame_controller -->|"uses"| node_boardgame_bean
node_boardgame_controller -->|"uses"| node_review_bean
node_boardgame_controller -->|"reads/writes"| node_db_access
node_db_access -->|"boots from"| node_schema_sql
node_db_access -->|"maps"| node_boardgame_bean
node_db_access -->|"maps"| node_review_bean
node_security_config -->|"permits"| node_home_controller
node_security_config -->|"guards"| node_boardgame_controller
node_security_config -->|"routes"| node_secured_views
node_security_config -->|"uses"| node_access_denied_handler
node_access_denied_handler -->|"shows"| node_error_view
node_home_controller -->|"composes"| node_fragments
node_boardgame_controller -->|"composes"| node_fragments
node_index_view -->|"loads"| node_static_assets
node_secured_views -->|"loads"| node_static_assets
node_delivery -->|"packages"| node_app

click node_app "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/DatabaseServiceProjectApplication.java"
click node_home_controller "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/HomeController.java"
click node_boardgame_controller "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/BoardGameController.java"
click node_boardgame_bean "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/BoardGame.java"
click node_review_bean "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/Review.java"
click node_error_message "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/ErrorMessage.java"
click node_db_access "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/database/DatabaseAccess.java"
click node_schema_sql "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/schema.sql"
click node_security_config "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/security/SecurityConfig.java"
click node_access_denied_handler "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/security/LoggingAccessDeniedHandler.java"
click node_index_view "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/index.html"
click node_boardgame_view "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/boardgame.html"
click node_review_view "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/review.html"
click node_login_view "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/login.html"
click node_fragments "https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/templates/fragments"
click node_secured_views "https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/templates/secured"
click node_error_view "https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/error/permission-denied.html"
click node_static_assets "https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/static"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_delivery toneBlue
class node_home_controller,node_boardgame_controller toneAmber
class node_boardgame_bean,node_review_bean,node_error_message toneMint
class node_db_access,node_schema_sql toneRose
class node_security_config,node_access_denied_handler toneIndigo
class node_index_view,node_boardgame_view,node_review_view,node_login_view,node_fragments,node_secured_views,node_error_view,node_static_assets toneTeal
```

## Components

### Runtime

Spring Boot application startup and request handling

- [App startup](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/DatabaseServiceProjectApplication.java): Spring Boot main · Application entrypoint that boots the Spring context and web runtime · `src/main/java/com/javaproject/DatabaseServiceProjectApplication.java`

### Web Layer

MVC entry points and page navigation

- [Home controller](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/HomeController.java): MVC controller · Handles landing, login, and navigation pages · `src/main/java/com/javaproject/controllers/HomeController.java`
- [Game controller](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/controllers/BoardGameController.java): MVC controller · Handles board game and review actions and page flow · `src/main/java/com/javaproject/controllers/BoardGameController.java`

### Domain

Core application data objects

- [BoardGame](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/BoardGame.java): domain bean · Board game data passed between controller, database, and views · `src/main/java/com/javaproject/beans/BoardGame.java`
- [Review](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/Review.java): domain bean · Review data bound to forms and rendered in pages · `src/main/java/com/javaproject/beans/Review.java`
- [ErrorMessage](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/beans/ErrorMessage.java): view model · Error payload used for user-facing failure messages · `src/main/java/com/javaproject/beans/ErrorMessage.java`

### Persistence

JDBC access and database bootstrap

- [Database access](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/database/DatabaseAccess.java): JDBC boundary · Encapsulates SQL and database operations for the application · `src/main/java/com/javaproject/database/DatabaseAccess.java`
- [Schema seed](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/schema.sql): DB init script · Defines H2 schema and initial data loaded on startup · `src/main/resources/schema.sql`

### Security

Authentication, authorization, and denied-access handling

- [Security config](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/security/SecurityConfig.java): Spring Security · Defines authentication and authorization rules · `src/main/java/com/javaproject/security/SecurityConfig.java`
- [Denied handler](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/java/com/javaproject/security/LoggingAccessDeniedHandler.java): security handler · Custom handler for authorization failures · `src/main/java/com/javaproject/security/LoggingAccessDeniedHandler.java`

### Views

Thymeleaf templates and shared fragments

- [Home page](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/index.html): thymeleaf view · Public landing page · `src/main/resources/templates/index.html`
- [Board game page](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/boardgame.html): thymeleaf view · Public board game detail and browse page · `src/main/resources/templates/boardgame.html`
- [Review page](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/review.html): thymeleaf view · Public review display page · `src/main/resources/templates/review.html`
- [Login page](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/login.html): thymeleaf view · Authentication page · `src/main/resources/templates/login.html`
- [Fragments](https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/templates/fragments): view fragments · Shared Thymeleaf header, footer, and links fragments · `src/main/resources/templates/fragments`
- [Secured pages](https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/templates/secured): role views · Protected user and manager page variants · `src/main/resources/templates/secured`
- [Denied page](https://github.com/jaiswaladi246/boardgame/blob/main/src/main/resources/templates/error/permission-denied.html): thymeleaf view · User-facing permission denied page · `src/main/resources/templates/error/permission-denied.html`
- [Static assets](https://github.com/jaiswaladi246/boardgame/tree/main/src/main/resources/static): web assets · CSS, JavaScript, and images served to the browser · `src/main/resources/static`

### Delivery

Container build and deployment pipeline

- **Delivery pipeline**: build/deploy · Containerization and CI/CD deployment artifacts

## Connections

- App startup → Home controller: wires MVC · Bootstraps controllers into the web application
- App startup → Game controller: wires MVC · Bootstraps controllers into the web application
- Home controller → Home page: renders · Serves the public landing page
- Home controller → Login page: renders · Serves the login page
- Game controller → BoardGame: uses · Binds board game data to requests and views
- Game controller → Review: uses · Binds review data to requests and views
- Game controller → Database access: reads/writes · Delegates persistence work to the JDBC boundary
- Database access → Schema seed: boots from · Relies on schema and seed data in H2 startup script
- Database access → BoardGame: maps · Materializes board game records
- Database access → Review: maps · Materializes review records
- Security config → Home controller: permits · Allows public navigation pages
- Security config → Game controller: guards · Protects write and management actions
- Security config → Secured pages: routes · Controls access to role-based pages
- Security config → Denied handler: uses · Delegates forbidden access handling
- Denied handler → Denied page: shows · Directs users to permission denied page
- Home controller → Fragments: composes · Reuses shared page layout fragments
- Game controller → Fragments: composes · Reuses shared page layout fragments
- Home page → Static assets: loads · Uses browser assets for styling and scripts
- Secured pages → Static assets: loads · Uses browser assets for styling and scripts
- Delivery pipeline → App startup: packages · Builds and deploys the application runtime
