# mdasif114/seller-portal architecture

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

- Interactive diagram: https://gitdiagram.com/mdasif114/seller-portal
- Repository: https://github.com/mdasif114/seller-portal

## Overview

##### Project type and purpose
- This is a Java Spring Boot full-stack web application (“Seller Portal”) that serves HTML via Thymeleaf templates, handles user registration (user, identity, address, bank), authentication, and a dashboard. It uses embedded Tomcat, Spring MVC, Spring Data JPA, Spring Security, and an H2 in-memory database.

##### File structure
- Top-level:
- pom.xml, Maven wrapper — build & run
- src/main/java/com/seller/portal:
– configuration: SecurityConfiguration
– controller: MVC controllers (LoginController, Registration controllers, DashboardController)
– service: business logic services
– repositories: Spring Data JPA interfaces
– entities: JPA domain models
– validators & utils: DTOs and constants
- src/main/resources:
– application.properties, session-schema.sql
– templates: Thymeleaf HTML views
- Tests under src/test validate service layer behavior.

##### README for additional insights
- Launch via `mvn spring-boot:run` or running SellerPortalApplication.java
- Default port 8080, H2 console available under /h2-console

##### Main components
a. User’s Web Browser (Client)
b. Embedded Tomcat Server (within SellerPortalApplication)
c. Spring Security filter chain (authentication & authorization)
d. Controllers (MVC entry points)
e. Service Layer (business logic services)
f. Repository/Data Access Layer (Spring Data JPA)
g. H2 Database (in-memory)
h. Thymeleaf View Resolver / Template Engine

##### Relationships & interactions
- Browser → HTTP requests → Embedded Tomcat
- Tomcat → Security Filter → Controllers
- Controller → Service → Repository → H2 DB
- Service returns data → Controller → Thymeleaf templates → Browser
- application.properties drives port, database config

##### Architectural patterns & design principles
- Layered MVC (Controller → Service → Repository)
- Dependency Injection (Spring Boot auto-wiring)
- Convention-over-Configuration (Spring Boot starters)
- In-memory DB for dev/test (H2 with embedded console)
- DTO/Validator pattern for request payloads

