# jerryesperanza/singletonpattern architecture

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

- Interactive diagram: https://gitdiagram.com/jerryesperanza/singletonpattern
- Repository: https://github.com/jerryesperanza/singletonpattern

## Overview

This is a small Java singleton example. `UserApp.main` obtains the shared `Application` instance, then demonstrates login, a rejected second login, logout, and another login. `Application` owns the singleton instance and the logged-in user state, and its synchronized methods perform the state changes. The graph is limited to the two runtime files shown; no separate storage or external service is present.

Main entry points: [`UserApp.java`](https://github.com/jerryesperanza/singletonpattern/blob/main/UserApp.java) (Demo entry point), [`Application.java`](https://github.com/jerryesperanza/singletonpattern/blob/main/Application.java) (Singleton session)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user_app["Demo entry point<br/>[UserApp.java]"]
node_application["Singleton session<br/>[Application.java]"]

node_user_app -->|"gets instance"| node_application
node_user_app -->|"logs in"| node_application
node_user_app -->|"logs out"| node_application

click node_user_app "https://github.com/jerryesperanza/singletonpattern/blob/main/UserApp.java"
click node_application "https://github.com/jerryesperanza/singletonpattern/blob/main/Application.java"

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_user_app,node_application toneTeal
```

## Components

### Other components

- [Demo entry point](https://github.com/jerryesperanza/singletonpattern/blob/main/UserApp.java): `UserApp.java`
- [Singleton session](https://github.com/jerryesperanza/singletonpattern/blob/main/Application.java): `Application.java`

## Connections

- Demo entry point → Singleton session: gets instance (evidence: `UserApp.java`)
- Demo entry point → Singleton session: logs in (evidence: `UserApp.java`)
- Demo entry point → Singleton session: logs out (evidence: `UserApp.java`)
