# javaler/hackathonrunner architecture

> Architecture diagram of the GitHub repository javaler/hackathonrunner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/javaler/hackathonrunner
- Repository: https://github.com/javaler/hackathonrunner

## Overview

##### Main Components
- Frontend Client:
- Represented by the static HTML, CSS, and JavaScript files in src/main/resources/static and the Thymeleaf templates in src/main/resources/templates.
- Use of external libraries like Bootstrap, Chart.js, and custom JavaScript/CSS for interactivity.
- Backend Server:
- The Spring Boot application starting at HackathonRunnerApplication.java.
- Controllers (e.g., HomeController, PostController, QuestionController, RecruitmentController) handling HTTP requests.
- Service layer components in src/main/java/com/example/demo/service managing business logic.
- Data Access Layer (DAO and Repository components such as PostDao, PostRepository, and RecruitmentRepository) communicating with the underlying database.
- DTOs and Forms used to structure and validate data.
- Database:
- Although not directly in the source, the README cites use of Azure Database for PostgreSQL. Represent the database as a distinct component interacting with the persistence (DAO/Repository) layer.
- External API Integration:
- Incorporate the HackathonRunner-Analysis-API as an external service that the diagnostic feature uses to fetch and display similar user posts.
- Infrastructure/Deployment:
- Deployment via Azure App Service and configuration files (like application.properties) supporting environment-specific settings.
- Maven build and deployment pipelines (seen in pom.xml, mvnw scripts, and .github/workflows for Heroku deployment even if deployed elsewhere now).

##### Detail the Relationships and Interactions
- Browser sends an HTTP request to the appropriate Controller (e.g., when a user answers diagnostic questions or submits a post).
- Within the Backend:
- Controllers invoke Service layer methods.
- Services interact with DAO/Repository components to perform CRUD operations on the Database.
- External Integration:
- When processing the diagnostic feature, a Controller/Service makes an API call (HTTP request) to the HackathonRunner-Analysis-API, and then processes the response to display recommendations.

##### Architectural Patterns and Design Principles
- MVC Pattern:
- Clearly separate the presentation layer (Frontend static resources and templates), the Controller layer (handling incoming requests), the Service layer (business logic), and the Data Access layer.
- Layered Architecture:
- Strict layering from the controllers (entry point), cascading down to services and data repositories.
- External Service Integration:
- API call flows, showing how the backend interacts with a separate analysis component (HackathonRunner-Analysis-API).

##### Technologies and Frameworks
- Use of Spring Boot as the backbone of the backend application.
- That Maven is used for project management and building the application.
- Specify the front-end technologies: HTML/CSS, JavaScript, Bootstrap, and Chart.js.
- For deployment/infrastructure, note Azure App Service and Azure Database for PostgreSQL.

- Clear labels for each component with names reflecting the source code structure (controllers, service, repository, etc.).
- Data flow from the browser (frontend) to the controllers.
- Interactions between Controllers, Services, and Data Access objects.
- External API calls (from backend to HackathonRunner-Analysis-API).
- Frontend components (templates, static resources).
- Mid-tier components (controllers and services).
- Persistence layer (repositories/DAOs linked to the database).
- External services and deployment infrastructure.

## Diagram (Mermaid)

