# ayushd64/my_address_book architecture

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

- Interactive diagram: https://gitdiagram.com/ayushd64/my_address_book
- Repository: https://github.com/ayushd64/my_address_book

## Overview

1. **Project type and runtime**
   - This is a **Java desktop application** built with **Swing** and run as a standalone JVM app.
   - There is no server tier or web frontend; the UI, control flow, and database access live in the same client application.

2. **Repository layout**
   - The real application source is under `address_book/src/address_book`.
   - `bin/address_book` contains compiled output.
   - The repo also includes IDE/workspace metadata (`.metadata`) and bundled libraries/images, which affect local development and runtime packaging but not the core domain model.

3. **Entry point and startup flow**
   - `BBB.java` is the main entry class.
   - It appears to show a **splash screen** first, then transitions into the login screen.
   - The app’s startup sequence is therefore: launch JVM → splash screen → login window → main application window on successful authentication.

4. **Authentication subsystem**
   - `menu.java` implements the **login screen**.
   - Credentials are checked against the MySQL `log_in` table.
   - The app supports updating credentials through `log.java`, so login data is persisted in the same database rather than external config.

5. **Main contact-management subsystem**
   - `mainwindow.java` is the central working screen for the address book.
   - It is responsible for displaying contacts and coordinating actions like search, edit, delete, and opening create/update dialogs.
   - This is the primary navigation hub after login.

6. **Contact creation and editing**
   - `nw.java` is the **new contact** window.
   - `edit.java` is the **edit contact** window.
   - These are separate UI flows, likely opened from the main window as modal or secondary forms, and they write changes back to the `info` table.

7. **Login settings/update flow**
   - `log.java` handles updating the username and password.
   - This is a separate administrative form, but it uses the same persistence layer as the login screen.
   - The README indicates passwords are entered in masked form, which is a UI concern handled here.

8. **Persistence and data model**
   - The application uses **JDBC** with the MySQL Connector library bundled in `address_book/lib`.
   - The database is named `address_book` and has two tables:
     - `info` for contact records
     - `log_in` for authentication credentials
   - Contact fields include name, age, phone/mobile, gender, address, email, DOB, and created date/time.

9. **Data flow across the app**
   - User actions in Swing forms trigger JDBC calls directly to MySQL.
   - Login reads from `log_in`.
   - Contact CRUD screens read/write `info`.
   - Search in the main window filters the contact list against the stored contact data.
   - There is no evidence of an intermediate service layer or ORM; the architecture is a thin UI-over-database design.

10. **UI assets and presentation**
   - `ab.jpg` and `olpa.jpg` are runtime image assets used for the splash and login screens.
   - The app depends on these files being present in `src/address_book`, so presentation assets are part of the application package boundary.

11. **External dependency boundary**
   - The only material external service is **MySQL Server**.
   - The app expects a running local/remote MySQL instance with the correct schema and credentials configured in code.
   - The bundled connector JAR is required to bridge Swing/JVM code to the database.

12. **Operational characteristics**
   - The app is stateful through the database, not through local files.
   - The UI appears to be mostly form-based, with each major action mapped to a dedicated screen or dialog.
   - Validation and error handling are part of the UI layer, but persistence failures still depend on the database being reachable.

13. **Architecture summary for diagramming**
   - A good diagram would show:
     - **User** interacting with multiple **Swing windows**
     - `BBB` as the launcher/splash coordinator
     - `menu` as authentication gate
     - `mainwindow` as the main contact hub
     - `nw`, `edit`, and `log` as supporting dialogs
     - all of them connecting directly via **JDBC** to a **MySQL `address_book` database**
     - shared assets (`ab.jpg`, `olpa.jpg`) feeding the presentation layer

