# dreamsbr/pachacamac-back architecture

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

- Interactive diagram: https://gitdiagram.com/dreamsbr/pachacamac-back
- Repository: https://github.com/dreamsbr/pachacamac-back

## Overview

##### Project type and purpose
- This is a monolithic, server-side Java application built with Spring Boot (Maven-based).
- It implements a classic layered MVC style: Controllers expose REST endpoints, Services house business logic, Repositories handle data access, and a relational database persists data.

##### File structure
Top-level artifacts:
- mvnw, pom.xml, .mvn/… → Maven wrapper & build config
- municpalidad.session.sql → SQL script for initializing your database schema/data
- src/main/java/com/example/demo/… → Java code, split into packages:
– Controller → REST controllers (LoginController)
– Service → business logic (LoginService)
– Repository → Spring Data repositories (LoginRepository)
– Model → domain objects/entities (Login)
– config → application-wide config (CORSConfig)
- src/main/resources/application.properties → externalized settings (DB URL, credentials, CORS rules, etc.)
- src/test/java/… → unit/integration tests

##### README
- Only a project name (“pachacamac-back”), so assume standard Spring Boot web service handling user login/session.

##### Main components & relationships
a. External Clients (e.g., Web front-end, Mobile app, Postman)
b. Web/API Layer
- Spring MVC DispatcherServlet
- LoginController
c. Business Logic Layer
- LoginService
d. Data Access Layer
- LoginRepository (Spring Data JPA)
e. Database
- RDBMS (initialized via municpalidad.session.sql)
f. Configuration
- CORSConfig for cross-origin requests
- application.properties for DB & server settings
g. Build/Deployment
- Maven (pom.xml) → produces an executable JAR
- mvnw for consistent builds

- Client → LoginController (HTTP REST calls)
- Controller → Service (method calls)
- Service → Repository (CRUD operations)
- Repository → Database (JDBC/JPA)

##### Architectural patterns & design principles
- Layered architecture (Controller → Service → Repository → DB)
- Separation of concerns
- Dependency Injection (Spring)
- Externalized configuration (application.properties)
- Use of Maven for build lifecycle and dependency management

##### Technologies/frameworks
- Java 11+ & Spring Boot
- Spring MVC (web)
- Spring Data JPA (repository)
- Maven (build)
- SQL RDBMS (e.g., MySQL, PostgreSQL)
- CORS configuration via Spring @Configuration class

##### Putting it all together
- A “Client” element on the left or top

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    Client["External Clients"]:::client

    %% Application Entry
    DemoApplication["DemoApplication"]:::api

    %% API Layer
    subgraph "API Layer"
        direction TB
        DispatcherServlet["DispatcherServlet"]:::api
        LoginController["LoginController"]:::api
    end

    %% Business Layer
    subgraph "Business Layer"
        direction TB
        LoginService["LoginService"]:::service
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        LoginRepository["LoginRepository"]:::repo
        LoginModel["Login (Entity)"]:::repo
    end

    %% Database
    Database["Relational DB\n(municpalidad.session.sql)"]:::database

    %% Configuration
    subgraph "Configuration"
        direction TB
        CORSConfig["CORSConfig"]:::config
        AppProperties["application.properties"]:::config
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        Maven["Maven (pom.xml)"]:::build
        Mvnw["mvnw"]:::build
        MvnwCmd["mvnw.cmd"]:::build
        MvnwWrapperProp[".mvn/wrapper/maven-wrapper.properties"]:::build
        Jar["pachacamac-back.jar"]:::build
        DemoTests["DemoApplicationTests"]:::test
    end

    %% Connections
    Client -->|HTTP REST| DispatcherServlet
    DispatcherServlet -->|routes to| LoginController
    LoginController -->|calls| LoginService
    LoginService -->|uses| LoginRepository
    LoginService -->|uses| LoginModel
    LoginRepository -->|persists to| Database
    Jar -->|runs| DemoApplication

    %% Configuration Links
    CORSConfig -.-> DispatcherServlet
    CORSConfig -.-> LoginController
    AppProperties -.-> DemoApplication
    AppProperties -.-> LoginService
    AppProperties -.-> LoginRepository

    %% Build Flow
    Maven --> Jar
    Mvnw --> Maven
    MvnwCmd --> Maven
    MvnwWrapperProp --> Maven
    DemoTests -->|tests| DemoApplication

    %% Click Events
    click Maven "https://github.com/dreamsbr/pachacamac-back/blob/main/pom.xml"
    click Mvnw "https://github.com/dreamsbr/pachacamac-back/tree/main/mvnw"
    click MvnwCmd "https://github.com/dreamsbr/pachacamac-back/blob/main/mvnw.cmd"
    click MvnwWrapperProp "https://github.com/dreamsbr/pachacamac-back/blob/main/.mvn/wrapper/maven-wrapper.properties"
    click Database "https://github.com/dreamsbr/pachacamac-back/blob/main/municpalidad.session.sql"
    click DemoApplication "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/DemoApplication.java"
    click LoginController "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/Controller/LoginController.java"
    click LoginService "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/Service/LoginService.java"
    click LoginRepository "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/Repository/LoginRepository.java"
    click LoginModel "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/Model/Login.java"
    click CORSConfig "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/java/com/example/demo/config/CORSConfig.java"
    click AppProperties "https://github.com/dreamsbr/pachacamac-back/blob/main/src/main/resources/application.properties"
    click DemoTests "https://github.com/dreamsbr/pachacamac-back/blob/main/src/test/java/com/example/demo/DemoApplicationTests.java"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef api fill:#bbf,stroke:#333,stroke-width:1px
    classDef service fill:#bfb,stroke:#333,stroke-width:1px
    classDef repo fill:#fbf,stroke:#333,stroke-width:1px
    classDef database fill:#ffb,stroke:#333,stroke-width:1px
    classDef config fill:#fcf,stroke:#333,stroke-width:1px
    classDef build fill:#cff,stroke:#333,stroke-width:1px
    classDef test fill:#fdd,stroke:#333,stroke-width:1px
```