```mermaid
flowchart TD
    BROWSER("Browser"):::frontend

    subgraph "Frontend Client"
        FE1("Static Assets"):::frontend
        FE2("HTML Templates"):::frontend
    end

    subgraph "Backend Server"
        APP("HackathonRunnerApplication"):::backend

        subgraph "Controllers"
            C1("HomeController"):::controller
            C2("PostController"):::controller
            C3("QuestionController"):::controller
            C4("RecruitmentController"):::controller
        end

        subgraph "Services"
            S1("PostService"):::service
            S2("QuestionService"):::service
        end

        subgraph "Data Access Layer"
            subgraph "DAO"
                D1("PostDao"):::dao
                D2("PostDaoImpl"):::dao
            end
            subgraph "Repositories"
                R1("PostRepository"):::repository
                R2("RecruitmentRepository"):::repository
            end
        end

        subgraph "DTOs and Forms"
            DTO("ResponseBody"):::dto
            F1("PostForm"):::form
            F2("PostQuery"):::form
            F3("QuestionForm"):::form
            F4("RecruitmentForm"):::form
        end

        subgraph "Configuration & Build"
            CFG1("application.properties"):::config
            CFG2("pom.xml"):::config
            CFG3(".github/workflows/deploy-to-heroku.yml"):::config
            CFG4("mvnw"):::config
            CFG5("mvnw.cmd"):::config
        end
    end

    subgraph "External & Infrastructure"
        EAPI("HackathonRunner-Analysis-API"):::external
        AZDB("Azure Database for PostgreSQL"):::database
        AZAPP("Azure App Service"):::infrastructure
    end

    BROWSER -->|"HTTP_Request"| C1

    APP --> C1
    APP --> C2
    APP --> C3
    APP --> C4

    C1 -->|"invoke"| S1
    C2 -->|"invoke"| S1
    C4 -->|"invoke"| S1
    C3 -->|"invoke"| S2

    S1 -->|"access"| R1
    S1 -->|"access"| R2
    S1 -->|"access"| D1
    D1 -->|"use"| D2

    R1 -->|"CRUD"| AZDB
    R2 -->|"CRUD"| AZDB
    D1 -->|"CRUD"| AZDB
    D2 -->|"CRUD"| AZDB

    S2 -->|"call"| EAPI

    APP -->|"deployed_on"| AZAPP

    classDef frontend fill:#f4f1de,stroke:#d90429,stroke-width:2px;
    classDef backend fill:#edf6f9,stroke:#023e8a,stroke-width:2px;
    classDef controller fill:#ffddd2,stroke:#f77f00,stroke-width:2px;
    classDef service fill:#caffbf,stroke:#1982c4,stroke-width:2px;
    classDef dao fill:#e0fbfc,stroke:#028090,stroke-width:2px;
    classDef repository fill:#f6bd60,stroke:#f28482,stroke-width:2px;
    classDef dto fill:#d3ede6,stroke:#2b2d42,stroke-width:2px;
    classDef form fill:#ead2ac,stroke:#9a031e,stroke-width:2px;
    classDef config fill:#ffefef,stroke:#6a040f,stroke-width:2px;
    classDef external fill:#ffe066,stroke:#ff6f59,stroke-width:2px;
    classDef database fill:#dfe7fd,stroke:#03045e,stroke-width:2px;
    classDef infrastructure fill:#DEFACE,stroke:#4a4a4a,stroke-width:2px;

    %% Click Events
    click FE1 "https://github.com/javaler/hackathonrunner/tree/main/src/main/resources/static"
    click FE2 "https://github.com/javaler/hackathonrunner/tree/main/src/main/resources/templates"
    click APP "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/HackathonRunnerApplication.java"
    click C1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/controller/HomeController.java"
    click C2 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/controller/PostController.java"
    click C3 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/controller/QuestionController.java"
    click C4 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/controller/RecruitmentController.java"
    click S1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/service/PostService.java"
    click S2 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/service/QuestionService.java"
    click D1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/dao/PostDao.java"
    click D2 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/dao/PostDaoImpl.java"
    click R1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/repository/PostRepository.java"
    click R2 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/repository/RecruitmentRepository.java"
    click DTO "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/dto/ResponseBody.java"
    click F1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/form/PostForm.java"
    click F2 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/form/PostQuery.java"
    click F3 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/form/QuestionForm.java"
    click F4 "https://github.com/javaler/hackathonrunner/blob/main/src/main/java/com/example/demo/form/RecruitmentForm.java"
    click CFG1 "https://github.com/javaler/hackathonrunner/blob/main/src/main/resources/application.properties"
    click CFG2 "https://github.com/javaler/hackathonrunner/blob/main/pom.xml"
    click CFG3 "https://github.com/javaler/hackathonrunner/blob/main/.github/workflows/deploy-to-heroku.yml"
    click CFG4 "https://github.com/javaler/hackathonrunner/tree/main/mvnw"
    click CFG5 "https://github.com/javaler/hackathonrunner/blob/main/mvnw.cmd"
```