##### Technologies & frameworks
- Java 11+ (or configured version)
- Spring Boot (Web, Security, Data JPA, Thymeleaf)
- Maven for build & CLI run
- H2 Database (in-memory)
- Thymeleaf for view rendering

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Browser["User Web Browser"]:::external

    %% Application Container
    subgraph "SellerPortalApplication" 
        direction TB
        ApplicationNode["SellerPortalApplication (Embedded Tomcat)"]:::config
        SecurityChain["Spring Security Filter Chain"]:::web
        TemplateEngine["Thymeleaf Template Engine"]:::config

        subgraph "Web Layer (Controllers)"
            direction TB
            LoginController["LoginController"]:::web
            UserRegController["UserRegistrationController"]:::web
            AddressRegController["AddressRegistrationController"]:::web
            BankRegController["BankRegistrationController"]:::web
            IdentityRegController["IdentityRegistrationController"]:::web
            DashboardController["DashboardController"]:::web
        end

        subgraph "Business Layer (Services)"
            direction TB
            UserRegService["UserRegistrationService"]:::business
            AddressRegService["AddressRegistrationService"]:::business
            BankRegService["BankRegistrationService"]:::business
            IdentityRegService["IdentityRegistrationService"]:::business
            DashboardService["DashboardService"]:::business
        end

        subgraph "Data Layer"
            direction TB
            subgraph "Repositories"
                UserRepository["UserRepository"]:::data
                AddressRepository["AddressRepository"]:::data
                BankAccountRepository["BankAccountRepository"]:::data
                IdentityRepository["IdentityRepository"]:::data
            end
            subgraph "Entities"
                UserEntity["User"]:::data
                AddressEntity["Address"]:::data
                BankEntity["Bank"]:::data
                IdentityEntity["Identity"]:::data
                RoleEntity["Role"]:::data
            end
        end

        subgraph "Configuration & Resources"
            direction TB
            AppProperties["application.properties"]:::config
            SessionSchema["session-schema.sql"]:::config
            ConstantsNode["Constants"]:::config
            SecurityConfigNode["SecurityConfiguration"]:::config
        end
    end

    %% Database
    H2Database["H2 In-Memory Database"]:::data

    %% Flows
    Browser -->|"HTTP GET/POST"| ApplicationNode
    ApplicationNode -->|routes to| SecurityChain
    SecurityChain -->|filters| LoginController
    SecurityChain -->|filters| UserRegController
    SecurityChain -->|filters| AddressRegController
    SecurityChain -->|filters| BankRegController
    SecurityChain -->|filters| IdentityRegController
    SecurityChain -->|filters| DashboardController

    LoginController -->|"invoke"| UserRegService
    UserRegController -->|"invoke"| UserRegService
    AddressRegController -->|"invoke"| AddressRegService
    BankRegController -->|"invoke"| BankRegService
    IdentityRegController -->|"invoke"| IdentityRegService
    DashboardController -->|"invoke"| DashboardService

    UserRegService -->|"CRUD via JPA"| UserRepository
    AddressRegService -->|"CRUD via JPA"| AddressRepository
    BankRegService -->|"CRUD via JPA"| BankAccountRepository
    IdentityRegService -->|"CRUD via JPA"| IdentityRepository
    DashboardService -->|"aggregate"| UserRepository
    DashboardService -->|"aggregate"| AddressRepository
    DashboardService -->|"aggregate"| BankAccountRepository
    DashboardService -->|"aggregate"| IdentityRepository

    UserRepository -->|"JDBC/Hibernate"| H2Database
    AddressRepository -->|"JDBC/Hibernate"| H2Database
    BankAccountRepository -->|"JDBC/Hibernate"| H2Database
    IdentityRepository -->|"JDBC/Hibernate"| H2Database

    %% Response Rendering
    LoginController -->|"render login.html"| TemplateEngine -->|"HTML response"| Browser
    UserRegController -->|"render user_registration.html"| TemplateEngine -->|"HTML response"| Browser
    AddressRegController -->|"render addressRegistration.html"| TemplateEngine -->|"HTML response"| Browser
    BankRegController -->|"render bankAccountRegistration.html"| TemplateEngine -->|"HTML response"| Browser
    IdentityRegController -->|"render identityRegistration.html"| TemplateEngine -->|"HTML response"| Browser
    DashboardController -->|"render dashboard.html"| TemplateEngine -->|"HTML response"| Browser

    %% Admin H2 Console Access
    Browser -->|"/h2-console"| H2Database

    %% Click Events
    click ApplicationNode "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/SellerPortalApplication.java"
    click SecurityConfigNode "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/configuration/SecurityConfiguration.java"

    click LoginController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/LoginController.java"
    click UserRegController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/UserRegistrationController.java"
    click AddressRegController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/AddressRegistrationController.java"
    click BankRegController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/BankRegistrationController.java"
    click IdentityRegController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/IdentityRegistrationController.java"
    click DashboardController "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/controller/DashboardController.java"

    click UserRegService "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/service/UserRegistrationService.java"
    click AddressRegService "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/service/AddressRegistrationSevice.java"
    click BankRegService "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/service/BankRegistrationService.java"
    click IdentityRegService "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/service/IdentityRegistrationService.java"
    click DashboardService "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/service/DashboardService.java"

    click UserRepository "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/repositories/UserRepository.java"
    click AddressRepository "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/repositories/AddressRepository.java"
    click BankAccountRepository "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/repositories/BankAccountRepository.java"
    click IdentityRepository "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/repositories/IdentityRepository.java"

    click UserEntity "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/entities/User.java"
    click AddressEntity "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/entities/Address.java"
    click BankEntity "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/entities/Bank.java"
    click IdentityEntity "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/entities/Identity.java"
    click RoleEntity "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/entities/Role.java"

    click AppProperties "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/application.properties"
    click SessionSchema "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/session-schema.sql"
    click ConstantsNode "https://github.com/mdasif114/seller-portal/blob/master/src/main/java/com/seller/portal/utils/Constants.java"

    click TR_UR "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/user_registration.html"
    click TR_AR "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/addressRegistration.html"
    click TR_BR "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/bankAccountRegistration.html"
    click TR_IR "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/identityRegistration.html"
    click TR_Login "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/login.html"
    click TR_Dash "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/dashboard.html"
    click TR_Error "https://github.com/mdasif114/seller-portal/blob/master/src/main/resources/templates/internalServerError.html"

    %% Styles
    classDef web fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef business fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFA500,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#f3f4f6,stroke:#333,stroke-width:1px
```
