# mufoysal/konoha-nots-web architecture

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

- Interactive diagram: https://gitdiagram.com/mufoysal/konoha-nots-web
- Repository: https://github.com/mufoysal/konoha-nots-web

## Overview

Konoha Notes is a Naruto-themed notes app with two visible runtime paths: a modular browser client backed by Firebase Auth and Firestore, and a PHP JSON API backed by SQL sessions and repositories. The main user journey is authentication, then private note creation and management, with profile and settings features alongside it. README capabilities include rich text, tags, pinning, search/filter/sort, account actions and profile statistics. Firebase client wiring and PHP routing are evidenced; other feature connections are included only where documented or indexed.

Main entry points: [`public/src/app/bootstrap/application.js`](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/app/bootstrap/application.js) (Client bootstrap), [`app/Controllers/AuthController.php`](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/AuthController.php) (PHP auth controller), [`app/Controllers/NoteController.php`](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/NoteController.php) (PHP notes controller), [`public/api.php`](https://github.com/mufoysal/konoha-nots-web/blob/main/public/api.php) (PHP route dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser application"]
  node_browser["Application UI<br/>[index.html]"]
  node_bootstrap["Client bootstrap<br/>[application.js]"]
  node_firebase_services["Firebase services<br/>[firebase.js]"]
end

subgraph group_auth["Authentication"]
  node_firebase_auth["Firebase Authentication"]
  node_auth_controller["Auth controller<br/>[auth-controller.js]"]
  node_auth_usecases["Auth use cases<br/>[auth-use-cases.js]"]
  node_auth_repository["Auth repository"]
  node_auth_source["Firebase auth source"]
end

subgraph group_notes["Notes and profile"]
  node_notes_controller["Notes controller"]
  node_note_usecases["Note use cases<br/>[note-use-cases.js]"]
  node_note_filter["Filter and sort"]
  node_note_entity["Note model<br/>[note.js]"]
  node_notes_repository["Notes repository"]
  node_notes_source["Firestore notes source"]
  node_firestore[("Cloud Firestore")]
  node_sanitize["Note HTML sanitizer"]
  node_profile_stats["Profile statistics"]
end

subgraph group_settings["Account settings"]
  node_settings_controller["Settings controller"]
  node_settings_usecases["Settings use cases"]
  node_settings_repository["Settings repository"]
  node_settings_source["Firebase settings source"]
end

subgraph group_php["PHP API"]
  node_php_api["PHP route dispatcher<br/>[api.php]"]
  node_auth_php["PHP auth controller<br/>[AuthController.php]"]
  node_notes_php["PHP notes controller<br/>[NoteController.php]"]
  node_user_repo["User repository<br/>[UserRepository.php]"]
  node_note_repo["SQL notes repository<br/>[NoteRepository.php]"]
  node_sql_db[("SQL database<br/>[Database.php]")]
  node_session["Session and CSRF<br/>[Session.php]"]
  node_http["HTTP JSON helpers<br/>[Http.php]"]
  node_html_sanitizer["Server HTML sanitizer<br/>[HtmlSanitizer.php]"]
  node_mailer["Verification mailer<br/>[Mailer.php]"]
end

node_user(("Visitor / user"))
node_google["Google OAuth"]

node_user -->|"uses"| node_browser
node_browser -->|"loads"| node_bootstrap
node_bootstrap -->|"initializes"| node_firebase_services
node_firebase_services -->|"configures"| node_firebase_auth
node_bootstrap -->|"constructs"| node_auth_controller
node_auth_controller -->|"delegates"| node_auth_usecases
node_auth_usecases -.->|"calls"| node_auth_repository
node_auth_repository -->|"delegates"| node_auth_source
node_auth_source -.->|"uses"| node_firebase_auth
node_bootstrap -->|"constructs"| node_notes_controller
node_notes_controller -->|"calls"| node_note_usecases
node_note_usecases -.->|"delegates"| node_notes_repository
node_notes_repository -->|"delegates"| node_notes_source
node_notes_source -.->|"reads/writes"| node_firestore
node_notes_source -->|"uses"| node_note_entity
node_bootstrap -->|"sanitizes"| node_sanitize
node_bootstrap -->|"calculates"| node_profile_stats
node_bootstrap -->|"filters/sorts"| node_note_filter
node_bootstrap -->|"constructs"| node_settings_controller
node_settings_controller -->|"calls"| node_settings_usecases
node_settings_usecases -.->|"delegates"| node_settings_repository
node_settings_repository -->|"delegates"| node_settings_source
node_settings_source -.->|"accesses"| node_firestore
node_user -.->|"requests"| node_php_api
node_php_api -->|"routes"| node_auth_php
node_php_api -->|"routes"| node_notes_php
node_php_api -->|"starts"| node_session
node_php_api -->|"connects"| node_sql_db
node_auth_php -->|"queries"| node_user_repo
node_auth_php -->|"authenticates"| node_session
node_auth_php -->|"sends verification"| node_mailer
node_auth_php -->|"exchanges OAuth"| node_google
node_auth_php -->|"responds via"| node_http
node_notes_php -->|"loads user"| node_user_repo
node_notes_php -->|"manages notes"| node_note_repo
node_notes_php -->|"checks session"| node_session
node_notes_php -->|"reads/responds"| node_http
node_notes_php -->|"sanitizes"| node_html_sanitizer
node_note_repo -.->|"queries"| node_sql_db
node_user_repo -.->|"queries"| node_sql_db

click node_browser "https://github.com/mufoysal/konoha-nots-web/blob/main/public/index.html"
click node_bootstrap "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/app/bootstrap/application.js"
click node_firebase_services "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/core/services/firebase.js"
click node_auth_controller "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/presentation/controllers/auth-controller.js"
click node_auth_usecases "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/domain/usecases/auth-use-cases.js"
click node_auth_repository "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/data/repositories/firebase-auth-repository.js"
click node_auth_source "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/data/datasources/firebase-auth-data-source.js"
click node_notes_controller "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/presentation/controllers/notes-controller.js"
click node_note_usecases "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/usecases/note-use-cases.js"
click node_note_filter "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/usecases/filter-and-sort-notes.js"
click node_note_entity "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/entities/note.js"
click node_notes_repository "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/data/repositories/firestore-notes-repository.js"
click node_notes_source "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/data/datasources/firestore-notes-data-source.js"
click node_sanitize "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/core/utils/sanitize-note-html.js"
click node_profile_stats "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/profile/domain/usecases/calculate-profile-statistics.js"
click node_settings_controller "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/presentation/controllers/settings-controller.js"
click node_settings_usecases "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/domain/usecases/settings-use-cases.js"
click node_settings_repository "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/data/repositories/firebase-settings-repository.js"
click node_settings_source "https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/data/datasources/firebase-settings-data-source.js"
click node_php_api "https://github.com/mufoysal/konoha-nots-web/blob/main/public/api.php"
click node_auth_php "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/AuthController.php"
click node_notes_php "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/NoteController.php"
click node_user_repo "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Repositories/UserRepository.php"
click node_note_repo "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Repositories/NoteRepository.php"
click node_sql_db "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Database.php"
click node_session "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Session.php"
click node_http "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Http.php"
click node_html_sanitizer "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Services/HtmlSanitizer.php"
click node_mailer "https://github.com/mufoysal/konoha-nots-web/blob/main/app/Services/Mailer.php"

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_browser,node_bootstrap,node_firebase_services,node_user toneBlue
class node_firebase_auth,node_auth_controller,node_auth_usecases,node_auth_repository,node_auth_source toneAmber
class node_notes_controller,node_note_usecases,node_note_filter,node_note_entity,node_notes_repository,node_notes_source,node_firestore,node_sanitize,node_profile_stats toneMint
class node_settings_controller,node_settings_usecases,node_settings_repository,node_settings_source toneRose
class node_php_api,node_auth_php,node_notes_php,node_user_repo,node_note_repo,node_sql_db,node_session,node_http,node_html_sanitizer,node_mailer,node_google toneIndigo
```

## Components

### Browser application

- [Application UI](https://github.com/mufoysal/konoha-nots-web/blob/main/public/index.html): `public/index.html`
- [Client bootstrap](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/app/bootstrap/application.js): `public/src/app/bootstrap/application.js`
- [Firebase services](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/core/services/firebase.js): `public/src/core/services/firebase.js`

### Authentication

- **Firebase Authentication**
- [Auth controller](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/presentation/controllers/auth-controller.js): `public/src/features/auth/presentation/controllers/auth-controller.js`
- [Auth use cases](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/domain/usecases/auth-use-cases.js): `public/src/features/auth/domain/usecases/auth-use-cases.js`
- [Auth repository](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/data/repositories/firebase-auth-repository.js): `public/src/features/auth/data/repositories/firebase-auth-repository.js`
- [Firebase auth source](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/auth/data/datasources/firebase-auth-data-source.js): `public/src/features/auth/data/datasources/firebase-auth-data-source.js`

### Notes and profile

- [Notes controller](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/presentation/controllers/notes-controller.js): `public/src/features/notes/presentation/controllers/notes-controller.js`
- [Note use cases](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/usecases/note-use-cases.js): `public/src/features/notes/domain/usecases/note-use-cases.js`
- [Filter and sort](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/usecases/filter-and-sort-notes.js): `public/src/features/notes/domain/usecases/filter-and-sort-notes.js`
- [Note model](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/domain/entities/note.js): `public/src/features/notes/domain/entities/note.js`
- [Notes repository](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/data/repositories/firestore-notes-repository.js): `public/src/features/notes/data/repositories/firestore-notes-repository.js`
- [Firestore notes source](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/notes/data/datasources/firestore-notes-data-source.js): `public/src/features/notes/data/datasources/firestore-notes-data-source.js`
- **Cloud Firestore**
- [Note HTML sanitizer](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/core/utils/sanitize-note-html.js): `public/src/core/utils/sanitize-note-html.js`
- [Profile statistics](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/profile/domain/usecases/calculate-profile-statistics.js): `public/src/features/profile/domain/usecases/calculate-profile-statistics.js`

### Account settings

- [Settings controller](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/presentation/controllers/settings-controller.js): `public/src/features/settings/presentation/controllers/settings-controller.js`
- [Settings use cases](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/domain/usecases/settings-use-cases.js): `public/src/features/settings/domain/usecases/settings-use-cases.js`
- [Settings repository](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/data/repositories/firebase-settings-repository.js): `public/src/features/settings/data/repositories/firebase-settings-repository.js`
- [Firebase settings source](https://github.com/mufoysal/konoha-nots-web/blob/main/public/src/features/settings/data/datasources/firebase-settings-data-source.js): `public/src/features/settings/data/datasources/firebase-settings-data-source.js`

### PHP API

- [PHP route dispatcher](https://github.com/mufoysal/konoha-nots-web/blob/main/public/api.php): `public/api.php`
- [PHP auth controller](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/AuthController.php): `app/Controllers/AuthController.php`
- [PHP notes controller](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Controllers/NoteController.php): `app/Controllers/NoteController.php`
- [User repository](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Repositories/UserRepository.php): `app/Repositories/UserRepository.php`
- [SQL notes repository](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Repositories/NoteRepository.php): `app/Repositories/NoteRepository.php`
- [SQL database](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Database.php): `app/Core/Database.php`
- [Session and CSRF](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Session.php): `app/Core/Session.php`
- [HTTP JSON helpers](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Core/Http.php): `app/Core/Http.php`
- [Server HTML sanitizer](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Services/HtmlSanitizer.php): `app/Services/HtmlSanitizer.php`
- [Verification mailer](https://github.com/mufoysal/konoha-nots-web/blob/main/app/Services/Mailer.php): `app/Services/Mailer.php`

### Other components

- **Visitor / user**
- **Google OAuth**

## Connections

- Visitor / user → Application UI: uses (evidence: `README.md`)
- Application UI → Client bootstrap: loads (evidence: `README.md`)
- Client bootstrap → Firebase services: initializes (evidence: `public/src/app/bootstrap/application.js`)
- Firebase services → Firebase Authentication: configures (evidence: `public/src/core/services/firebase.js`)
- Client bootstrap → Auth controller: constructs (evidence: `public/src/app/bootstrap/application.js`)
- Auth controller → Auth use cases: delegates (evidence: `public/src/features/auth/presentation/controllers/auth-controller.js`)
- Auth use cases → Auth repository: calls
- Auth repository → Firebase auth source: delegates (evidence: `public/src/features/auth/data/repositories/firebase-auth-repository.js`)
- Firebase auth source → Firebase Authentication: uses
- Client bootstrap → Notes controller: constructs (evidence: `public/src/app/bootstrap/application.js`)
- Notes controller → Note use cases: calls (evidence: `public/src/features/notes/presentation/controllers/notes-controller.js`)
- Note use cases → Notes repository: delegates
- Notes repository → Firestore notes source: delegates (evidence: `public/src/features/notes/data/repositories/firestore-notes-repository.js`)
- Firestore notes source → Cloud Firestore: reads/writes
- Firestore notes source → Note model: uses (evidence: `public/src/features/notes/data/datasources/firestore-notes-data-source.js`)
- Client bootstrap → Note HTML sanitizer: sanitizes (evidence: `public/src/app/bootstrap/application.js`)
- Client bootstrap → Profile statistics: calculates (evidence: `public/src/app/bootstrap/application.js`)
- Client bootstrap → Filter and sort: filters/sorts (evidence: `public/src/app/bootstrap/application.js`)
- Client bootstrap → Settings controller: constructs (evidence: `public/src/app/bootstrap/application.js`)
- Settings controller → Settings use cases: calls (evidence: `public/src/features/settings/presentation/controllers/settings-controller.js`)
- Settings use cases → Settings repository: delegates
- Settings repository → Firebase settings source: delegates (evidence: `public/src/features/settings/data/repositories/firebase-settings-repository.js`)
- Firebase settings source → Cloud Firestore: accesses
- Visitor / user → PHP route dispatcher: requests
- PHP route dispatcher → PHP auth controller: routes (evidence: `public/api.php`)
- PHP route dispatcher → PHP notes controller: routes (evidence: `public/api.php`)
- PHP route dispatcher → Session and CSRF: starts (evidence: `public/api.php`)
- PHP route dispatcher → SQL database: connects (evidence: `public/api.php`)
- PHP auth controller → User repository: queries (evidence: `app/Controllers/AuthController.php`)
- PHP auth controller → Session and CSRF: authenticates (evidence: `app/Controllers/AuthController.php`)
- PHP auth controller → Verification mailer: sends verification (evidence: `app/Controllers/AuthController.php`)
- PHP auth controller → Google OAuth: exchanges OAuth (evidence: `app/Controllers/AuthController.php`)
- PHP auth controller → HTTP JSON helpers: responds via (evidence: `app/Controllers/AuthController.php`)
- PHP notes controller → User repository: loads user (evidence: `app/Controllers/NoteController.php`)
- PHP notes controller → SQL notes repository: manages notes (evidence: `app/Controllers/NoteController.php`)
- PHP notes controller → Session and CSRF: checks session (evidence: `app/Controllers/NoteController.php`)
- PHP notes controller → HTTP JSON helpers: reads/responds (evidence: `app/Controllers/NoteController.php`)
- PHP notes controller → Server HTML sanitizer: sanitizes (evidence: `app/Controllers/NoteController.php`)
- SQL notes repository → SQL database: queries
- User repository → SQL database: queries