Main entry points: [`address_book/src/address_book/mainwindow.java`](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/mainwindow.java) (Main window), [`address_book/src/address_book/menu.java`](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/menu.java) (Login), [`address_book/lib/mysql-connector-java-5.1.38-bin.jar`](https://github.com/ayushd64/my_address_book/blob/main/address_book/lib/mysql-connector-java-5.1.38-bin.jar) (JDBC), [`address_book/src/address_book/BBB.java`](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/BBB.java) (BBB)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Swing app"]
  node_bbb["BBB<br/>launcher/splash<br/>[BBB.java]"]
  node_menu["Login<br/>auth window<br/>[menu.java]"]
  node_mainwindow["Main window<br/>contact hub<br/>[mainwindow.java]"]
  node_nw["New contact<br/>contact form<br/>[nw.java]"]
  node_edit["Edit contact<br/>contact form<br/>[edit.java]"]
  node_log["Credentials<br/>settings form<br/>[log.java]"]
end

subgraph group_data["Persistence"]
  node_jdbc{{"JDBC<br/>database bridge"}}
  node_mysql[("MySQL<br/>external db")]
  node_db_address_book[("address_book db<br/>schema")]
  node_info[("info table<br/>contacts table")]
  node_login_table[("log_in table<br/>auth table")]
  node_contact_model["Contact data<br/>record model"]
end

subgraph group_assets["Runtime assets"]
  node_splash_img["Splash art<br/>image asset"]
  node_login_img["Login art<br/>image asset"]
end

node_user(("User<br/>actor"))

node_user -->|"launches"| node_bbb
node_bbb -->|"shows"| node_splash_img
node_bbb -->|"opens"| node_menu
node_menu -->|"uses"| node_login_img
node_menu -->|"queries"| node_jdbc
node_menu -->|"reads"| node_login_table
node_menu -->|"auth success"| node_mainwindow
node_mainwindow -->|"opens"| node_nw
node_mainwindow -->|"opens"| node_edit
node_mainwindow -->|"opens"| node_log
node_mainwindow -->|"reads/writes"| node_info
node_nw -->|"writes"| node_jdbc
node_edit -->|"updates"| node_jdbc
node_log -->|"updates"| node_jdbc
node_jdbc -->|"connects"| node_mysql
node_mysql -->|"hosts"| node_db_address_book
node_db_address_book -->|"contains"| node_info
node_db_address_book -->|"contains"| node_login_table
node_mainwindow -.->|"maps to"| node_contact_model
node_nw -.->|"creates"| node_contact_model
node_edit -.->|"modifies"| node_contact_model

click node_bbb "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/BBB.java"
click node_menu "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/menu.java"
click node_mainwindow "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/mainwindow.java"
click node_nw "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/nw.java"
click node_edit "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/edit.java"
click node_log "https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/log.java"
click node_jdbc "https://github.com/ayushd64/my_address_book/blob/main/address_book/lib/mysql-connector-java-5.1.38-bin.jar"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bbb,node_menu,node_mainwindow,node_nw,node_edit,node_log toneBlue
class node_jdbc,node_mysql,node_db_address_book,node_info,node_login_table,node_contact_model toneAmber
class node_splash_img,node_login_img toneMint
class node_user toneNeutral
```

## Components

### Swing app

Desktop windows and startup flow

- [BBB](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/BBB.java): launcher/splash · Main entry point; shows splash and starts the app · `address_book/src/address_book/BBB.java`
- [Login](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/menu.java): auth window · Login screen that validates credentials · `address_book/src/address_book/menu.java`
- [Main window](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/mainwindow.java): contact hub · Primary address book screen for browse, search, edit, delete · `address_book/src/address_book/mainwindow.java`
- [New contact](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/nw.java): contact form · Creates contact records · `address_book/src/address_book/nw.java`
- [Edit contact](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/edit.java): contact form · Updates existing contact records · `address_book/src/address_book/edit.java`
- [Credentials](https://github.com/ayushd64/my_address_book/blob/main/address_book/src/address_book/log.java): settings form · Updates login username and password · `address_book/src/address_book/log.java`

### Persistence

JDBC access and MySQL tables

- [JDBC](https://github.com/ayushd64/my_address_book/blob/main/address_book/lib/mysql-connector-java-5.1.38-bin.jar): database bridge · Direct SQL access from Swing to MySQL · `address_book/lib/mysql-connector-java-5.1.38-bin.jar`
- **MySQL**: external db · Runtime database server
- **address_book db**: schema · Application database
- **info table**: contacts table · Stores contact records
- **log_in table**: auth table · Stores login credentials
- **Contact data**: record model · Name, age, phone, gender, address, email, DOB, timestamps

### Runtime assets

Bundled images and connector library

- **Splash art**: image asset · Splash-screen image resource
- **Login art**: image asset · Login-screen image resource

### Other components

- **User**: actor · Operates the desktop app

## Connections

- User → BBB: launches · Starts the desktop application
- BBB → Splash art: shows · Displays splash artwork
- BBB → Login: opens · Transitions from splash to login
- Login → Login art: uses · Renders login presentation assets
- Login → JDBC: queries · Checks credentials through JDBC
- Login → log_in table: reads · Validates against stored login rows
- Login → Main window: auth success · Enters main app after successful login
- Main window → New contact: opens · Starts new-contact flow
- Main window → Edit contact: opens · Starts contact-edit flow
- Main window → Credentials: opens · Starts credential-update flow
- Main window → info table: reads/writes · Loads, searches, updates, and deletes contacts
- New contact → JDBC: writes · Persists new contact rows
- Edit contact → JDBC: updates · Persists edited contact rows
- Credentials → JDBC: updates · Persists login credential changes
- JDBC → MySQL: connects · Uses bundled MySQL connector to reach server
- MySQL → address_book db: hosts · Provides the application schema
- address_book db → info table: contains · Contact records table
- address_book db → log_in table: contains · Authentication table
- Main window → Contact data: maps to · Displays and edits contact fields
- New contact → Contact data: creates · Builds new contact records
- Edit contact → Contact data: modifies · Changes contact records
