# karan19/internet-banking architecture

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

- Interactive diagram: https://gitdiagram.com/karan19/internet-banking
- Repository: https://github.com/karan19/internet-banking

## Overview

##### Project Type and Purpose
- This is a monolithic Java EE web application packaged with Maven and deployed to an OpenShift Tomcat (`jbossews`) cartridge.
- It provides online banking features: user registration, login, account opening, profile management, fund transfers (with OTP via SMS/email), and transaction history.

##### File-Structure Analysis
- src/main/java: core JavaBeans (OtpBean, SendOtpBean, SendSmsBean) and any custom action classes.
- src/main/webapp: JSP views organized by feature (login, register, account, fundtransfer, profile, include).
- WEB-INF/lib: third-party libraries (MySQL JDBC, JavaMail, Plivo SDK).
- pom.xml: Maven build, dependencies, packaging as a WAR.
- .openshift/: OpenShift configuration (Tomcat server.xml, context, cron jobs for scheduled tasks).

##### Readme Insights
- No in-depth architecture description – points to OpenShift Tomcat cartridge guide, confirming server platform.
- Cron directory suggests scheduled background jobs (e.g., nightly reports or OTP cleanups).

##### Main Components
a. Presentation Tier (Browser)
- Users interact via a web browser over HTTP/HTTPS.
b. Web Container (Tomcat on OpenShift)
- JSP pages (views)
- JavaBeans and Servlets (controllers/business logic)
- Cron-configured scheduled jobs (background tasks)
c. Database (MySQL)
- Stores user profiles, account details, transactions, OTP records.
d. External Services
- Plivo SMS API for OTP SMS delivery
- JavaMail (SMTP) for OTP email delivery
e. Build & Deployment
- Maven build (pom.xml) produces WAR
- .openshift scripts deploy WAR to Tomcat, apply configuration, schedule cron jobs

##### Relationships and Data Flows
- Browser → HTTP Request → Tomcat (Servlet/JSP)
- Servlet/JSP → Bean → JDBC → MySQL (CRUD)
- Bean → Plivo REST API (send SMS)
- Bean → JavaMail SMTP server (send email)
- Cron jobs → internal tasks → DB or external APIs
- Tomcat logs & metrics → OpenShift logging/monitoring

##### Architectural Patterns & Principles
- MVC-style separation: JSP “views” + JavaBeans/Servlets “controllers” + DB “model.”
- Monolithic deployment: all components in one WAR on a single Tomcat container.
- Use of scheduled jobs (cron) for asynchronous or periodic operations.
- Externalized configuration via OpenShift (.openshift/config/*.xml).

##### Essential Details to Capture
- Configuration layer (.openshift/config) feeding into Tomcat
- Libraries in WEB-INF/lib enabling external integrations

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & Deployment Layer
    subgraph "Build & Deploy"
        style BuildDeploy fill:#D3D3D3,stroke:#333,stroke-width:1px
        Maven["Maven Build (pom.xml)"]:::build
        OSServerConfig["OpenShift Server Config"]:::build
        OSContextConfig["OpenShift Context Config"]:::build
        OSWebConfig["OpenShift Web XML"]:::build
        OSCronDir["OpenShift Cron Jobs"]:::build
        Target["Build Output (target/)"]:::build
    end

    %% Application Server Layer
    subgraph "Tomcat App Server" 
        style AppServer fill:#90EE90,stroke:#333,stroke-width:1px
        subgraph "JSP Views"
            Login["Login JSP"]:::app
            Register["Register JSP"]:::app
            OpenAccount["OpenAccount JSP"]:::app
            Account["Account JSP"]:::app
            FundTransfer["FundTransfer JSP"]:::app
            Profile["Profile JSP"]:::app
            Include["Shared Includes"]:::app
        end
        subgraph "JavaBeans & Servlets"
            OtpBean["OtpBean"]:::app
            SendOtpBean["SendOtpBean"]:::app
            SendSmsBean["SendSmsBean"]:::app
            Actions["Custom Actions"]:::app
        end
        Cron["Scheduled Jobs (cron)"]:::cron
    end

    %% Data Persistence Layer
    DB[(MySQL Database)]:::infra

    %% External Services Layer
    subgraph "External Services"
        style External fill:#FFA500,stroke:#333,stroke-width:1px
        Plivo["Plivo SMS API"]:::ext
        SMTP["SMTP Server"]:::ext
    end

    %% Client
    Browser["Web Browser"]:::infra

    %% Connections
    Browser -->|"HTTP/HTTPS Request"| AppServer
    Maven -->|build WAR| Target
    Target -->|deploy| AppServer

    OSServerConfig --> AppServer
    OSContextConfig --> AppServer
    OSWebConfig --> AppServer

    AppServer -->|"JDBC CRUD"| DB
    OtpBean -->|"REST API"| Plivo
    OtpBean -->|"SMTP Email"| SMTP
    Cron -->|async tasks| DB
    Cron -->|async SMS/Email| Plivo
    Cron -->|async SMS/Email| SMTP

    %% Click Events
    click Maven "https://github.com/karan19/internet-banking/blob/master/pom.xml"
    click OSServerConfig "https://github.com/karan19/internet-banking/blob/master/.openshift/config/server.xml"
    click OSContextConfig "https://github.com/karan19/internet-banking/blob/master/.openshift/config/context.xml"
    click OSWebConfig "https://github.com/karan19/internet-banking/blob/master/.openshift/config/web.xml"
    click OSCronDir "https://github.com/karan19/internet-banking/tree/master/.openshift/cron"
    click OtpBean "https://github.com/karan19/internet-banking/blob/master/src/main/java/OtpBean.java"
    click SendOtpBean "https://github.com/karan19/internet-banking/blob/master/src/main/java/SendOtpBean.java"
    click SendSmsBean "https://github.com/karan19/internet-banking/blob/master/src/main/java/SendSmsBean.java"
    click Actions "https://github.com/karan19/internet-banking/tree/master/src/main/java/action"
    click Login "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/login"
    click Register "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/register"
    click OpenAccount "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/openaccount"
    click Account "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/account"
    click FundTransfer "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/fundtransfer"
    click Profile "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/profile"
    click Include "https://github.com/karan19/internet-banking/tree/master/src/main/webapp/include"
    click AppServer "https://github.com/karan19/internet-banking/blob/master/src/main/webapp/WEB-INF/web.xml"
    click Plivo "https://github.com/karan19/internet-banking/blob/master/src/main/webapp/WEB-INF/lib/plivo-java-3.0.6.jar"
    click SMTP "https://github.com/karan19/internet-banking/blob/master/src/main/webapp/WEB-INF/lib/javax.mail-1.5.4.jar"
    click DB "https://github.com/karan19/internet-banking/blob/master/src/main/webapp/WEB-INF/lib/mysql-connector-java-5.1.25.jar"
    click Target "https://github.com/karan19/internet-banking/tree/master/target"

    %% Styles
    classDef infra fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef app fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ext fill:#FFA500,stroke:#333,stroke-width:1px
    classDef cron fill:#FFE4B5,stroke:#333,stroke-width:1px
    classDef build fill:#D3D3D3,stroke:#333,stroke-width:1pxassion
```
