# beardlesshack/cs50-final-namesprouts architecture

> Architecture diagram of the GitHub repository beardlesshack/cs50-final-namesprouts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/beardlesshack/cs50-final-namesprouts
- Repository: https://github.com/beardlesshack/cs50-final-namesprouts

## Overview

1. **Overall shape**
   - This is a small monolithic Flask application for generating and saving personalized flower artwork.
   - The repo is split into one Python backend, Jinja templates for pages, and static assets for the browser-side design experience.

2. **Core runtime**
   - `final/app.py` is the application entry point and central orchestration layer.
   - It likely owns routing, session handling, form processing, database access, and error handlers.
   - The app uses SQLite via `final/namesprouts.db`, so persistence is local and embedded rather than service-based.

3. **Primary user flow**
   - The main flow is: register or log in, open the design page, enter a name and birth month, preview the generated flower, then save or edit the project.
   - The design experience is centered on turning a submitted name into a vertical “stem” that visually connects to a month-specific flower image.

4. **Authentication boundary**
   - `login.html` and `register.html` indicate a standard username/password account system.
   - User identity is used to isolate saved projects, so authentication is a boundary between anonymous browsing and project ownership.
   - Session state is almost certainly used to remember the active user across requests.

5. **Design subsystem**
   - `templates/design.html` is the main interactive canvas page.
   - It combines name input, month selection, preview rendering, and save actions.
   - The design experience is intentionally browser-driven, with the page updating without a full reload.

6. **Client-side preview logic**
   - `final/static/js/design.js` handles live preview behavior.
   - Its job is to sanitize input, create one visual element per letter, and update the flower image based on the selected birth month.
   - This keeps the visual composition responsive while the backend remains responsible for persistence and account logic.

7. **Visual presentation layer**
   - `final/static/styles/styles.css` provides the shared site styling, while the design page also appears to use some inline CSS for the stem layout.
   - `final/static/flowers`, `final/static/images`, and `final/static/fonts` hold the media used to assemble the final artwork.
   - The visual system depends on CSS layout direction and typography to make the name read like a continuous stem.

8. **Project management pages**
   - `my_projects.html` and `edit_projects.html` suggest a CRUD-style workflow for saved compositions.
   - Users can likely list saved works, open one for editing, and then resave it.
   - This is the persistence-facing part of the app, distinct from the live preview experience.

9. **Shared template structure**
   - `layout.html` is the base template and `nav.html` is a reusable navigation partial.
   - Pages such as `index.html`, `about.html`, `payments.html`, and the auth/design pages extend the shared layout to keep the site consistent.
   - The app also includes `404.html` and `505.html`, so error handling is part of the presentation boundary.

10. **Data model implied by the repo**
   - The SQLite database likely stores users plus saved flower projects tied to those users.
   - A project record probably includes the name, birth month, and whatever identifiers are needed to recreate the preview state.
   - The design itself is not stored as a raster image in the repo; it is generated from stored inputs and static assets.

11. **External or non-core concerns**
   - `payments.html` exists, but the README frames payments as a future improvement rather than a fully integrated subsystem.
   - So payments should be treated as a placeholder or planned boundary, not a mature integration.
   - There are no obvious external APIs or cloud services in the repository structure.

12. **Architecture summary for a diagram**
   - Think of this repo as a three-tier app: browser UI, Flask application logic, and SQLite storage.
   - The browser handles live flower composition; Flask handles identity, routing, and CRUD; SQLite holds users and projects.
   - Static flower artwork and fonts are the key assets that make the generated stem-and-bloom composition possible.

