# totodej/bobapp architecture

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

- Interactive diagram: https://gitdiagram.com/totodej/bobapp
- Repository: https://github.com/totodej/bobapp

## Overview

BobApp serves a random joke through an Angular frontend and a Spring backend. The UI requests a joke, the frontend service fetches the API response and publishes it, and the view presents the joke and response. The backend selects from joke records loaded from a JSON resource. The frontend-to-backend link is shown as unverified because no single cited file documents the cross-service connection; the README describes how to launch the applications but not their runtime interaction.

Main entry points: [`front/src/app/app.component.ts`](https://github.com/totodej/bobapp/blob/main/front/src/app/app.component.ts) (Joke UI), [`front/src/app/services/jokes.service.ts`](https://github.com/totodej/bobapp/blob/main/front/src/app/services/jokes.service.ts) (Jokes Service), [`back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java`](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java) (JSON Reader), [`front/src/main.ts`](https://github.com/totodej/bobapp/blob/main/front/src/main.ts) (Angular Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_app["Joke UI<br/>[app.component.ts]"]
  node_view["Joke View<br/>[app.component.html]"]
  node_frontend_joke["Joke Model<br/>[joke.model.ts]"]
  node_jokes_service["Jokes Service<br/>[jokes.service.ts]"]
end

subgraph group_api["Joke API"]
  node_api_controller["Joke Controller"]
  node_joke_service["Random Selection<br/>[JokeService.java]"]
end

subgraph group_content["Joke Data"]
  node_json_reader["JSON Reader<br/>[JsonReader.java]"]
  node_joke_model["Joke Model<br/>[Joke.java]"]
  node_jokes_data["Joke Records<br/>[jokes.json]"]
end

subgraph group_startup["Application Startup"]
  node_frontend_boot["Angular Bootstrap<br/>[main.ts]"]
  node_frontend_module["App Module<br/>[app.module.ts]"]
  node_frontend_environment["Frontend Environment<br/>[environment.ts]"]
  node_backend_boot["Spring Application"]
end

node_user(("User"))

node_user -.->|"uses"| node_app
node_app -->|"requests joke"| node_jokes_service
node_app -->|"renders"| node_view
node_jokes_service -->|"uses type"| node_frontend_joke
node_jokes_service -.->|"GET api/joke"| node_api_controller
node_api_controller -->|"gets random joke"| node_joke_service
node_joke_service -->|"reads jokes"| node_json_reader
node_json_reader -->|"loads records"| node_jokes_data
node_json_reader -->|"converts records"| node_joke_model
node_frontend_boot -->|"bootstraps"| node_frontend_module
node_frontend_boot -->|"reads mode"| node_frontend_environment
node_frontend_module -->|"declares"| node_app

click node_app "https://github.com/totodej/bobapp/blob/main/front/src/app/app.component.ts"
click node_view "https://github.com/totodej/bobapp/blob/main/front/src/app/app.component.html"
click node_frontend_joke "https://github.com/totodej/bobapp/blob/main/front/src/app/model/joke.model.ts"
click node_jokes_service "https://github.com/totodej/bobapp/blob/main/front/src/app/services/jokes.service.ts"
click node_api_controller "https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/controller/JokeController.java"
click node_joke_service "https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/service/JokeService.java"
click node_json_reader "https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java"
click node_joke_model "https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/model/Joke.java"
click node_jokes_data "https://github.com/totodej/bobapp/blob/main/back/src/main/resources/json/jokes.json"
click node_frontend_boot "https://github.com/totodej/bobapp/blob/main/front/src/main.ts"
click node_frontend_module "https://github.com/totodej/bobapp/blob/main/front/src/app/app.module.ts"
click node_frontend_environment "https://github.com/totodej/bobapp/blob/main/front/src/environments/environment.ts"
click node_backend_boot "https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/BobappApplication.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_app,node_view,node_frontend_joke,node_jokes_service,node_user toneBlue
class node_api_controller,node_joke_service toneAmber
class node_json_reader,node_joke_model,node_jokes_data toneMint
class node_frontend_boot,node_frontend_module,node_frontend_environment,node_backend_boot toneRose
```

## Components

### Frontend

- [Joke UI](https://github.com/totodej/bobapp/blob/main/front/src/app/app.component.ts): `front/src/app/app.component.ts`
- [Joke View](https://github.com/totodej/bobapp/blob/main/front/src/app/app.component.html): `front/src/app/app.component.html`
- [Joke Model](https://github.com/totodej/bobapp/blob/main/front/src/app/model/joke.model.ts): `front/src/app/model/joke.model.ts`
- [Jokes Service](https://github.com/totodej/bobapp/blob/main/front/src/app/services/jokes.service.ts): `front/src/app/services/jokes.service.ts`

### Joke API

- [Joke Controller](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/controller/JokeController.java): `back/src/main/java/com/openclassrooms/bobapp/controller/JokeController.java`
- [Random Selection](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/service/JokeService.java): `back/src/main/java/com/openclassrooms/bobapp/service/JokeService.java`

### Joke Data

- [JSON Reader](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java): `back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java`
- [Joke Model](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/model/Joke.java): `back/src/main/java/com/openclassrooms/bobapp/model/Joke.java`
- [Joke Records](https://github.com/totodej/bobapp/blob/main/back/src/main/resources/json/jokes.json): `back/src/main/resources/json/jokes.json`

### Application Startup

- [Angular Bootstrap](https://github.com/totodej/bobapp/blob/main/front/src/main.ts): `front/src/main.ts`
- [App Module](https://github.com/totodej/bobapp/blob/main/front/src/app/app.module.ts): `front/src/app/app.module.ts`
- [Frontend Environment](https://github.com/totodej/bobapp/blob/main/front/src/environments/environment.ts): `front/src/environments/environment.ts`
- [Spring Application](https://github.com/totodej/bobapp/blob/main/back/src/main/java/com/openclassrooms/bobapp/BobappApplication.java): `back/src/main/java/com/openclassrooms/bobapp/BobappApplication.java`

### Other components

- **User**

## Connections

- User → Joke UI: uses
- Joke UI → Jokes Service: requests joke (evidence: `front/src/app/app.component.ts`)
- Joke UI → Joke View: renders (evidence: `front/src/app/app.component.ts`)
- Jokes Service → Joke Model: uses type (evidence: `front/src/app/services/jokes.service.ts`)
- Jokes Service → Joke Controller: GET api/joke
- Joke Controller → Random Selection: gets random joke (evidence: `back/src/main/java/com/openclassrooms/bobapp/controller/JokeController.java`)
- Random Selection → JSON Reader: reads jokes (evidence: `back/src/main/java/com/openclassrooms/bobapp/service/JokeService.java`)
- JSON Reader → Joke Records: loads records (evidence: `back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java`)
- JSON Reader → Joke Model: converts records (evidence: `back/src/main/java/com/openclassrooms/bobapp/data/JsonReader.java`)
- Angular Bootstrap → App Module: bootstraps (evidence: `front/src/main.ts`)
- Angular Bootstrap → Frontend Environment: reads mode (evidence: `front/src/main.ts`)
- App Module → Joke UI: declares (evidence: `front/src/app/app.module.ts`)
