# lindawinther/secure-note architecture

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

- Interactive diagram: https://gitdiagram.com/lindawinther/secure-note
- Repository: https://github.com/lindawinther/secure-note

## Overview

This is a Java console secure-notes application. The user workflow starts at the console menu, registers or logs in, then creates, reads, edits, or deletes notes; account settings and admin note operations are also exposed. Authentication and note services enforce workflow and role checks before repositories access the SQL database. The excerpts show these calls directly; the README is empty, and relationships for the standalone BCrypt helper and Notes model are not established beyond the source index.

Main entry points: [`src/main/java/system/ui/ConsoleMenu.java`](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/ui/ConsoleMenu.java) (Console menu), [`src/main/java/system/repository/UserRespository.java`](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/UserRespository.java) (User repository), [`src/main/java/system/repository/NotesRepository.java`](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/NotesRepository.java) (Notes repository), [`src/main/java/system/config/DatabaseConnection.java`](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/config/DatabaseConnection.java) (Database connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Console interface"]
  node_main["Application entry<br/>[Main.java]"]
  node_menu["Console menu<br/>[ConsoleMenu.java]"]
end

subgraph group_domain["Account and notes"]
  node_auth["Authentication service<br/>[AuthService.java]"]
  node_noteservice["Note service<br/>[NoteService.java]"]
  node_user_model["User model<br/>[User.java]"]
  node_notes_model["Notes model<br/>[Notes.java]"]
end

subgraph group_persistence["SQL persistence"]
  node_userrepo["User repository"]
  node_notesrepo["Notes repository"]
  node_dbconfig["Database connection"]
  node_database[("SQL database")]
end

subgraph group_security["Password helpers"]
  node_encryptor["MD5 helper<br/>[Encryptor.java]"]
  node_bcrypt["BCrypt helper"]
end

node_user(("Console user"))

node_user -->|"uses"| node_menu
node_main -->|"starts"| node_menu
node_menu -->|"handles accounts"| node_auth
node_menu -->|"handles notes"| node_noteservice
node_menu -->|"hashes input"| node_encryptor
node_auth -->|"queries and updates"| node_userrepo
node_noteservice -->|"queries and updates"| node_notesrepo
node_userrepo -->|"opens connections"| node_dbconfig
node_notesrepo -->|"opens connections"| node_dbconfig
node_dbconfig -->|"connects via JDBC"| node_database
node_userrepo -->|"reads and writes users"| node_database
node_notesrepo -->|"reads and writes notes"| node_database

click node_main "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/Main.java"
click node_menu "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/ui/ConsoleMenu.java"
click node_auth "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/service/AuthService.java"
click node_noteservice "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/service/NoteService.java"
click node_user_model "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/model/User.java"
click node_notes_model "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/model/Notes.java"
click node_userrepo "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/UserRespository.java"
click node_notesrepo "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/NotesRepository.java"
click node_dbconfig "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/config/DatabaseConnection.java"
click node_encryptor "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/democode/Encryptor.java"
click node_bcrypt "https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/democode/EncryptorFinal.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_main,node_menu,node_user toneBlue
class node_auth,node_noteservice,node_user_model,node_notes_model toneAmber
class node_userrepo,node_notesrepo,node_dbconfig,node_database toneMint
class node_encryptor,node_bcrypt toneRose
```

## Components

### Console interface

- [Application entry](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/Main.java): `src/main/java/system/Main.java`
- [Console menu](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/ui/ConsoleMenu.java): `src/main/java/system/ui/ConsoleMenu.java`

### Account and notes

- [Authentication service](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/service/AuthService.java): `src/main/java/system/service/AuthService.java`
- [Note service](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/service/NoteService.java): `src/main/java/system/service/NoteService.java`
- [User model](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/model/User.java): `src/main/java/system/model/User.java`
- [Notes model](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/model/Notes.java): `src/main/java/system/model/Notes.java`

### SQL persistence

- [User repository](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/UserRespository.java): `src/main/java/system/repository/UserRespository.java`
- [Notes repository](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/repository/NotesRepository.java): `src/main/java/system/repository/NotesRepository.java`
- [Database connection](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/config/DatabaseConnection.java): `src/main/java/system/config/DatabaseConnection.java`
- **SQL database**

### Password helpers

- [MD5 helper](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/democode/Encryptor.java): `src/main/java/system/democode/Encryptor.java`
- [BCrypt helper](https://github.com/lindawinther/secure-note/blob/master/src/main/java/system/democode/EncryptorFinal.java): `src/main/java/system/democode/EncryptorFinal.java`

### Other components

- **Console user**

## Connections

- Console user → Console menu: uses (evidence: `src/main/java/system/ui/ConsoleMenu.java`)
- Application entry → Console menu: starts (evidence: `src/main/java/system/Main.java`)
- Console menu → Authentication service: handles accounts (evidence: `src/main/java/system/ui/ConsoleMenu.java`)
- Console menu → Note service: handles notes (evidence: `src/main/java/system/ui/ConsoleMenu.java`)
- Console menu → MD5 helper: hashes input (evidence: `src/main/java/system/ui/ConsoleMenu.java`)
- Authentication service → User repository: queries and updates (evidence: `src/main/java/system/service/AuthService.java`)
- Note service → Notes repository: queries and updates (evidence: `src/main/java/system/service/NoteService.java`)
- User repository → Database connection: opens connections (evidence: `src/main/java/system/repository/UserRespository.java`)
- Notes repository → Database connection: opens connections (evidence: `src/main/java/system/repository/NotesRepository.java`)
- Database connection → SQL database: connects via JDBC (evidence: `src/main/java/system/config/DatabaseConnection.java`)
- User repository → SQL database: reads and writes users (evidence: `src/main/java/system/repository/UserRespository.java`)
- Notes repository → SQL database: reads and writes notes (evidence: `src/main/java/system/repository/NotesRepository.java`)