Main entry points: [`final/app.py`](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/app.py) (Flask app), [`final/templates/design.html`](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/design.html) (Design page), [`final/templates/layout.html`](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/layout.html) (Base layout), [`final/static/js/design.js`](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/static/js/design.js) (Preview JS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Flask backend"]
  node_app["Flask app<br/>entrypoint<br/>[app.py]"]
end

subgraph group_templates["Templates"]
  node_layout["Base layout<br/>template<br/>[layout.html]"]
  node_nav["Navigation<br/>partial<br/>[nav.html]"]
  node_public_pages["Public pages<br/>template set"]
  node_auth_pages["Auth pages<br/>template set"]
  node_design_page["Design page<br/>interactive template<br/>[design.html]"]
  node_projects_pages["Projects pages<br/>template set"]
  node_error_pages["Error pages<br/>template set"]
end

subgraph group_static["Static assets"]
  node_design_js["Preview JS<br/>client script<br/>[design.js]"]
  node_styles["Site styles<br/>css<br/>[styles.css]"]
  node_flowers["Flower art<br/>image assets"]
  node_images["Images<br/>media assets"]
  node_fonts["Fonts<br/>font assets"]
end

subgraph group_storage["Storage"]
  node_db[("SQLite DB<br/>database<br/>[namesprouts.db]")]
end

node_app -->|"renders"| node_layout
node_app -->|"includes"| node_nav
node_app -->|"serves"| node_public_pages
node_app -->|"serves"| node_auth_pages
node_app -->|"serves"| node_design_page
node_app -->|"serves"| node_projects_pages
node_app -->|"errors"| node_error_pages
node_app -->|"reads/writes"| node_db
node_public_pages -->|"extends"| node_layout
node_auth_pages -->|"extends"| node_layout
node_design_page -->|"extends"| node_layout
node_projects_pages -->|"extends"| node_layout
node_error_pages -->|"extends"| node_layout
node_design_page -->|"drives"| node_design_js
node_design_page -->|"styled by"| node_styles
node_design_js -->|"selects"| node_flowers
node_design_js -->|"uses"| node_images
node_design_js -->|"uses"| node_fonts
node_design_page -->|"displays"| node_flowers
node_design_page -->|"formats"| node_fonts

click node_app "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/app.py"
click node_db "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/namesprouts.db"
click node_layout "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/layout.html"
click node_nav "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/nav.html"
click node_design_page "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/design.html"
click node_design_js "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/static/js/design.js"
click node_styles "https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/static/styles/styles.css"
click node_flowers "https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/flowers"
click node_images "https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/images"
click node_fonts "https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/fonts"

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 toneBlue
class node_layout,node_nav,node_public_pages,node_auth_pages,node_design_page,node_projects_pages,node_error_pages toneAmber
class node_design_js,node_styles,node_flowers,node_images,node_fonts toneMint
class node_db toneRose
```

## Components

### Flask backend

Request handling, auth, project CRUD, and persistence orchestration.

- [Flask app](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/app.py): entrypoint · Central Flask application for routing, sessions, auth, and project workflows. · `final/app.py`

### Templates

Jinja pages and shared layout for the browser UI.

- [Base layout](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/layout.html): template · Shared page shell extended by the site templates. · `final/templates/layout.html`
- [Navigation](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/nav.html): partial · Reusable navigation fragment included across pages. · `final/templates/nav.html`
- **Public pages**: template set · Home and informational pages for anonymous browsing.
- **Auth pages**: template set · Login and registration screens for user identity.
- [Design page](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/templates/design.html): interactive template · Main canvas for entering a name, choosing a month, previewing, and saving artwork. · `final/templates/design.html`
- **Projects pages**: template set · Saved-project listing and edit screens.
- **Error pages**: template set · Rendered responses for not-found and server errors.

### Static assets

Client-side behavior, styling, and artwork used to render the flower designs.

- [Preview JS](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/static/js/design.js): client script · Live preview logic that maps typed names and birth months to the flower composition. · `final/static/js/design.js`
- [Site styles](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/static/styles/styles.css): css · Shared styling for layout, typography, and the stem-like composition. · `final/static/styles/styles.css`
- [Flower art](https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/flowers): image assets · Month-specific flower visuals used in the generated artwork. · `final/static/flowers`
- [Images](https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/images): media assets · General supporting imagery for the site. · `final/static/images`
- [Fonts](https://github.com/beardlesshack/cs50-final-namesprouts/tree/main/final/static/fonts): font assets · Typography assets used to shape the visual presentation. · `final/static/fonts`

### Storage

Embedded SQLite database.

- [SQLite DB](https://github.com/beardlesshack/cs50-final-namesprouts/blob/main/final/namesprouts.db): database · Local persistent store for users and saved flower projects. · `final/namesprouts.db`

## Connections

- Flask app → Base layout: renders · Uses the shared base template for page composition.
- Flask app → Navigation: includes · Injects common navigation into pages.
- Flask app → Public pages: serves · Routes to the home and informational pages.
- Flask app → Auth pages: serves · Handles login and registration views.
- Flask app → Design page: serves · Delivers the interactive flower design experience.
- Flask app → Projects pages: serves · Lists and edits saved compositions.
- Flask app → Error pages: errors · Returns custom error pages.
- Flask app → SQLite DB: reads/writes · Persists users and saved projects in SQLite.
- Public pages → Base layout: extends · Uses the shared site shell.
- Auth pages → Base layout: extends · Uses the shared site shell.
- Design page → Base layout: extends · Uses the shared site shell.
- Projects pages → Base layout: extends · Uses the shared site shell.
- Error pages → Base layout: extends · Uses the shared site shell.
- Design page → Preview JS: drives · The page is powered by live preview behavior.
- Design page → Site styles: styled by · Relies on shared CSS for the layout and stem presentation.
- Preview JS → Flower art: selects · Chooses the month-specific flower artwork.
- Preview JS → Images: uses · May reference supporting image assets during preview.
- Preview JS → Fonts: uses · Depends on typography assets for composition.
- Design page → Flower art: displays · Combines user input with flower imagery.
- Design page → Fonts: formats · Uses typography to make the name read like a stem.
