# ranyaserraj/urbaninvest-investment-platform architecture

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

- Interactive diagram: https://gitdiagram.com/ranyaserraj/urbaninvest-investment-platform
- Repository: https://github.com/ranyaserraj/urbaninvest-investment-platform

## Overview

##### Project type and purpose
- This is a monolithic Java EE web application (“UrbanInvest”) that connects real-estate investors and experts.
- It uses the classic MVC pattern: JSPs for views, Servlets for controllers, Java classes/DAOs for the model, and MySQL for persistence.

##### File structure
- src/main/webapp → presentation layer
- JSPs (login.jsp, index.jsp, registration.jsp, etudeFinancier.jsp, etudeMarche.jsp…)
- Static assets (CSS, JS, fonts, images) under assets/, css/, js/, fonts/
- WEB-INF/web.xml → servlet mappings
- WEB-INF/lib/mysql-connector-j.jar → JDBC driver
- src/main/java/projet_s3 → controllers and data model
- Servlets: Login.java, RegistrationServlet.java, form1.java, form2.java
- Domain classes: EtudeFinancier.java, EtudeMarche.java
- DAO interfaces/implementations and DaoFactory
- sql/UrbanInvest.sql → database schema
- docs/ → UI mockups and user flows

##### README for additional insights
- Backend: Java 2EE + Apache Tomcat
- Frontend: JSP + HTML/CSS/JS
- DB: MySQL (XAMPP + phpMyAdmin)
- Features: market studies, financial studies, payment management, email notifications

##### Main components
a. Client Layer
- Investor/Expert browser application
- Static asset requests (CSS/JS/images)
b. Web Server / Servlet Container
- Apache Tomcat
- web.xml servlet mappings
c. Presentation Layer
- JSP pages rendered to client
- JavaScript (main.js, scripts.js) for UI interactivity
d. Controller Layer
- Servlets (Login, Registration, form1, form2) handle HTTP requests
e. Business & Data Layer
- Domain models (EtudeMarche, EtudeFinancier)
- DAO pattern
– DaoFactory
– EtudeMarcheDAO/Impl, EtudeFinancierDAO/Impl
f. Database
- MySQL database with tables: users, demande_conseil, etude_marche, traitement_conseil, paiement
g. External Services
- Email service (SMTP) for notifications
- phpMyAdmin/XAMPP (for local dev & DB management, optional)

##### Relationships and interactions
- Browser → (HTTP Request) → Tomcat
- Tomcat → dispatch to Servlet (via web.xml)
- Servlet → calls DAOFactory → DAO → executes SQL via JDBC driver → MySQL
- MySQL → returns result set → DAO → domain objects → Servlet
- Servlet → forwards to JSP → renders HTML → Tomcat → Browser
- Servlet or business logic → sends email via SMTP → User email inbox

##### Architectural patterns & design principles
- MVC:
- View: JSP + CSS/JS
- Controller: Java Servlets
- Model: Java domain classes + DAO layer
- DAO Factory for decoupling persistence
- Separation of concerns: static assets vs. dynamic content
- Monolithic deployment: single WAR on Tomcat

##### Technologies & frameworks to annotate
- Java EE (Servlet API)
- JSP / JSTL (if used)
- JDBC + mysql-connector-j (JAR in WEB-INF/lib)
- Apache Tomcat 9.x
- MySQL 5.7+
- HTML5 / CSS3 / JavaScript

