# ak7no/firststepsinwebdev architecture

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

- Interactive diagram: https://gitdiagram.com/ak7no/firststepsinwebdev
- Repository: https://github.com/ak7no/firststepsinwebdev

## Overview

##### Project type and purpose
- This is a small full-stack web application (“firstStepsinWebDev”) in Python using Flask on the backend and Jinja2/HTML/CSS on the frontend.
- Purpose: a hotel-booking website with search, booking, review, and confirmation flows, backed by a SQLite database.

##### High-level file-structure analysis
- Root:
- main.py – application entry point (Flask app factory or app.run())
- instance/database.db – SQLite database file
- website/ (Flask application package)
- __init__.py – app creation, configuration, blueprint registration
- models.py – SQLAlchemy ORM models (Hotel, User, Booking, Guest)
- views.py – route handlers (booking search, detail, review, confirmation)
- static/ – CSS, video, JS, images
- templates/ – Jinja2 HTML templates for each page
- No external microservices; everything runs in one process.

##### README insights
- Frontend: HTML, CSS, JavaScript, Jinja2 for dynamic templating.
- Backend: Python Flask micro-framework, SQLAlchemy ORM, SQLite.
- Modular routing via Flask blueprints (auth.py for authentication + views.py for main pages, all registered in __init__.py).
- Database schema: four tables in (mostly) 3NF, managed by SQLAlchemy.

1. Client Browser (UI)
2. Flask Web Server (WSGI process)
- App Factory (main.py)
- Blueprints:
- Auth Blueprint (login/register flow)
- Booking Blueprint (search, detail, review, confirm)
3. Jinja2 Template Engine
4. Static Asset Server (serves CSS, JS, video)
5. SQLite Database (instance/database.db) via SQLAlchemy
6. ORM Layer (models.py)
1. Browser → HTTP request to Flask server endpoints (/search, /booking, /login, etc.)
2. Flask router (blueprints) → appropriate view function in views.py/auth.py
3. View function → ORM models (models.py) queried/updated via SQLAlchemy → SQLite
4. Query results → passed to Jinja2 → HTML pages
5. Flask → HTTP response → Browser
6. Browser loads static assets (CSS, JS, video) from Flask static route
c. Architectural patterns & principles:
- MVC-like structure:
- Models (ORM)
- Views (Flask view functions + Jinja templates)
- Controller (Flask routing layer + Blueprints)
- Single-process monolith with clear separation of concerns.
- Template-driven dynamic content generation.
d. Key technologies & libraries:
- Flask (micro-framework + Blueprints)
- Jinja2 (template engine)
- SQLAlchemy (ORM)
- SQLite (embedded relational database)
- HTML, CSS, JavaScript (frontend)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Client
    Client["Client Browser (UI)"]:::frontend

    %% Backend Components
    Main["App Entry Point\n(main.py)"]:::backend
    Init["App Factory & Blueprint Registration\n(__init__.py)"]:::backend
    Booking["Booking Blueprint\n(views.py)"]:::backend
    ORM["ORM Layer\n(models.py)"]:::orm
    Template["Jinja2 Template Engine\n(website/templates/)"]:::frontend
    Static["Static Asset Server\n(website/static/)"]:::frontend
    DB["SQLite Database\n(instance/database.db)"]:::db

    %% Flow
    Client -->|"HTTP Request"| Main
    Main -->|"create app & register blueprints"| Init
    Init -->|"route request"| Booking
    Booking -->|"SQLAlchemy query"| ORM
    ORM -->|"SQL commands"| DB
    DB -->|"query results"| ORM
    ORM --> Booking
    Booking -->|"render template"| Template
    Template -->|"HTML Response"| Client
    Client -->|"GET static assets"| Static
    Static -->|"serve CSS/JS/video"| Client

    %% Click Events
    click Client "https://github.com/ak7no/firststepsinwebdev/tree/main/website/templates/"
    click Main "https://github.com/ak7no/firststepsinwebdev/blob/main/main.py"
    click Init "https://github.com/ak7no/firststepsinwebdev/blob/main/website/__init__.py"
    click Booking "https://github.com/ak7no/firststepsinwebdev/blob/main/website/views.py"
    click ORM "https://github.com/ak7no/firststepsinwebdev/blob/main/website/models.py"
    click Template "https://github.com/ak7no/firststepsinwebdev/tree/main/website/templates/"
    click Static "https://github.com/ak7no/firststepsinwebdev/tree/main/website/static/"
    click DB "https://github.com/ak7no/firststepsinwebdev/blob/main/instance/database.db"

    %% Styles
    classDef frontend fill:#9cf,stroke:#036,stroke-width:2px
    classDef backend fill:#9f9,stroke:#060,stroke-width:2px
    classDef orm fill:#fc9,stroke:#f60,stroke-width:2px
    classDef db fill:#f99,stroke:#900,stroke-width:2px
```
