# githubtraining/guided-prompt-engineering-junior architecture

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

- Interactive diagram: https://gitdiagram.com/githubtraining/guided-prompt-engineering-junior
- Repository: https://github.com/githubtraining/guided-prompt-engineering-junior

## Overview

#### Purpose and Runtime
This is a small server-rendered habit-tracking web application used as a Copilot-guided learning project. Users create habits, mark daily completions, and review a habit’s progress. The Python application entry point is `app.py`; dependencies are declared in `requirements.txt`.

#### Application Boundary
`app.py` is the central application layer. It likely owns web routes, request handling, persistence operations, and template rendering rather than separating these into service modules. The browser interacts through HTML forms and page navigation; no separate frontend API or client application is present.

#### Habit Management Flow
The main dashboard is rendered from `templates/index.html`. Its control flow is expected to:
1. Load stored habits from the local database.
2. Display habit summaries and creation controls.
3. Submit user actions back to routes in `app.py` for creating habits or recording completion.

This makes the application server the authority for habit state and completion history.

#### Habit Detail and Progress
`templates/habit_detail.html` is the per-habit view. It forms the boundary for inspecting an individual habit and its check-in history, including any future streak, badge, motivational-message, sharing, or graph enhancements suggested by the project instructions. Requests for a specific habit are routed through `app.py`, which loads the relevant persisted data and renders this template.

#### Persistence
The application uses a local SQLite database at `instance/habits.db`. The `instance/` location indicates environment-specific mutable state, separate from source templates and static assets. The Python server in `app.py` is responsible for translating habit and check-in operations into database reads/writes. This is a single-instance, filesystem-backed persistence model rather than an external managed database.

#### Presentation Layer
Server-rendered templates live under `templates/`, with shared visual styling in `static/css/style.css`. Browser-side behavior, if any, is embedded in templates or delivered as static assets; the tree contains no standalone JavaScript bundle. Styling changes, including the README’s suggested themed UI work, are concentrated in `static/css/style.css` and the two page templates.

#### Development Infrastructure
The project is designed to run in GitHub Codespaces/dev containers. `.devcontainer/devcontainer.json` and `.devcontainer/Dockerfile` define the development runtime, while `.devcontainer/scripts/update_dates.py` supports the workspace setup or date-related maintenance. GitHub Copilot is an intended development aid, not an application runtime dependency.

Main entry points: [`app.py`](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/app.py) (Habit web server), [`.devcontainer/devcontainer.json`](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/devcontainer.json) (Dev container config), [`templates/index.html`](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/index.html) (Habit dashboard), [`templates/habit_detail.html`](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/habit_detail.html) (Habit detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Browser presentation"]
  node_browser(("User browser"))
  node_dashboard["Habit dashboard<br/>server template<br/>[index.html]"]
  node_detail["Habit detail<br/>server template<br/>[habit_detail.html]"]
  node_styles["Shared styles<br/>stylesheet<br/>[style.css]"]
end

subgraph group_application["Application"]
  node_server["Habit web server<br/>Python application<br/>[app.py]"]
  node_dependencies["Python dependencies<br/>dependency manifest<br/>[requirements.txt]"]
end

subgraph group_persistence["Local persistence"]
  node_sqlite[("Habits database<br/>SQLite database<br/>[habits.db]")]
end

subgraph group_development["Development environment"]
  node_devcontainer["Dev container config<br/>development config<br/>[devcontainer.json]"]
  node_dockerfile["Development image<br/>Dockerfile<br/>[Dockerfile]"]
  node_date_script["Date maintenance script<br/>Python script<br/>[update_dates.py]"]
end

node_browser -->|"HTTP requests and form posts"| node_server
node_server -->|"renders dashboard"| node_dashboard
node_server -->|"renders habit view"| node_detail
node_dashboard -->|"uses"| node_styles
node_detail -->|"uses"| node_styles
node_server -->|"reads and writes habits/check-ins"| node_sqlite
node_dependencies -.->|"provides runtime packages"| node_server
node_devcontainer -->|"builds development runtime"| node_dockerfile
node_devcontainer -.->|"runs or supports setup"| node_date_script

click node_dashboard "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/index.html"
click node_detail "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/habit_detail.html"
click node_styles "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/static/css/style.css"
click node_server "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/app.py"
click node_sqlite "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/instance/habits.db"
click node_devcontainer "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/devcontainer.json"
click node_dockerfile "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/Dockerfile"
click node_date_script "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/scripts/update_dates.py"
click node_dependencies "https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/requirements.txt"

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_dashboard,node_detail,node_styles toneBlue
class node_server,node_dependencies toneAmber
class node_sqlite toneMint
class node_devcontainer,node_dockerfile,node_date_script toneRose
```

## Components

### Browser presentation

- **User browser**: browser · Uses page navigation and HTML forms.
- [Habit dashboard](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/index.html): server template · Lists habits and provides creation and completion controls. · `templates/index.html`
- [Habit detail](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/templates/habit_detail.html): server template · Shows one habit and its check-in history. · `templates/habit_detail.html`
- [Shared styles](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/static/css/style.css): stylesheet · `static/css/style.css`

### Application

- [Habit web server](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/app.py): Python application · Owns routes, form handling, rendering, and database operations. · `app.py`
- [Python dependencies](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/requirements.txt): dependency manifest · `requirements.txt`

### Local persistence

- [Habits database](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/instance/habits.db): SQLite database · Stores habits and completion history as local mutable state. · `instance/habits.db`

### Development environment

- [Dev container config](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/devcontainer.json): development config · `.devcontainer/devcontainer.json`
- [Development image](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/Dockerfile): Dockerfile · `.devcontainer/Dockerfile`
- [Date maintenance script](https://github.com/githubtraining/guided-prompt-engineering-junior/blob/main/.devcontainer/scripts/update_dates.py): Python script · Supports workspace setup or date-related maintenance. · `.devcontainer/scripts/update_dates.py`

## Connections

- User browser → Habit web server: HTTP requests and form posts
- Habit web server → Habit dashboard: renders dashboard
- Habit web server → Habit detail: renders habit view
- Habit dashboard → Shared styles: uses
- Habit detail → Shared styles: uses
- Habit web server → Habits database: reads and writes habits/check-ins
- Python dependencies → Habit web server: provides runtime packages
- Dev container config → Development image: builds development runtime
- Dev container config → Date maintenance script: runs or supports setup