##### Detail
- Don’t just lump all Java code together—distinctly show each servlet, each DAO interface/impl, the factory, and the JDBC link to MySQL
- Call out the static resource path (assets/, css/, js/) as served directly by the container
- Connection string (JDBC URL → sql/UrbanInvest.sql schema)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph "Client Layer"
        Browser["Investor/Expert Browser"]:::frontend
        subgraph "Static Assets"
            AssetsCSS["css/"]:::frontend
            AssetsJS["js/"]:::frontend
            AssetsFonts["fonts/"]:::frontend
            AssetsImages["images/"]:::frontend
            AssetsAssets["assets/"]:::frontend
        end
    end

    %% Web Server
    subgraph "Web Server / Servlet Container"
        Tomcat["Apache Tomcat"]:::server
        WebXML["web.xml"]:::config
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        JSPIndex["index.jsp"]:::frontend
        JSPlogin["login.jsp"]:::frontend
        JSPReg["registration.jsp"]:::frontend
        JSPFin["etudeFinancier.jsp"]:::frontend
        JSPMarche["etudeMarche.jsp"]:::frontend
        subgraph "Static JS"
            MainJS["main.js"]:::frontend
            ScriptsJS["scripts.js"]:::frontend
        end
    end

    %% Controller Layer
    subgraph "Controller Layer"
        LoginServlet["Login.java"]:::controller
        RegServlet["RegistrationServlet.java"]:::controller
        Form1["form1.java"]:::controller
        Form2["form2.java"]:::controller
    end

    %% Business & Data Layer
    subgraph "Business & Data Layer"
        DomainMarche["EtudeMarche.java"]:::business
        DomainFin["EtudeFinancier.java"]:::business
        DaoFactory["DaoFactory.java"]:::business
        MarcheDAO["EtudeMarcheDAO.java"]:::business
        MarcheDAOImpl["EtudeMarcheDAOImpl.java"]:::business
        FinDAO["EtudeFinancierDAO.java"]:::business
        FinDAOImpl["EtudeFinancierDAOImpl.java"]:::business
        JDBCDriver["mysql-connector-j-9.1.0.jar"]:::config
    end

    %% Database
    subgraph "Database"
        MySQL[(MySQL Database)]:::database
        Schema["UrbanInvest.sql"]:::database
    end

    %% External Services
    subgraph "External Services"
        Email["SMTP Email Service"]:::external
        PhpMyAdmin["phpMyAdmin/XAMPP"]:::external
    end

    %% Connections
    Browser -->|"HTTP Request"| Tomcat
    Browser -->|"Request CSS/JS/Images"| AssetsCSS
    Browser --> AssetsJS
    Browser --> AssetsFonts
    Browser --> AssetsImages
    Browser --> AssetsAssets

    Tomcat -->|reads| WebXML
    Tomcat -->|serves JSP| JSPIndex
    Tomcat --> JSPlogin
    Tomcat --> JSPReg
    Tomcat --> JSPFin
    Tomcat --> JSPMarche
    Tomcat -->|serves| MainJS
    Tomcat --> ScriptsJS

    JSPIndex -->|includes JS/CSS| MainJS
    JSPlogin --> ScriptsJS

    JSPIndex -->|form submit| LoginServlet
    JSPReg --> RegServlet
    JSPFin --> Form1
    JSPMarche --> Form2

    LoginServlet -->|uses| DaoFactory
    RegServlet --> DaoFactory
    Form1 --> DaoFactory
    Form2 --> DaoFactory

    DaoFactory --> MarcheDAO
    DaoFactory --> FinDAO

    MarcheDAO --> MarcheDAOImpl
    FinDAO --> FinDAOImpl

    MarcheDAOImpl -->|JDBC| JDBCDriver
    FinDAOImpl --> JDBCDriver

    JDBCDriver -->|connects to| MySQL
    MySQL -->|schema| Schema

    LoginServlet -->|async| Email
    RegServlet --> Email

    PhpMyAdmin --> MySQL

    %% Click Events
    click AssetsAssets "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/src/main/webapp/assets/"
    click AssetsCSS "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/src/main/webapp/css/"
    click AssetsJS "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/src/main/webapp/js/"
    click AssetsFonts "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/src/main/webapp/fonts/"
    click AssetsImages "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/src/main/webapp/images/"
    click JSPIndex "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/index.jsp"
    click JSPlogin "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/login.jsp"
    click JSPReg "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/registration.jsp"
    click JSPFin "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/WEB-INF/etudeFinancier.jsp"
    click JSPMarche "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/WEB-INF/etudeMarche.jsp"
    click WebXML "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/WEB-INF/web.xml"
    click JDBCDriver "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/webapp/WEB-INF/lib/mysql-connector-j-9.1.0.jar"
    click LoginServlet "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/Login.java"
    click RegServlet "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/RegistrationServlet.java"
    click Form1 "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/form1.java"
    click Form2 "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/form2.java"
    click DomainMarche "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeMarche.java"
    click DomainFin "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeFinancier.java"
    click DaoFactory "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/DaoFactory.java"
    click MarcheDAO "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeMarcheDAO.java"
    click MarcheDAOImpl "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeMarcheDAOImpl.java"
    click FinDAO "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeFinancierDAO.java"
    click FinDAOImpl "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/src/main/java/projet_s3/EtudeFinancierDAOImpl.java"
    click Schema "https://github.com/ranyaserraj/urbaninvest-investment-platform/blob/main/sql/UrbanInvest.sql"
    click PhpMyAdmin "https://github.com/ranyaserraj/urbaninvest-investment-platform/tree/main/docs/"

    %% Styles
    classDef frontend fill:#abe0b4,stroke:#333,stroke-width:1px
    classDef server fill:#c2dfff,stroke:#333,stroke-width:1px
    classDef controller fill:#a3c4f3,stroke:#333,stroke-width:1px
    classDef business fill:#ffd8a8,stroke:#333,stroke-width:1px
    classDef database fill:#ffaaaa,stroke:#333,stroke-width:1px
    classDef external fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef config fill:#f0e68c,stroke:#333,stroke-width:1px
```
